Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Edge cases for async functions and
noNewArrow
assumption (#15181)
Fixes #15170
- Loading branch information
1 parent
4c59d9f
commit c78fc49
Showing
6 changed files
with
78 additions
and
12 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
3 changes: 3 additions & 0 deletions
3
packages/babel-preset-env/test/fixtures/plugins-integration/issue-15170/exec.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,3 @@ | ||
expect(() => { | ||
x = async x => 0 ; | ||
}).not.toThrow(); |
1 change: 1 addition & 0 deletions
1
packages/babel-preset-env/test/fixtures/plugins-integration/issue-15170/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 @@ | ||
x = async x => 0 ; |
4 changes: 4 additions & 0 deletions
4
packages/babel-preset-env/test/fixtures/plugins-integration/issue-15170/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,4 @@ | ||
{ | ||
"presets": ["env"], | ||
"assumptions": { "noNewArrows": false } | ||
} |
42 changes: 42 additions & 0 deletions
42
packages/babel-preset-env/test/fixtures/plugins-integration/issue-15170/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,42 @@ | ||
var _this = this; | ||
x = /*#__PURE__*/function () { | ||
var _ref = function (_x) { | ||
var _marked = /*#__PURE__*/babelHelpers.regeneratorRuntime().mark(x); | ||
function x(_x2) { | ||
var _args = arguments; | ||
return babelHelpers.regeneratorRuntime().wrap(function x$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
return _context.delegateYield(_x.apply(this, _args), "t0", 1); | ||
case 1: | ||
return _context.abrupt("return", _context.t0); | ||
case 2: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
} | ||
}, _marked, this); | ||
} | ||
x.toString = function () { | ||
return _x.toString(); | ||
}; | ||
return x; | ||
}( /*#__PURE__*/babelHelpers.regeneratorRuntime().mark(function _callee(x) { | ||
return babelHelpers.regeneratorRuntime().wrap(function _callee$(_context2) { | ||
while (1) { | ||
switch (_context2.prev = _context2.next) { | ||
case 0: | ||
babelHelpers.newArrowCheck(this, _this); | ||
return _context2.abrupt("return", 0); | ||
case 2: | ||
case "end": | ||
return _context2.stop(); | ||
} | ||
} | ||
}, _callee, this); | ||
})); | ||
return function (_x3) { | ||
return _ref.apply(this, arguments); | ||
}; | ||
}().bind(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