-
-
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.
fix(es/minifier): calc function body cost when inline function
- Loading branch information
Showing
66 changed files
with
1,234 additions
and
1,517 deletions.
There are no files selected for viewing
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,10 +1,5 @@ | ||
//// [ES5For-of10.ts] | ||
function foo() { | ||
return { | ||
x: 0 | ||
}; | ||
} | ||
for(var _i = 0, _iter = []; _i < _iter.length; _i++){ | ||
foo().x = _iter[_i]; | ||
for(var _i1 = 0, _iter1 = []; _i1 < _iter1.length; _i1++)foo().x = _iter1[_i1], foo().x; | ||
_iter[_i]; | ||
for(var _i1 = 0, _iter1 = []; _i1 < _iter1.length; _i1++)_iter1[_i1]; | ||
} |
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,6 @@ | ||
//// [ES5For-of34.ts] | ||
function foo() { | ||
return { | ||
x: 0 | ||
}; | ||
} | ||
for(var _i = 0, _iter = [ | ||
"a", | ||
"b", | ||
"c" | ||
]; _i < _iter.length; _i++)foo().x = _iter[_i], foo().x; | ||
]; _i < _iter.length; _i++)_iter[_i]; |
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,6 @@ | ||
//// [ES5For-of8.ts] | ||
function foo() { | ||
return { | ||
x: 0 | ||
}; | ||
} | ||
for(var _i = 0, _iter = [ | ||
"a", | ||
"b", | ||
"c" | ||
]; _i < _iter.length; _i++)foo().x = _iter[_i], foo().x; | ||
]; _i < _iter.length; _i++)_iter[_i]; |
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,10 +1,5 @@ | ||
//// [ES5For-of9.ts] | ||
function foo() { | ||
return { | ||
x: 0 | ||
}; | ||
} | ||
for(var _i = 0, _iter = []; _i < _iter.length; _i++){ | ||
foo().x = _iter[_i]; | ||
for(var _i1 = 0, _iter1 = []; _i1 < _iter1.length; _i1++)foo().x = _iter1[_i1], foo().x; | ||
_iter[_i]; | ||
for(var _i1 = 0, _iter1 = []; _i1 < _iter1.length; _i1++)_iter1[_i1]; | ||
} |
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
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
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
10 changes: 0 additions & 10 deletions
10
crates/swc/tests/tsc-references/genericCallWithFunctionTypedArguments.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 @@ | ||
//// [genericCallWithFunctionTypedArguments.ts] | ||
function foo(x) { | ||
return x(null); | ||
} | ||
foo(function(x) { | ||
return ""; | ||
}), foo(function(x) { | ||
return ""; | ||
}), foo(function(x) { | ||
return ""; | ||
}); |
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
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
7 changes: 2 additions & 5 deletions
7
crates/swc/tests/tsc-references/logicalAssignment10(target=es2015).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,8 +1,5 @@ | ||
//// [logicalAssignment10.ts] | ||
var _obj, _ref, _ref1, _ref2, ref, ref1, count = 0, obj = {}; | ||
function incr() { | ||
return ++count; | ||
} | ||
null !== (ref = (_obj = obj)[_ref = incr()]) && void 0 !== ref || (_obj[_ref] = incr()), null !== (ref1 = (_ref1 = ({ | ||
null !== (ref = (_obj = obj)[_ref = ++count]) && void 0 !== ref || (_obj[_ref] = ++count), null !== (ref1 = (_ref1 = ({ | ||
obj | ||
}).obj)[_ref2 = incr()]) && void 0 !== ref1 || (_ref1[_ref2] = incr()); | ||
}).obj)[_ref2 = ++count]) && void 0 !== ref1 || (_ref1[_ref2] = ++count); |
7 changes: 2 additions & 5 deletions
7
crates/swc/tests/tsc-references/logicalAssignment10(target=es2020).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,8 +1,5 @@ | ||
//// [logicalAssignment10.ts] | ||
var _obj, _ref, _ref1, _ref2, count = 0, obj = {}; | ||
function incr() { | ||
return ++count; | ||
} | ||
(_obj = obj)[_ref = incr()], _obj[_ref] = incr(), (_ref1 = ({ | ||
(_obj = obj)[_ref = ++count], _obj[_ref] = ++count, (_ref1 = ({ | ||
obj | ||
}).obj)[_ref2 = incr()], _ref1[_ref2] = incr(); | ||
}).obj)[_ref2 = ++count], _ref1[_ref2] = ++count; |
5 changes: 1 addition & 4 deletions
5
crates/swc/tests/tsc-references/logicalAssignment10(target=es2021).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,6 @@ | ||
//// [logicalAssignment10.ts] | ||
var count = 0, obj = {}; | ||
function incr() { | ||
return ++count; | ||
} | ||
const oobj = { | ||
obj | ||
}; | ||
obj[incr()] ??= incr(), oobj.obj[incr()] ??= incr(); | ||
obj[++count] ??= ++count, oobj.obj[++count] ??= ++count; |
5 changes: 1 addition & 4 deletions
5
crates/swc/tests/tsc-references/logicalAssignment10(target=es2022).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,6 @@ | ||
//// [logicalAssignment10.ts] | ||
var count = 0, obj = {}; | ||
function incr() { | ||
return ++count; | ||
} | ||
const oobj = { | ||
obj | ||
}; | ||
obj[incr()] ??= incr(), oobj.obj[incr()] ??= incr(); | ||
obj[++count] ??= ++count, oobj.obj[++count] ??= ++count; |
Oops, something went wrong.