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 2040f9c
Browse filesBrowse the repository at this point in the historyBrowse files
* @typedef {object} CollapseHooks what later phases add to `collapse_vars`
21074
+
* @property {((node: Node, compressor: CompressorShape) => boolean) | null} readsBuiltIn whether a node only reads a built-in global or one of its members, which no value moved past it can change
21075
+
* @property {boolean} finalPass whether the pass running is the last one asked for
21076
+
*/
21077
+
21045
21078
/**
21046
21079
* Creates terser's `tighten_body`, which joins, reorders and drops the
21047
21080
* statements of a block and folds assignments into their first use.
Copy file name to clipboardExpand all lines: test/unitCases/syntax-printer.unittest.js
+6-1Lines changed: 6 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -522,6 +522,10 @@ const IMPROVED_CASES = [
522
522
"an array of strings split beside long arrays holding a number or a hole, left alone",
523
523
`var a = ${stringArray(100)}, b = ${stringArray(100).slice(0,-1)}, 1], c = ${stringArray(100).slice(0,-1)}, , "z"]; console.log(a.length, typeof b[100], 100 in c, c.length);`
524
524
],
525
+
[
526
+
"a value moved past a read of `console`, a built-in or one of its methods",
527
+
"function f(x) { var r = x + 1, a = r * r - r; console.log(a + 7); var v = g(); console.log(Math.max(v, 1)); var c; c = 2; console.log(c); } function g() { return 3; } f(1);"
528
+
],
525
529
[
526
530
"an array of empty strings",
527
531
`var a = ${stringArray(100,()=>"")}; console.log(a.length, a.every((s) => s === ""));`
["a value kept before a global no built-in names, a member a built-in computes, a shadowed built-in, or a built-in the value writes",'function f(Math) { var v = g(); h(v); var w = g(); console.log(RegExp.$1, w); var x = g(); console.log(Math.max(x)); } function k() { var o = console; var u = (console = { log: function () { o.log("new"); } }, 1); console.log(u); console = o; } var h = console.log; function g() { return 2; } f({ max: String }); k();'],
610
615
["a parameter given an argument",`!function (a) { ${TRY} console.log(a); }(Math.random());`],
611
616
["a parameter given nothing",`!function (a) { ${TRY} console.log(a, a = Math.random()); }();`],
["var g = function f() { \"use strict\"; try { f = f || 1; } catch (e) { return e.name; } return typeof f; }; console.log(g());",target(2021)],
5050
-
["x = x || 1; var x; console.log(x);",target(2021)],
5055
+
["x = x || 1; var x; print(x); function print(v) { console.log(v); }",target(2021)],
5051
5056
["console.log(function () { var other = {}, o = { get p() { o = other; return 0; }, set p(v) {} }, first = o; o.p || (o.p = 1); return [first === o, other.p]; }());",target(2021)],
0 commit comments