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: AST nodes [APE-967] #105

Merged
merged 4 commits into from
May 23, 2023
Merged

feat: AST nodes [APE-967] #105

merged 4 commits into from
May 23, 2023

Conversation

antazoey
Copy link
Member

@antazoey antazoey commented May 23, 2023

What I did

  • Get AST data and create objects from ethpm-types for each contract type

How I did it

For the input JSON, you have to put "ast" at the source level; not the contract level, for it to work.
This means Ape is slightly bloated in that will have duplicate AST info when contracts are stored in the same file.

this will be needed for contract flattening (i think, based on looking at past implementation), that is why i added it

How to verify it

Can now play with the AST node in contracts.

Checklist

  • Passes all linting checks (pre-commit and CI jobs)
  • New test cases have been added and are passing
  • Documentation has been updated
  • PR title follows Conventional Commit standard (will be automatically included in the changelog)

@vany365 vany365 changed the title feat: AST nodes feat: AST nodes [APE-967] May 23, 2023
ct_data["userdoc"] = load_dict(ct_data["userdoc"])
ct_data["devdoc"] = load_dict(ct_data["devdoc"])
ct_data["sourcemap"] = evm_data["bytecode"]["sourceMap"]
ct_data["ast"] = ast
Copy link
Member Author

Choose a reason for hiding this comment

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

would be nice to be able to filter out AST nodes that are specific to this contract, but not sure that is a very easy task.

(currently if 2 contracts are in same file, they have exact same AST structure)

@antazoey
Copy link
Member Author

antazoey commented May 23, 2023

wtf why is typing-extensions always breaking everything... we dont even support Python 3.7.... 😠

Screenshot 2023-05-23 at 09 13 53

"packaging", # Use the version ape requires
"requests",
"typing-extensions==4.5.0", # Can be removed onced pinned in Core.
Copy link
Member Author

Choose a reason for hiding this comment

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

once pydantic updates, we should be good: pydantic/pydantic#5824

@antazoey antazoey requested review from z80dev and fubuloubu May 23, 2023 14:59
@antazoey antazoey merged commit 6bc9ec9 into ApeWorX:main May 23, 2023
@antazoey antazoey deleted the feat/ast branch May 23, 2023 16:02
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.

2 participants