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!: Lazy AST and access to root AST model #113

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

antazoey
Copy link
Member

@antazoey antazoey commented Jan 19, 2024

What I did

ast parsing is lazy now by utilizing root model

as a bonus, allows the raw compiler output to be accessible
fixes: ApeWorX/ape#1590

How I did it

use root model
make everything a property or lazy evaluated

How to verify it

things still work but are a bit faster

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)


# The dumped model MUST be the same as the raw data!
# NOTE: Must happen AFTER the classification step above.
dumped_model = node.model_dump(mode="json", by_alias=True)
Copy link
Member Author

@antazoey antazoey Jan 19, 2024

Choose a reason for hiding this comment

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

when integrating with slither , dump as JSON using aliases and the model should be exactly the same as the compiler output now

Copy link
Member

Choose a reason for hiding this comment

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

@antazoey antazoey changed the title perf!: Lazy AST feat!: Lazy AST and access to root AST model Jan 19, 2024
fubuloubu
fubuloubu previously approved these changes Jan 19, 2024
fubuloubu
fubuloubu previously approved these changes Mar 20, 2024
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.

raw AST is missing from output (only shows ape-adjusted AST)
2 participants