diff --git a/packages/babel-plugin-transform-async-to-generator/test/fixtures/regression/7178/input.js b/packages/babel-plugin-transform-async-to-generator/test/fixtures/regression/7178/input.js new file mode 100644 index 0000000000..4573dd249a --- /dev/null +++ b/packages/babel-plugin-transform-async-to-generator/test/fixtures/regression/7178/input.js @@ -0,0 +1,5 @@ +const title = "Neem contact op"; + +async function action() { + return ; +} diff --git a/packages/babel-plugin-transform-async-to-generator/test/fixtures/regression/7178/options.json b/packages/babel-plugin-transform-async-to-generator/test/fixtures/regression/7178/options.json new file mode 100644 index 0000000000..e1385e0394 --- /dev/null +++ b/packages/babel-plugin-transform-async-to-generator/test/fixtures/regression/7178/options.json @@ -0,0 +1,8 @@ +{ + "plugins": [ + "external-helpers", + "transform-async-to-generator", + "transform-react-jsx", + "transform-react-constant-elements" + ] +} diff --git a/packages/babel-plugin-transform-async-to-generator/test/fixtures/regression/7178/output.js b/packages/babel-plugin-transform-async-to-generator/test/fixtures/regression/7178/output.js new file mode 100644 index 0000000000..509f1f64c9 --- /dev/null +++ b/packages/babel-plugin-transform-async-to-generator/test/fixtures/regression/7178/output.js @@ -0,0 +1,16 @@ +const title = "Neem contact op"; + +function action() { + return _action.apply(this, arguments); +} + +var _ref = React.createElement(Contact, { + title: title +}); + +function _action() { + _action = babelHelpers.asyncToGenerator(function* () { + return _ref; + }); + return _action.apply(this, arguments); +} diff --git a/packages/babel-traverse/src/path/modification.js b/packages/babel-traverse/src/path/modification.js index 77cb382160..19b28c7197 100644 --- a/packages/babel-traverse/src/path/modification.js +++ b/packages/babel-traverse/src/path/modification.js @@ -56,7 +56,7 @@ export function _containerInsert(from, nodes) { this.container.splice(from, 0, ...nodes); for (let i = 0; i < nodes.length; i++) { const to = from + i; - const path = this.getSibling(`${to}`); + const path = this.getSibling(to); paths.push(path); if (this.context && this.context.queue) {