From fedfa6b221671b562ac2f5a61759d7def6c40dda Mon Sep 17 00:00:00 2001 From: alpharush <0xalpharush@protonmail.com> Date: Thu, 26 Sep 2024 17:58:45 -0500 Subject: [PATCH] fix: mapping to type value lookup with top-level constant --- slither/solc_parsing/solidity_types/type_parsing.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/slither/solc_parsing/solidity_types/type_parsing.py b/slither/solc_parsing/solidity_types/type_parsing.py index 6ca015127..db610d8a2 100644 --- a/slither/solc_parsing/solidity_types/type_parsing.py +++ b/slither/solc_parsing/solidity_types/type_parsing.py @@ -209,6 +209,9 @@ def parse_type( t: Union[Dict, UnknownType], caller_context: Union[CallerContextExpression, "SlitherCompilationUnitSolc"], ) -> Type: + print("parse_type") + print(t) + print(type(caller_context)) """ caller_context can be a SlitherCompilationUnitSolc because we recursively call the function and go up in the context's scope. If we are really lost we just go over the SlitherCompilationUnitSolc @@ -293,7 +296,7 @@ def parse_type( scope = custom_error.contract.file_scope sl = caller_context.compilation_unit - next_context = caller_context.slither_parser + next_context = caller_context structures_direct_access = list(scope.structures.values()) all_structuress = [c.structures for c in scope.contracts.values()] all_structures = [item for sublist in all_structuress for item in sublist] @@ -450,6 +453,7 @@ def parse_type( if is_compact_ast: mappingFrom = parse_type(t["keyType"], next_context) + print(type(caller_context)) mappingTo = parse_type(t["valueType"], next_context) else: assert len(t["children"]) == 2