Skip to content

feat!: Lazy AST and access to root AST model#113

Open
antazoey wants to merge 5 commits intoApeWorX:mainfrom
antazoey:perf/lazyast
Open

feat!: Lazy AST and access to root AST model#113
antazoey wants to merge 5 commits intoApeWorX:mainfrom
antazoey:perf/lazyast

Conversation

@antazoey
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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