Skip to content

Commit 5305486

Browse files
authored
feat(es/minifier): Drop unused rest paramters (#10857)
1 parent fd8b799 commit 5305486

24 files changed

+86
-38
lines changed

.changeset/minifier-foo.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
swc_ecma_minifier: patch
3+
swc_core: patch
4+
---
5+
6+
init
Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
//// [destructuringParameterDeclaration3ES5.ts]
2-
var E, array = [
3-
1,
4-
2,
5-
3
6-
];
7-
!function(...a) {}([
8-
...array
9-
]), function(...x) {}(...array), function([a, b, [[c]]]) {}([
2+
!function([a, b, [[c]]]) {}([
103
1,
114
2,
125
[
@@ -20,4 +13,4 @@ var E, array = [
2013
1,
2114
2
2215
]);
23-
var E1 = ((E = E1 || {})[E.a = 0] = "a", E[E.b = 1] = "b", E);
16+
var E, E1 = ((E = E1 || {})[E.a = 0] = "a", E[E.b = 1] = "b", E);
Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
//// [destructuringParameterDeclaration3ES6.ts]
2-
var E, array = [
3-
1,
4-
2,
5-
3
6-
];
7-
!function(...a) {}([
8-
...array
9-
]), function(...x) {}(...array), function([a, b, [[c]]]) {}([
2+
!function([a, b, [[c]]]) {}([
103
1,
114
2,
125
[
@@ -20,4 +13,4 @@ var E, array = [
2013
1,
2114
2
2215
]);
23-
var E1 = ((E = E1 || {})[E.a = 0] = "a", E[E.b = 1] = "b", E);
16+
var E, E1 = ((E = E1 || {})[E.a = 0] = "a", E[E.b = 1] = "b", E);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
//// [emitDefaultParametersFunctionExpressionES6.ts]
2-
!function(num, boo = !1, ...rest) {}(0);
2+
!function(num, boo = !1) {}(0);
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
//// [emitRestParametersFunctionExpressionES6.ts]
2-
!function(...rest) {}();

crates/swc/tests/tsc-references/iteratorSpreadInCall3.2.minified.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ class SymbolIterator {
1010
return this;
1111
}
1212
}
13-
!function(...s) {}(...new SymbolIterator);
13+
new SymbolIterator;

crates/swc/tests/tsc-references/iteratorSpreadInCall4.2.minified.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ class SymbolIterator {
1010
return this;
1111
}
1212
}
13-
!function(s1, ...s) {}(...new SymbolIterator);
13+
new SymbolIterator;

crates/swc/tests/tsc-references/iteratorSpreadInCall5.2.minified.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ class _StringIterator {
2121
return this;
2222
}
2323
}
24-
!function(...s) {}(...new SymbolIterator, ...new _StringIterator);
24+
new SymbolIterator, new _StringIterator;

crates/swc/tests/tsc-references/iteratorSpreadInCall6.2.minified.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ class _StringIterator {
2121
return this;
2222
}
2323
}
24-
!function(...s) {}(...new SymbolIterator, ...new _StringIterator);
24+
new SymbolIterator, new _StringIterator;

crates/swc/tests/tsc-references/jsDeclarationsGetterSetter.2.minified.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Object.defineProperty(F.prototype, "x", {
3232
export class G {
3333
}
3434
Object.defineProperty(G.prototype, "x", {
35-
set (...args) {}
35+
set () {}
3636
});
3737
export class H {
3838
}

0 commit comments

Comments
 (0)