-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(es/minifier): Drop recursively used var declaration (#7649)
- Loading branch information
Showing
20 changed files
with
34 additions
and
64 deletions.
There are no files selected for viewing
9 changes: 1 addition & 8 deletions
9
crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers.2.minified.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,4 @@ | ||
//// [assignmentCompatWithObjectMembers.ts] | ||
var SimpleTypes, ObjectTypes; | ||
import "@swc/helpers/_/_class_call_check"; | ||
SimpleTypes || (SimpleTypes = {}), function(ObjectTypes) { | ||
var t2, b, a2 = { | ||
foo: a2 | ||
}, b2 = { | ||
foo: b2 | ||
}; | ||
b2 = a2 = b2, a2 = b, a2 = t2; | ||
}(ObjectTypes || (ObjectTypes = {})); | ||
SimpleTypes || (SimpleTypes = {}), ObjectTypes || (ObjectTypes = {}); |
6 changes: 2 additions & 4 deletions
6
crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment3.2.minified.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 3 additions & 5 deletions
8
...swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment1ES5.2.minified.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,11 @@ | ||
//// [destructuringObjectBindingPatternAndAssignment1ES5.ts] | ||
(void 0).a1; | ||
var tmp = {}; | ||
(void 0 === tmp ? { | ||
b21: "string" | ||
} : tmp).b21; | ||
var b52 = b52; | ||
function foo1() { | ||
return { | ||
prop1: 2 | ||
}; | ||
} | ||
foo1().prop1, foo1().prop2; | ||
(void 0 === tmp ? { | ||
b21: "string" | ||
} : tmp).b21, foo1().prop1, foo1().prop2; |
3 changes: 2 additions & 1 deletion
3
...es/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment4.2.minified.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
//// [destructuringObjectBindingPatternAndAssignment4.ts] | ||
var _ref = {}, _ref_f = (_ref.a, _ref.b, _ref.c, _ref.d, _ref.e, _ref.f), f = void 0 === _ref_f ? f : _ref_f; | ||
var _ref = {}; | ||
_ref.a, _ref.b, _ref.c, _ref.d, _ref.e, _ref.f; |
8 changes: 0 additions & 8 deletions
8
crates/swc/tests/tsc-references/objectLiteralShorthandProperties.2.minified.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1 @@ | ||
//// [objectLiteralShorthandProperties.ts] | ||
var x3 = { | ||
a: 0, | ||
b: void 0, | ||
c: void 0, | ||
d: function() {}, | ||
x3: x3, | ||
parent: x3 | ||
}; |
8 changes: 0 additions & 8 deletions
8
crates/swc/tests/tsc-references/objectLiteralShorthandPropertiesES6.2.minified.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1 @@ | ||
//// [objectLiteralShorthandPropertiesES6.ts] | ||
var x3 = { | ||
a: 0, | ||
b: void 0, | ||
c: void 0, | ||
d () {}, | ||
x3, | ||
parent: x3 | ||
}; |
2 changes: 1 addition & 1 deletion
2
crates/swc/tests/tsc-references/recursiveInitializer.2.minified.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
//// [recursiveInitializer.ts] | ||
var n1 = n1++, n2 = n2 + n2, n3 = n3 + n3, s1 = s1 + "", s2 = s2 + s2, s3 = s3 + s3, s4 = "" + s4, b1 = !b1, b2 = !!b2, b3 = !b3 || b3, b4 = !b4 && b4; | ||
var n1 = n1++; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
let a = () => a |
Empty file.
2 changes: 1 addition & 1 deletion
2
crates/swc_ecma_minifier/tests/full/size/37f0ab9950257024a9116d933f4ad3c72b88471e/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
[](function(){var n=function(){n[b]}}); | ||
[](function(){}); |
2 changes: 1 addition & 1 deletion
2
crates/swc_ecma_minifier/tests/full/size/3b335e237f275bec488d72f8934589b74346a0c1/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
[](function(){var n=function(){0(function(){return n})}}); | ||
[](function(){}); |
2 changes: 1 addition & 1 deletion
2
crates/swc_ecma_minifier/tests/full/size/3f1b1f240dbfc9585d82094d944515c068eac6dc/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
[](function(){var n=function(){b(function(){b(n)})}}); | ||
[](function(){}); |
2 changes: 1 addition & 1 deletion
2
crates/swc_ecma_minifier/tests/full/size/4dfc0f7ca994bdaddd4ac283d2bb75a232047f70/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
[](function(){var n=function(){n.b}}); | ||
[](function(){}); |
2 changes: 1 addition & 1 deletion
2
crates/swc_ecma_minifier/tests/full/size/b57e4ca6d118a9480312f6f3ac809245bbed8115/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
[](function(){var n;n=function(){b(n)}}); | ||
[](function(){}); |
2 changes: 1 addition & 1 deletion
2
crates/swc_ecma_minifier/tests/full/size/cb3806c635e59c15d84ee6c6cae3db9c9fce06cc/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
[](function(){var n=function(){b(n)}}); | ||
[](function(){}); |
14 changes: 2 additions & 12 deletions
14
..._ecma_minifier/tests/terser/compress/collapse_vars/collapse_vars_self_reference/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,2 @@ | ||
function f1() { | ||
var self = { | ||
inner: function() { | ||
return self; | ||
} | ||
}; | ||
} | ||
function f2() { | ||
var self = { | ||
inner: self | ||
}; | ||
} | ||
function f1() {} | ||
function f2() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters