Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing parsing import alias issue #2455

Closed
wants to merge 6 commits into from
Closed
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions slither/solc_parsing/expressions/expression_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,23 @@
value = filter_name(value)

var, was_created = find_variable(value, caller_context, referenced_declaration)

if "typeDescriptions" in expression:

pattern = r"\b(\w+)\s*\)"

type_string = expression["typeDescriptions"]["typeString"]

type_string_name = re.search(pattern, type_string)

if type_string_name:
found_contract = type_string_name.group(1)
all_contracts_dict = {c.name: c for c in caller_context.compilation_unit.contracts}

if str(var) in all_contracts_dict.keys() and found_contract in all_contracts_dict.keys():
if str(var) != found_contract:
var = all_contracts_dict[found_contract]

Check warning on line 527 in slither/solc_parsing/expressions/expression_parsing.py

View workflow job for this annotation

GitHub Actions / Lint Code Base

C0303: Trailing whitespace (trailing-whitespace)
if was_created:
var.set_offset(src, caller_context.compilation_unit)

Expand Down
Loading