Only slice arguments when necessary - fixes #239
This commit is contained in:
9
test/fixtures/transformation/es6-spread/arguments-array/actual.js
vendored
Normal file
9
test/fixtures/transformation/es6-spread/arguments-array/actual.js
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
function foo() {
|
||||
return bar([...arguments]);
|
||||
}
|
||||
|
||||
function bar(one, two, three) {
|
||||
return [one, two, three];
|
||||
}
|
||||
|
||||
foo("foo", "bar");
|
||||
12
test/fixtures/transformation/es6-spread/arguments-array/expected.js
vendored
Normal file
12
test/fixtures/transformation/es6-spread/arguments-array/expected.js
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
|
||||
var _slice = Array.prototype.slice;
|
||||
function foo() {
|
||||
return bar([].concat(_slice.call(arguments)));
|
||||
}
|
||||
|
||||
function bar(one, two, three) {
|
||||
return [one, two, three];
|
||||
}
|
||||
|
||||
foo("foo", "bar");
|
||||
9
test/fixtures/transformation/es6-spread/arguments-concat/actual.js
vendored
Normal file
9
test/fixtures/transformation/es6-spread/arguments-concat/actual.js
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
function foo() {
|
||||
return bar("test", ...arguments);
|
||||
}
|
||||
|
||||
function bar(one, two, three) {
|
||||
return [one, two, three];
|
||||
}
|
||||
|
||||
foo("foo", "bar");
|
||||
12
test/fixtures/transformation/es6-spread/arguments-concat/expected.js
vendored
Normal file
12
test/fixtures/transformation/es6-spread/arguments-concat/expected.js
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
|
||||
var _slice = Array.prototype.slice;
|
||||
function foo() {
|
||||
return bar.apply(null, ["test"].concat(_slice.call(arguments)));
|
||||
}
|
||||
|
||||
function bar(one, two, three) {
|
||||
return [one, two, three];
|
||||
}
|
||||
|
||||
foo("foo", "bar");
|
||||
@@ -1,5 +1,5 @@
|
||||
function foo() {
|
||||
return bar("test", ...arguments);
|
||||
return bar(...arguments);
|
||||
}
|
||||
|
||||
function bar(one, two, three) {
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var _slice = Array.prototype.slice;
|
||||
function foo() {
|
||||
return bar.apply(null, ["test"].concat(_slice.call(arguments)));
|
||||
return bar.apply(null, arguments);
|
||||
}
|
||||
|
||||
function bar(one, two, three) {
|
||||
|
||||
Reference in New Issue
Block a user