Skip to content

feat: add VisitNode function to builder#1904

Merged
elsapet merged 1 commit intomainfrom
feat/add-visit-node-fn-to-builder
Feb 25, 2026
Merged

feat: add VisitNode function to builder#1904
elsapet merged 1 commit intomainfrom
feat/add-visit-node-fn-to-builder

Conversation

@elsapet
Copy link
Copy Markdown
Contributor

@elsapet elsapet commented Feb 25, 2026

Description

  • Added SetVisitNode and VisitNode functions to the Builder, allowing analyzers to visit individual child subtrees instead of all-or-nothing visitChildren
  • Set function in analyzeNode in ast.go before each Analyze call

This is to address a cyclic issue that can be seen when handling for-loops for some languages:

The root cause is that visitChildren is all-or-nothing — you either visit all children or none. What for-loops need is to visit the value in the outer scope, then declare bindings, then visit the body in the inner scope.

We keep the impact minimal here and do not use this VisitNode for bearer languages, although Java could benefit from it

Checklist

If this is your first time contributing please sign the CLA

  • I've added test coverage that shows my fix or feature works as expected.
  • I've updated or added documentation if required.

@elsapet elsapet force-pushed the feat/add-visit-node-fn-to-builder branch from fe5342f to f16b7ab Compare February 25, 2026 07:49
@elsapet elsapet requested a review from didroe February 25, 2026 08:19
@elsapet elsapet merged commit db06eee into main Feb 25, 2026
9 checks passed
@elsapet elsapet deleted the feat/add-visit-node-fn-to-builder branch February 25, 2026 10:10
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