-
-
Notifications
You must be signed in to change notification settings - Fork 475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(transformer/class-properties): transform static/instance accessor methods #8132
Draft
Dunqing
wants to merge
1
commit into
12-26-feat_transformer_class-properties_transform_static_private_method_invoking
Choose a base branch
from
12-26-feat_transformer_class-properties_transform_static_instance_accessor_methods
base: 12-26-feat_transformer_class-properties_transform_static_private_method_invoking
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+399
−186
Conversation
This file contains 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
github-actions
bot
added
A-transformer
Area - Transformer / Transpiler
C-enhancement
Category - New feature or request
labels
Dec 26, 2024
This was referenced Dec 26, 2024
Draft
CodSpeed Performance ReportMerging #8132 will not alter performanceComparing Summary
|
Dunqing
force-pushed
the
12-26-feat_transformer_class-properties_transform_static_private_method_invoking
branch
from
December 26, 2024 16:12
f3ee3e1
to
1338938
Compare
Dunqing
force-pushed
the
12-26-feat_transformer_class-properties_transform_static_instance_accessor_methods
branch
from
December 26, 2024 16:13
56fb20e
to
a7a20d0
Compare
Dunqing
force-pushed
the
12-26-feat_transformer_class-properties_transform_static_private_method_invoking
branch
from
December 26, 2024 16:42
1338938
to
727cba8
Compare
Dunqing
force-pushed
the
12-26-feat_transformer_class-properties_transform_static_instance_accessor_methods
branch
from
December 26, 2024 16:42
a7a20d0
to
0f5cc4d
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
This PR supports transforming private
getter
orsetter
methods, and the output is a little different from Babel's output, For example:Input:
Babel's output:
Oxc's output:
Main difference
From the main differences, we can see that Babel handles
getter
andsetter
methods usingclassPrivateGetter
andclassPrivateSetter
helper functions, which causes all usethis
andarguments
needs to rewrite to use a temp var instead ingetter
andsetter
methods. This is unnecessary and is not an efficient transformation for us.Instead, I adapt binding a
this
instead of passing inthis
, this way we don't need to rewrite anything. We can't control thehelper
library for now, so I just transformed the AST to bindthis
, in the future, we can create a helper function to do the same thing.