Repository navigation
Compute node bounds once at construction - #1865
Merged
Merged
Conversation
Body, Block, AnnotationExpression and the literal expressions computed their bounds lazily, so plugin edits could change them after the fact. Every node now sets its bounds in its constructor from what it was given. Empty blocks get theirs from the parent's constructor via Block.setBoundsBetween(), and the parser builds Body after its statements are known. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
# Conflicts: # src/parser/Statement.ts
…tion-time-bounds # Conflicts: # src/parser/AstNode.spec.ts
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tion-time-bounds # Conflicts: # src/parser/AstNode.spec.ts # src/parser/Expression.ts # src/parser/Statement.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #1845.
Body,Block,AnnotationExpressionand the literal expressions computed their bounds lazily, so a plugin editing the AST could change them after parsing. Bounds should describe where a node came from in the original source.pos/end/sourcein its constructor from what it was givenBlock.setBoundsBetween()(function, if/else,#if, for, for each, while, try/catch)Bodyafter its statements are known, and sets annotation bounds once its call is attachedVerified with
npm run test:nocover(new tests for each empty-block parent and for bounds surviving later AST edits).🤖 Generated with Claude Code