@ -235,7 +235,7 @@ def parse_type(
sl : " SlitherCompilationUnit "
renaming : Dict [ str , str ]
user_defined_ types: Dict [ str , TypeAlias ]
type_alias es : Dict [ str , TypeAlias ]
enums_direct_access : List [ " Enum " ] = [ ]
# Note: for convenicence top level functions use the same parser than function in contract
# but contract_parser is set to None
@ -247,13 +247,13 @@ def parse_type(
sl = caller_context . compilation_unit
next_context = caller_context
renaming = { }
user_defined_ types = sl . user_defined_value_typ es
type_alias es = sl . type_alias es
else :
assert isinstance ( caller_context , FunctionSolc )
sl = caller_context . underlying_function . compilation_unit
next_context = caller_context . slither_parser
renaming = caller_context . underlying_function . file_scope . renaming
user_defined_ types = caller_context . underlying_function . file_scope . user_defined_ types
type_alias es = caller_context . underlying_function . file_scope . type_alias es
structures_direct_access = sl . structures_top_level
all_structuress = [ c . structures for c in sl . contracts ]
all_structures = [ item for sublist in all_structuress for item in sublist ]
@ -299,7 +299,7 @@ def parse_type(
functions = list ( scope . functions )
renaming = scope . renaming
user_defined_ types = scope . user_defined_ types
type_alias es = scope . type_alias es
elif isinstance ( caller_context , ( ContractSolc , FunctionSolc ) ) :
sl = caller_context . compilation_unit
if isinstance ( caller_context , FunctionSolc ) :
@ -329,7 +329,7 @@ def parse_type(
functions = contract . functions + contract . modifiers
renaming = scope . renaming
user_defined_ types = scope . user_defined_ types
type_alias es = scope . type_alias es
else :
raise ParsingError ( f " Incorrect caller context: { type ( caller_context ) } " )
@ -343,8 +343,8 @@ def parse_type(
name = t . name
if name in renaming :
name = renaming [ name ]
if name in user_defined_ types:
return user_defined_ types[ name ]
if name in type_alias es :
return type_alias es [ name ]
return _find_from_type_name (
name ,
functions ,
@ -365,9 +365,9 @@ def parse_type(
name = t [ " typeDescriptions " ] [ " typeString " ]
if name in renaming :
name = renaming [ name ]
if name in user_defined_ types:
_add_type_references ( user_defined_ types[ name ] , t [ " src " ] , sl )
return user_defined_ types[ name ]
if name in type_alias es :
_add_type_references ( type_alias es [ name ] , t [ " src " ] , sl )
return type_alias es [ name ]
type_found = _find_from_type_name (
name ,
functions ,
@ -386,9 +386,9 @@ def parse_type(
name = t [ " attributes " ] [ type_name_key ]
if name in renaming :
name = renaming [ name ]
if name in user_defined_ types:
_add_type_references ( user_defined_ types[ name ] , t [ " src " ] , sl )
return user_defined_ types[ name ]
if name in type_alias es :
_add_type_references ( type_alias es [ name ] , t [ " src " ] , sl )
return type_alias es [ name ]
type_found = _find_from_type_name (
name ,
functions ,
@ -407,8 +407,8 @@ def parse_type(
name = t [ " name " ]
if name in renaming :
name = renaming [ name ]
if name in user_defined_ types:
return user_defined_ types[ name ]
if name in type_alias es :
return type_alias es [ name ]
type_found = _find_from_type_name (
name ,
functions ,