-
-
Notifications
You must be signed in to change notification settings - Fork 496
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
transformer: Invalid output for stage 3 decorator #8628
Comments
Oh I think I figured it out. We create a dummy oxc/crates/oxc_transformer/src/es2022/class_properties/class.rs Lines 153 to 163 in 2a2ad53
The private method transform visits body of the method and replaces all references to the class name with So question is: What's the fix? We could solve the monitor-oxc error easily by making the output valid syntatically (but nonsensical): - let dummy_binding = BoundIdentifier::new(Atom::empty(), SymbolId::new(0));
+ let dummy_binding = BoundIdentifier::new(Atom::from("DUMMY"), SymbolId::new(0)); But that's not a real fix! Should we do that for now and get monitor-oxc passing, and decorators transform will deal with it properly? Or do legacy decorators not include Other options:
Any opinion @Dunqing? |
Thank you for the investigation.
This is stage 3 decorator. We should throw an "stage 3 decorator not supported" error right now. |
I disabled it in oxc-project/monitor-oxc@28c3d1a Let's come back to this after stage 3 decorator is implemented.
|
Reduced example, boiled down from failures in monitor-oxc: https://github.com/oxc-project/monitor-oxc/actions/runs/12864766675/job/35864033007
Input:
Output:
Oxc playground
What is really weird is that if you comment out the
let x
line, then you get different output for_method()
:Oxc playground
But that's not correct either! If
#prop
was a normal property not an accessor, it should be_classPrivateFieldGet(_prop, this);
.The bogus output
_classPrivateFieldGet(, this)
is in once sense "correct" because we don't support accessor properties, so there is no_prop
variable.But why does whether there's a line
let x
above the class make any difference to the output? Any other statement which generates a binding also produces the empty output e.g.const x = 1;
,var x;
,function x() {}
,class X {}
, but other statements e.g.x = 1
don't.I suspect there may be 2 different bugs at play here.
The text was updated successfully, but these errors were encountered: