From 79c84f2f9bcb74319a89c4da3328b9d9b1a68c65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Mon, 15 Jan 2018 08:08:42 +0100 Subject: [PATCH] Fixed _containerInsertAfter setting path key as stringified index (#7213) --- .../test/fixtures/regression/7178/input.js | 5 +++++ .../test/fixtures/regression/7178/options.json | 8 ++++++++ .../test/fixtures/regression/7178/output.js | 16 ++++++++++++++++ packages/babel-traverse/src/path/modification.js | 2 +- 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 packages/babel-plugin-transform-async-to-generator/test/fixtures/regression/7178/input.js create mode 100644 packages/babel-plugin-transform-async-to-generator/test/fixtures/regression/7178/options.json create mode 100644 packages/babel-plugin-transform-async-to-generator/test/fixtures/regression/7178/output.js 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) {