Skip to content

Commit

Permalink
filter for nonpure builtins from namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
tserg committed May 18, 2023
1 parent b3e4b62 commit 79e1674
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions vyper/semantics/analysis/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,16 @@ def __init__(
node_list.extend(standalone_self) # type: ignore

# Add references to builtin functions reading from the chain's state
# TODO Fix circular import
from vyper.builtins.functions import BUILTIN_FUNCTIONS

builtin_fns = fn_node.get_descendants(vy_ast.Name, {"id": set(BUILTIN_FUNCTIONS)})
non_pure_builtin_fns = [
k
for k, v in self.namespace.items()
if (
isinstance(v, VarInfo)
and isinstance(v.typ, BuiltinFunction)
and v.typ.mutability > StateMutability.PURE
)
]
builtin_fns = fn_node.get_descendants(vy_ast.Name, {"id": non_pure_builtin_fns})

node_list.extend(builtin_fns) # type: ignore

Expand Down

0 comments on commit 79e1674

Please sign in to comment.