Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

babel-plugin-transform-spread add missing argument in build calls #13459

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/babel-plugin-transform-spread/src/index.js
Expand Up @@ -135,7 +135,7 @@ export default declare((api, options) => {
if (args.length === 1 && args[0].argument.name === "arguments") {
nodes = [args[0].argument];
} else {
nodes = build(args, scope);
nodes = build(args, scope, this);
}

const first = nodes.shift();
Expand Down Expand Up @@ -177,7 +177,7 @@ export default declare((api, options) => {
let args = node.arguments;
if (!hasSpread(args)) return;

const nodes = build(args, scope);
const nodes = build(args, scope, this);

const first = nodes.shift();

Expand Down
@@ -0,0 +1,2 @@
f(...[1, 2, 3]);
f(...[1, , 3]);
@@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": false
}
@@ -0,0 +1,2 @@
f.apply(void 0, [1, 2, 3]);
f.apply(void 0, babelHelpers.arrayWithoutHoles([1,, 3]));
@@ -1 +1,2 @@
f(...[1, 2, 3]);
f(...[1, , 3]);
@@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": true
}
@@ -1 +1,2 @@
f.apply(void 0, [1, 2, 3]);
f.apply(void 0, babelHelpers.arrayLikeToArray([1,, 3]));
@@ -0,0 +1,3 @@
new Numbers(...nums);
new Numbers(1, ...nums);
new Numbers(...[1, , 3]);
@@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": false
}
@@ -0,0 +1,3 @@
babelHelpers.construct(Numbers, babelHelpers.toConsumableArray(nums));
babelHelpers.construct(Numbers, [1].concat(babelHelpers.toConsumableArray(nums)));
babelHelpers.construct(Numbers, babelHelpers.arrayWithoutHoles([1,, 3]));
@@ -1,2 +1,3 @@
new Numbers(...nums);
new Numbers(1, ...nums);
new Numbers(...[1, , 3]);
@@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": true
}
@@ -1,2 +1,3 @@
babelHelpers.construct(Numbers, babelHelpers.toConsumableArray(nums));
babelHelpers.construct(Numbers, [1].concat(babelHelpers.toConsumableArray(nums)));
babelHelpers.construct(Numbers, babelHelpers.arrayLikeToArray([1,, 3]));