Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix integration with async-to-generator
- Loading branch information
1 parent
29b91df
commit 7a6455a
Showing
4 changed files
with
206 additions
and
158 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: 7 additions & 0 deletions
7
...oposal-explicit-resource-management/test/fixtures/integration/async-to-generator/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 @@ | ||
async function fn() { | ||
await 0; | ||
{ | ||
await using x = y; | ||
await 1; | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
...al-explicit-resource-management/test/fixtures/integration/async-to-generator/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,6 @@ | ||
{ | ||
"plugins": [ | ||
"proposal-explicit-resource-management", | ||
"transform-async-to-generator" | ||
] | ||
} |
19 changes: 19 additions & 0 deletions
19
...posal-explicit-resource-management/test/fixtures/integration/async-to-generator/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 fn() { | ||
return _fn.apply(this, arguments); | ||
} | ||
function _fn() { | ||
_fn = babelHelpers.asyncToGenerator(function* () { | ||
yield 0; | ||
try { | ||
var _stack = []; | ||
const x = babelHelpers.using(_stack, y, true); | ||
yield 1; | ||
} catch (_) { | ||
var _error = _; | ||
var _hasError = true; | ||
} finally { | ||
yield babelHelpers.dispose(_stack, _error, _hasError, typeof SuppressedError !== "undefined" && SuppressedError); | ||
} | ||
}); | ||
return _fn.apply(this, arguments); | ||
} |