-
It seems in the latest version of swc_ecmascript the namespace Test {
export const t = 5;
} ...will be renamed to function A() {
console.log("@A evaluated");
return function (
target: any,
propertyKey: string,
descriptor: PropertyDescriptor,
) {
console.log("@A called");
const fn = descriptor.value;
descriptor.value = function () {
console.log("fn() called from @A");
fn();
};
};
}
function B() {
console.log("@B evaluated");
return function (
target: any,
propertyKey: string,
descriptor: PropertyDescriptor,
) {
console.log("@B called");
const fn = descriptor.value;
descriptor.value = function () {
console.log("fn() called from @B");
fn();
};
};
}
class C {
@A()
@B()
static test() {
console.log("C.test() called");
}
}
C.test(); Will have some output that looks like this: var _class,_dec,_dec; ...which is resolved by doing a I noticed that names are not renamed on the swc playground, but once setting Is this something that swc could support or is this just a limitation of it? If so, I can work around it, but I was wondering if it's desired in swc or if there is a way to do this. Maybe the fix might be to improve the emit of experimental decorators. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
The problem here is the ownership model of rust. To do so, we need mutable references to AST and the scope at the same time, and we have to ensure we update We may add That's why I implemented identifier management based on I think |
Beta Was this translation helpful? Give feedback.
-
Resolved by #2940. |
Beta Was this translation helpful? Give feedback.
Resolved by #2940.