Do not add implicit return after `THROW` node

pull/1880/head
webthethird 2 years ago
parent 0a1699588d
commit 91a63bb36d
  1. 4
      slither/solc_parsing/declarations/function.py

@ -1286,12 +1286,12 @@ class FunctionSolc(CallerContextExpression):
return return
return_node = self._new_node(NodeType.RETURN, cfg["src"], self.underlying_function) return_node = self._new_node(NodeType.RETURN, cfg["src"], self.underlying_function)
for node, node_solc in self._node_to_nodesolc.items(): for node, node_solc in self._node_to_nodesolc.items():
if len(node.sons) == 0 and node.type != NodeType.RETURN: if len(node.sons) == 0 and node.type not in [NodeType.RETURN, NodeType.THROW]:
link_underlying_nodes(node_solc, return_node) link_underlying_nodes(node_solc, return_node)
for _, yul_block in self._node_to_yulobject.items(): for _, yul_block in self._node_to_yulobject.items():
for yul_node in yul_block.nodes: for yul_node in yul_block.nodes:
node = yul_node.underlying_node node = yul_node.underlying_node
if len(node.sons) == 0 and node.type != NodeType.RETURN: if len(node.sons) == 0 and node.type not in [NodeType.RETURN, NodeType.THROW]:
link_underlying_nodes(yul_node, return_node) link_underlying_nodes(yul_node, return_node)
if self.is_compact_ast: if self.is_compact_ast:
self._add_return_exp_compact(return_node, cfg) self._add_return_exp_compact(return_node, cfg)

Loading…
Cancel
Save