Skip to content

Commit

Permalink
Merge pull request #1205 from eth-brownie/fix/fn-outside-contract
Browse files Browse the repository at this point in the history
fix: handle function outside contract
  • Loading branch information
iamdefinitelyahuman authored Aug 16, 2021
2 parents 551e4a2 + 0b743a9 commit eb0dd3c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions brownie/project/compiler/solidity.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,12 @@ def _get_active_fn(source_node: NodeBase, offset: Tuple[int, int]) -> Tuple[Node
name = "<constructor>"
else:
name = "<fallback>"

parent = fn_node.parent()
if parent.nodeType == "SourceUnit":
# the function exists outside a contract
return fn_node, name

return fn_node, f"{fn_node.parent().name}.{name}"


Expand Down

0 comments on commit eb0dd3c

Please sign in to comment.