Requeue generators for re-traversal so we pick up regeneratorRuntime - fixes T6676
This commit is contained in:
parent
9c88b8797e
commit
ee6f470d77
@ -129,6 +129,11 @@ exports.visitor = {
|
||||
if (wasGeneratorFunction && t.isExpression(node)) {
|
||||
path.replaceWith(t.callExpression(util.runtimeProperty("mark"), [node]));
|
||||
}
|
||||
|
||||
// Generators are processed in 'exit' handlers so that regenerator only has to run on
|
||||
// an ES5 AST, but that means traversal will not pick up newly inserted references
|
||||
// to things like 'regeneratorRuntime'. To avoid this, we explicitly re-queue.
|
||||
path.requeue();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -10,7 +10,8 @@ var _marked = [_callee].map(regeneratorRuntime.mark);
|
||||
function _callee() {
|
||||
var x;
|
||||
return regeneratorRuntime.wrap(function _callee$(_context) {
|
||||
while (1) switch (_context.prev = _context.next) {
|
||||
while (1) {
|
||||
switch (_context.prev = _context.next) {
|
||||
case 0:
|
||||
_context.next = 2;
|
||||
return 5;
|
||||
@ -23,5 +24,6 @@ function _callee() {
|
||||
case "end":
|
||||
return _context.stop();
|
||||
}
|
||||
}
|
||||
}, _marked[0], this);
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@ import foo, * as bar from "someModule";
|
||||
|
||||
export const myWord = _Symbol("abc");
|
||||
export function giveWord() {
|
||||
return regeneratorRuntime.wrap(function giveWord$(_context) {
|
||||
return _regeneratorRuntime.wrap(function giveWord$(_context) {
|
||||
while (1) switch (_context.prev = _context.next) {
|
||||
case 0:
|
||||
_context.next = 2;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user