Merge pull request #3162 from loganfsmyth/requeue-generators-6676

Requeue generators for re-traversal so we pick up regeneratorRuntime - fixes T6676
This commit is contained in:
Amjad Masad
2016-01-13 21:22:03 -08:00
3 changed files with 18 additions and 11 deletions

View File

@@ -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();
}
}
};