Fix empty do-while loop parsing (close #133)

pull/132/head
Josselin 6 years ago
parent 05556c932b
commit 889edd2952
  1. 6
      slither/solc_parsing/declarations/function.py

@ -313,7 +313,11 @@ class FunctionSolc(Function):
node_endDoWhile = self._new_node(NodeType.ENDLOOP, doWhilestatement['src']) node_endDoWhile = self._new_node(NodeType.ENDLOOP, doWhilestatement['src'])
link_nodes(node, node_startDoWhile) link_nodes(node, node_startDoWhile)
link_nodes(node_startDoWhile, node_condition.sons[0]) # empty block, loop from the start to the condition
if not node_condition.sons:
link_nodes(node_startDoWhile, node_condition)
else:
link_nodes(node_startDoWhile, node_condition.sons[0])
link_nodes(statement, node_condition) link_nodes(statement, node_condition)
link_nodes(node_condition, node_endDoWhile) link_nodes(node_condition, node_endDoWhile)
return node_endDoWhile return node_endDoWhile

Loading…
Cancel
Save