Repository navigation
fix!: attach exported class decorators to their class - #104
Merged
Merged
Conversation
BREAKING CHANGE: Decorators before export belong to class_declaration rather than export_statement. The class range includes the intervening export keywords. Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
…corator-ownership
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.
Why
Decorators preceding
exportare siblings of the class, so class/decorator queries miss exported declarations. The JavaScript export rule causes the inherited problem reported intree-sitter/tree-sitter-typescript#331.Requirements
Customer Summary
Decorators before or after export now belong to class_declaration. Named exports and named/anonymous default classes retain canonical declaration queries and incremental parsing behavior.
Technical Summary
A hidden decorated-export supertype aliases to declaration and wraps the decorated class alias, preserving both levels of query ancestry. The class-only default-export branch uses the literal default keyword because its declaration form is unambiguous. Update the corpus expectation and regenerate the profiled parser and node types.
Testing
MISE_RUST_VERSION=1.99.1 bun run verify: passed; no code-gauge violations in changed code.bun run build/ci: passed.bun wb test test/unit/exportedDecorators.test.ts test/unit/defaultExports.test.ts: 7 tests passed.script/tree-sitter test: all 199 corpus parses passed.bun wb test test/unit/queries.test.ts --grep 'compiles the queries': passed.Notes
Breaking tree change: before-export decorators move from export_statement to class_declaration, whose range includes the intervening export/default keywords. Queries requiring those keywords to be direct children of export_statement must adapt.
TypeScript overrides its export and class rules; its corresponding integration is still needed before the upstream TypeScript issue is resolved in that fork. This PR does not address legacy call assignments or other grammar issues.