diff --git a/packages/babel-helper-remap-async-to-generator/src/index.js b/packages/babel-helper-remap-async-to-generator/src/index.js index d3650c066f..03c6eebeca 100644 --- a/packages/babel-helper-remap-async-to-generator/src/index.js +++ b/packages/babel-helper-remap-async-to-generator/src/index.js @@ -62,6 +62,12 @@ function plainFunction(path: NodePath, callId: Object) { node.async = false; node.generator = true; + // Either the wrapped generator is invoked with `.apply(this, arguments)` or it has no params, + // so it should capture `arguments` + if (node.shadow) { + // node.shadow may be `true` or an object + node.shadow = Object.assign({}, node.shadow, { arguments: false }); + } let asyncFnId = node.id; node.id = null;