Closed
Description
Given the following input code:
class Holder {
constructor() {
this.val = {internal: true};
this.context = {getVal: () => this.val}
}
}
console.log(new Holder().context.getVal().internal);
Outputs:
class a {
constructor() {
this.g = {h:!0};
this.i = {j:() => this.g};
}
}
console.log((new a).i.g.h);
The InlineSimpleMethods
replaces the call of getVal()
with val
, which is incorrect because the this
in the definition of getVal
is not context
, but rather Holder
.
This is not a problem in ES5, because the arrow function is already rewritten before running this pass.
Metadata
Metadata
Assignees
Labels
No labels