Skip to content

Commit

Permalink
Feedback from nicolo-ribaudo
Browse files Browse the repository at this point in the history
  • Loading branch information
joeldenning committed Dec 3, 2018
1 parent f3ecd00 commit 7d646b0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 23 deletions.
Expand Up @@ -15,12 +15,9 @@ class Foo extends function () {} {
};

if (true) {
var _temp;

console.log((_temp = super(), _this2 = this, _temp), foo());
console.log(super(), foo());
} else {
super();
_this2 = this;
console.log(foo());
}
}
Expand Down
3 changes: 2 additions & 1 deletion packages/babel-traverse/src/path/conversion.js
Expand Up @@ -461,7 +461,8 @@ function getThisBinding(thisEnvFn, inConstructor) {
if (supers.has(child.node)) return;
supers.add(child.node);

child.insertAfter(
child.replaceWithMultiple(
child.node,
t.assignmentExpression(
"=",
t.identifier(thisBinding),
Expand Down
22 changes: 4 additions & 18 deletions packages/babel-traverse/test/arrow-transform.js
Expand Up @@ -82,12 +82,8 @@ describe("arrow function conversion", () => {
() => this;
`,
`
var _supercall = (..._args) => {
var _temp;
return _temp = super(..._args), _this = this, _temp;
},
_this;
var _supercall = (..._args) => super(..._args),
_this;
(function () {
_supercall(345);
Expand Down Expand Up @@ -120,13 +116,8 @@ describe("arrow function conversion", () => {
_this;
});
super();
_this = this;
this;
() => {
var _temp;
return _temp = super(), _this = this, _temp;
}
() => super();
() => this;
`,
{ methodName: "constructor", extend: true },
Expand Down Expand Up @@ -154,13 +145,8 @@ describe("arrow function conversion", () => {
_this;
}).bind(_arrowCheckId);
super();
_this = this;
this;
() => {
var _temp;
return _temp = super(), _this = this, _temp;
}
() => super();
() => this;
`,
{
Expand Down

0 comments on commit 7d646b0

Please sign in to comment.