fix(parser): correctly parse decorators of property declaration#11370
fix(parser): correctly parse decorators of property declaration#11370Dunqing merged 4 commits intooxc-project:mainfrom
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
CodSpeed Instrumentation Performance ReportMerging #11370 will not alter performanceComparing Summary
|
There was a problem hiding this comment.
Pull Request Overview
This PR fixes the parser logic for processing property decorators by reordering the parsing of type annotations and consuming decorators.
- Re-orders the parsing flow to first consume decorators and then parse type annotations.
- Updates the snapshot and fixture files for TS property decorators.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| crates/oxc_parser/src/js/class.rs | Reordered the processing of type annotations and decorators to correctly parse decorators on property declarations. |
| crates/oxc_isolated_declarations/tests/snapshots/class-decorator.snap | Added expected snapshot output for class decorators. |
| crates/oxc_isolated_declarations/tests/fixtures/class-decorator.ts | Added test fixture demonstrating decorator usage on properties. |
|
Can you add these tests to https://github.com/oxc-project/oxc/blob/d78c04e06ab1d92f3ecd67acd5a5f58f5af76d32/crates/oxc_codegen/tests/integration/unit.rs as well? This way we can know the bug comes from the parser or the isolatedDeclaration transformation if it breaks in the future. |
Done. |
Dunqing
left a comment
There was a problem hiding this comment.
Nice work! Thanks for taking the time on this!
isolatedDeclarationstransform output when class property is annotated with a decorator and the property has an annotated type of a function with at least one argument #11367