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

* babel-plugin-transform-spread add missing argument in build calls

* update tests for babel 8 test
This commit is contained in:
Bogdan Savluk 2021-06-14 17:33:19 +02:00 committed by GitHub
parent 950d3519e8
commit 66cbd6091e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 28 additions and 2 deletions

View File

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

View File

@ -0,0 +1,2 @@
f(...[1, 2, 3]);
f(...[1, , 3]);

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": false
}

View File

@ -0,0 +1,2 @@
f.apply(void 0, [1, 2, 3]);
f.apply(void 0, babelHelpers.arrayWithoutHoles([1,, 3]));

View File

@ -1 +1,2 @@
f(...[1, 2, 3]);
f(...[1, , 3]);

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": true
}

View File

@ -1 +1,2 @@
f.apply(void 0, [1, 2, 3]);
f.apply(void 0, babelHelpers.arrayLikeToArray([1,, 3]));

View File

@ -0,0 +1,3 @@
new Numbers(...nums);
new Numbers(1, ...nums);
new Numbers(...[1, , 3]);

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": false
}

View File

@ -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]));

View File

@ -1,2 +1,3 @@
new Numbers(...nums);
new Numbers(1, ...nums);
new Numbers(...[1, , 3]);

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": true
}

View File

@ -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]));