-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't use args rest/spread to hoist super method calls (#9939)
* Don't use args rest/spread to hoist super method calls * Hoist this in hoisted super method calls * Make the code more readable Review by edoardocavazza
- Loading branch information
1 parent
c455d2a
commit 99035ca
Showing
7 changed files
with
129 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 4 additions & 3 deletions
7
...rm-async-to-generator/test/fixtures/async-to-generator/object-method-with-super/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
packages/babel-preset-env/test/fixtures/plugins-integration/issue-9935/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class MyClass extends BaseClass { | ||
async loadEntity() { | ||
this.website = await this.loadWebsite(); | ||
this.report.setCompany(this.website.company); | ||
super.loadEntity(); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
packages/babel-preset-env/test/fixtures/plugins-integration/issue-9935/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"presets": [ | ||
[ | ||
"env", | ||
{ | ||
"targets": [ | ||
"Chrome >= 60", | ||
"Safari >= 11", | ||
"iOS >= 10.3", | ||
"Firefox >= 55", | ||
"Edge >= 16" | ||
] | ||
} | ||
] | ||
] | ||
} |
19 changes: 19 additions & 0 deletions
19
packages/babel-preset-env/test/fixtures/plugins-integration/issue-9935/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } | ||
|
||
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } | ||
|
||
class MyClass extends BaseClass { | ||
loadEntity() { | ||
var _superprop_getLoadEntity = () => super.loadEntity, | ||
_this = this; | ||
|
||
return _asyncToGenerator(function* () { | ||
_this.website = yield _this.loadWebsite(); | ||
|
||
_this.report.setCompany(_this.website.company); | ||
|
||
_superprop_getLoadEntity().call(_this); | ||
})(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters