You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f2b043e
Browse filesBrowse the repository at this point in the historyBrowse files
feat(minify): drop the values an unread function called in place returns
Where nothing reads the call, a pure `return` value goes before the body is tightened, so the call unwraps: not of an `async`, named or `arguments`-reading function, nor a value that may read a `let` in its dead zone. Behind `side_effects`. Retires swc `12301`.
Merge branches spelling a key with and without quotes, drop the values an unread function called in place returns, write computed `NaN` and `null` keys as names, and drop `new` before `RegExp` of a BigInt when minifying.
Copy file name to clipboardExpand all lines: test/helpers/swcSmaller.js
-1Lines changed: 0 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -66,7 +66,6 @@ const SWC_SMALLER_BY_REASON = [
66
66
[
67
67
"swc drops what nothing reads or what has no effect: unused variables and destructuring, side-effect-free `new Map()` and pure calls, an empty constructor",
Copy file name to clipboardExpand all lines: test/unitCases/javascript/__snapshots__/printer.unittest.js.snap
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -2007,6 +2007,8 @@ exports[`syntax-printer improve phase should write less, printing the same: stor
2007
2007
2008
2008
exports[`syntax-printer improve phase should write less, printing the same: tabs in a long string, written raw, beside an escaped backslash 1`] = `"console.log(\\"row row row row row row row row row row row row row row row row row row row row row row row row row row row row row row \\",\\"a\\\\\\\\tb b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b \\",\\"c\\\\td\\\\te\\");"`;
2009
2009
2010
+
exports[`syntax-printer improve phase should write less, printing the same: the values a function called in place returns, where nothing reads the call's value, in a \`finally\`, a branch, an arrow or a sequence 1`] = `"function g(v){return console.log(\\"g\\",v),v}var w=8;function t(y){!function(){try{throw 1}finally{return}}(),y||g(y),g(1)||g(2),g(3),y||g(y),y||g(4)}t(0),t(1);"`;
2011
+
2010
2012
exports[`syntax-printer improve phase should write less, printing the same: two \`var\`s declared bare and set once to one constructor, read through it inside functions called with \`new\` 1`] = `"!function(){var C=function(){this.v=1};console.log([function(){return(new C).v},function(){return(new C).v}].map(function(f){return f()}))}();"`;
2011
2013
2012
2014
exports[`syntax-printer improve phase should write less, printing the same: two calls in a sequence, one keeping a \`let\` in a block 1`] = `"{let o=console.log.name;console.log(o,o)}try{console.log(1)}catch(o){}console.log(2);"`;
0 commit comments