* Not depending on return value of super(). Fixes #9020. * Feedback from nicolo-ribaudo * Feedback -- fixing bad call to replaceWithMultiple
This commit is contained in:
parent
8b132c0889
commit
d305419da6
@ -15,9 +15,10 @@ class Foo extends function () {} {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (true) {
|
if (true) {
|
||||||
console.log(_this2 = super(), foo());
|
console.log((super(), _this2 = this), foo());
|
||||||
} else {
|
} else {
|
||||||
_this2 = super();
|
super();
|
||||||
|
_this2 = this;
|
||||||
console.log(foo());
|
console.log(foo());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -461,9 +461,14 @@ function getThisBinding(thisEnvFn, inConstructor) {
|
|||||||
if (supers.has(child.node)) return;
|
if (supers.has(child.node)) return;
|
||||||
supers.add(child.node);
|
supers.add(child.node);
|
||||||
|
|
||||||
child.replaceWith(
|
child.replaceWithMultiple([
|
||||||
t.assignmentExpression("=", t.identifier(thisBinding), child.node),
|
child.node,
|
||||||
);
|
t.assignmentExpression(
|
||||||
|
"=",
|
||||||
|
t.identifier(thisBinding),
|
||||||
|
t.identifier("this"),
|
||||||
|
),
|
||||||
|
]);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -82,8 +82,8 @@ describe("arrow function conversion", () => {
|
|||||||
() => this;
|
() => this;
|
||||||
`,
|
`,
|
||||||
`
|
`
|
||||||
var _supercall = (..._args) => _this = super(..._args),
|
var _supercall = (..._args) => (super(..._args), _this = this),
|
||||||
_this;
|
_this;
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
_supercall(345);
|
_supercall(345);
|
||||||
@ -115,9 +115,10 @@ describe("arrow function conversion", () => {
|
|||||||
(function () {
|
(function () {
|
||||||
_this;
|
_this;
|
||||||
});
|
});
|
||||||
_this = super();
|
super();
|
||||||
|
_this = this;
|
||||||
this;
|
this;
|
||||||
() => _this = super();
|
() => (super(), _this = this);
|
||||||
() => this;
|
() => this;
|
||||||
`,
|
`,
|
||||||
{ methodName: "constructor", extend: true },
|
{ methodName: "constructor", extend: true },
|
||||||
@ -144,9 +145,10 @@ describe("arrow function conversion", () => {
|
|||||||
|
|
||||||
_this;
|
_this;
|
||||||
}).bind(_arrowCheckId);
|
}).bind(_arrowCheckId);
|
||||||
_this = super();
|
super();
|
||||||
|
_this = this;
|
||||||
this;
|
this;
|
||||||
() => _this = super();
|
() => (super(), _this = this);
|
||||||
() => this;
|
() => this;
|
||||||
`,
|
`,
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user