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

Improve support using for directive #1378

Merged
merged 15 commits into from
Jan 5, 2023
Merged

Improve support using for directive #1378

merged 15 commits into from
Jan 5, 2023

Conversation

smonicas
Copy link
Contributor

Fixes #1352

@CodeSandwich
Copy link
Contributor

What's the state of this PR?

@0xalpharush
Copy link
Contributor

@CodeSandwich this should work on your codebase now. Lmk if you find additional issues

@@ -574,21 +574,26 @@ def analyze_state_variables(self):
except (VariableNotFound, KeyError) as e:
self.log_incorrect_parsing(f"Missing state variable {e}")

def analyze_using_for(self):
def analyze_using_for(self): # pylint: disable=too-many-branches
try:
for father in self._contract.inheritance:
self._contract.using_for.update(father.using_for)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smonicas One thing I wasn't sure about is if there'd be a reason we also need to update child contracts' using_for_complete

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there is a need because the first use of using_for_complete is when converting to slithir which comes after parsing is finished

slither/slithir/convert.py Outdated Show resolved Hide resolved
slither/slithir/convert.py Show resolved Hide resolved

def _analyze_library_function(self, function_name: str, type_name: Type) -> None:
function_name_split = function_name.split(".")
# TODO this doesn't handle the case if there is an import with an alias
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we open a separate issue to track this, with an example?

slither/solc_parsing/declarations/using_for_top_level.py Outdated Show resolved Hide resolved
slither/solc_parsing/declarations/using_for_top_level.py Outdated Show resolved Hide resolved
slither/solc_parsing/declarations/using_for_top_level.py Outdated Show resolved Hide resolved
@montyly montyly merged commit f55cf6d into dev Jan 5, 2023
@montyly montyly deleted the dev-fix-usingfor branch January 5, 2023 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants