fix(transformer/typescript): correctly resolve references to non-constant enum members#8543
Merged
Boshen merged 7 commits intooxc-project:mainfrom Jan 18, 2025
Merged
Conversation
Contributor
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. |
branchseer
commented
Jan 16, 2025
branchseer
commented
Jan 16, 2025
CodSpeed Performance ReportMerging #8543 will not alter performanceComparing Summary
|
Member
|
@Dunqing You wrote this transform and are more familiar with it. Would you be able to review please? |
Boshen
added a commit
that referenced
this pull request
Jan 19, 2025
## [0.47.1] - 2025-01-19 ### Features - ee8ee55 napi/parser: Add `.hasChanged()` to `MagicString` (#8586) (Boshen) - 1bef911 napi/parser: Add source map API (#8584) (Boshen) ### Bug Fixes - 7b219a9 minifier: Fix dce shadowed undefined (#8582) (Boshen) - 7421a52 transformer/typescript: Correctly resolve references to non-constant enum members (#8543) (branchseer) Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
Boshen
pushed a commit
that referenced
this pull request
Jan 19, 2025
Follow up from #8543 (comment) > I agree. https://github.com/oxc-project/backlog/issues/155 > Originally we were considering some form of interning and reference-counting, so we didn't make it Copy to leave the door open for that. But now all strings are stored in the arena anyway, so even if we did decide to intern strings, reference-counting would be irrelevant - our bump allocator doesn't allow freeing individual allocations anyway. Most of the changes are done automatically by `just fix` (`cargo clippy --fix` && `cargo fmt --all`). See the commit list for the manual edits.
Boshen
pushed a commit
that referenced
this pull request
Jan 26, 2025
…outer scope (#8691) ```typescript var x = 10; enum Merge { x = Math.random() } enum Merge { y = x // <-- refers to Merge.x } ``` This case wasn't covered in #8543 and by the [babel test case](https://github.com/babel/babel/blob/e568916ef3e5fd288039a65c904b12a7eba2a73a/packages/babel-plugin-transform-typescript/test/fixtures/enum/non-constant-member-reference/input.ts). To handle it we still have to go through the scope ancestors. --------- Co-authored-by: Dunqing <dengqing0821@gmail.com>
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.
fixes #8342