-
-
Notifications
You must be signed in to change notification settings - Fork 722
Labels
A-minifierArea - MinifierArea - Minifier
Description
Inner scopes can inherit identifiers of private class members, and also shadow them. This is similar to regular block-scopes identifiers. For example, the following code outputs "foo":
class X {
constructor() {
this.#foo = "foo";
}
get y() {
let self = this;
return class Y {
constructor() {
console.log(self.#foo);
}
};
}
#foo; // Note that private identifiers are also inherited by preceding inner `class` scopes.
}
new new X().y();
The mangler currently breaks this code by transforming #foo in the outer scope only:
class X{constructor(){this.#e=`foo`}get y(){let e=this;return class{constructor(){console.log(e.#foo)}}}#e}new new X().y;
Metadata
Metadata
Assignees
Labels
A-minifierArea - MinifierArea - Minifier