Merge pull request #949 from crytic/dev-yul-top-level

Improve YUL parsing on top level function
pull/952/head
Feist Josselin 3 years ago committed by GitHub
commit 3b1a07ea05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      slither/solc_parsing/yul/parse_yul.py

@ -137,7 +137,7 @@ class YulScope(metaclass=abc.ABCMeta):
@property
def compilation_unit(self) -> SlitherCompilationUnit:
return self._contract.compilation_unit
return self._parent_func.compilation_unit
@property
def parent_func(self) -> Optional[Function]:
@ -714,14 +714,16 @@ def parse_yul_identifier(root: YulScope, _node: YulNode, ast: Dict) -> Optional[
return Identifier(YulBuiltin(name))
# check function-scoped variables
if root.parent_func:
variable = root.parent_func.get_local_variable_from_name(name)
parent_func = root.parent_func
if parent_func:
variable = parent_func.get_local_variable_from_name(name)
if variable:
return Identifier(variable)
variable = root.parent_func.contract.get_state_variable_from_name(name)
if variable:
return Identifier(variable)
if isinstance(parent_func, FunctionContract):
variable = parent_func.contract.get_state_variable_from_name(name)
if variable:
return Identifier(variable)
# check yul-scoped variable
variable = root.get_yul_local_variable_from_name(name)

Loading…
Cancel
Save