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

Add an AST walking function #939

Merged
merged 2 commits into from
May 25, 2021
Merged

Add an AST walking function #939

merged 2 commits into from
May 25, 2021

Conversation

turbolent
Copy link
Member

Description

Add a function to walk the AST, similar to Go's function: https://golang.org/src/go/ast/walk.go

The implementation of Walk for the AST elements currently only visits child elements. A future version could also visit more information, such as identifiers, types, etc.

The current implementation is enough to determine the parent element of each element.


  • Targeted PR against master branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work
  • Code follows the standards mentioned here
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

Copy link
Member

@SupunS SupunS left a comment

Choose a reason for hiding this comment

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

Nice addition to the visitors!

runtime/ast/inspect.go Show resolved Hide resolved
runtime/ast/walk.go Show resolved Hide resolved
@codecov-commenter
Copy link

Codecov Report

Merging #939 (7aaf2da) into master (159015d) will decrease coverage by 0.14%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #939      +/-   ##
==========================================
- Coverage   74.20%   74.05%   -0.15%     
==========================================
  Files         267      269       +2     
  Lines       33001    33067      +66     
==========================================
  Hits        24487    24487              
- Misses       7386     7452      +66     
  Partials     1128     1128              
Flag Coverage Δ
unittests 74.05% <0.00%> (-0.15%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
runtime/ast/block.go 87.50% <0.00%> (-7.96%) ⬇️
runtime/ast/composite.go 56.25% <0.00%> (-1.20%) ⬇️
runtime/ast/expression.go 66.74% <0.00%> (-3.33%) ⬇️
runtime/ast/function_declaration.go 63.26% <0.00%> (-2.70%) ⬇️
runtime/ast/import.go 73.33% <ø> (ø)
runtime/ast/inspect.go 0.00% <0.00%> (ø)
runtime/ast/interface.go 81.25% <0.00%> (-5.42%) ⬇️
runtime/ast/pragma.go 68.75% <0.00%> (-4.59%) ⬇️
runtime/ast/program.go 71.92% <0.00%> (-1.29%) ⬇️
runtime/ast/statement.go 72.89% <0.00%> (-8.87%) ⬇️
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 159015d...7aaf2da. Read the comment docs.

@turbolent turbolent merged commit f34711d into master May 25, 2021
@turbolent turbolent deleted the bastian/ast-walk branch May 25, 2021 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants