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

feat[tool]: add all imported modules to -f annotated_ast output #4209

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

charles-cooper
Copy link
Member

What I did

How I did it

How to verify it

Commit message

Commit message for the final, squashed PR. (Optional, but reviewers will appreciate it! Please see our commit message style guide for what we would ideally like to see in a commit message.)

Description for the changelog

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

vyper/compiler/output.py Fixed Show fixed Hide fixed
@charles-cooper charles-cooper marked this pull request as ready for review August 11, 2024 04:27
Copy link

codecov bot commented Aug 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.26%. Comparing base (f909d6e) to head (7064b54).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4209      +/-   ##
==========================================
- Coverage   91.35%   88.26%   -3.10%     
==========================================
  Files         109      109              
  Lines       15635    15656      +21     
  Branches     3443     3448       +5     
==========================================
- Hits        14283    13818     -465     
- Misses        920     1306     +386     
- Partials      432      532     +100     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

# come from multiple InputBundles (particularly builtin interfaces),
# so source_id is not guaranteed to be unique.
if ast.resolved_path in unique_modules:
# sanity check -- object equality
Copy link
Collaborator

Choose a reason for hiding this comment

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

is operator checks for identity, not equality

Copy link
Member Author

Choose a reason for hiding this comment

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

yea, that's what I meant by object ("pointer") equality

annotated_ast_dict = {
"contract_name": str(compiler_data.contract_path),
"ast": ast_to_dict(compiler_data.annotated_vyper_module),
"imports": [ast_to_dict(ast) for ast in unique_modules.values()],
Copy link
Collaborator

Choose a reason for hiding this comment

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

it might be confusing to have all the imports flattened into main as this also includes indirect imports

Copy link
Member Author

Choose a reason for hiding this comment

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

It's a way of normalization, it avoids duplicating trees in the output

@cyberthirst
Copy link
Collaborator

can we add a test for recursive imports?

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