ApeWorX / ethpm-types

Implementation of EIP-2678
Apache License 2.0
14 stars 8 forks source link

feat: able to get defining function in AST object [APE-677] #62

Closed antazoey closed 1 year ago

antazoey commented 1 year ago

What I did

Realized it would be convenient for coverage work to let us look up defining method AST nodes via found statement nodes.

How I did it

The functions at module level AST are found via [n for n in self.children if n.ast_type == "FunctionDef"] And if any function node contains the given line numbers, than it must be the defining function node. Else it may not be in a function, and that is fine also.

How to verify it

Checklist