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 ad1d016
Browse filesBrowse the repository at this point in the historyBrowse files
* @typedef {object} CollapseHooks what later phases add to `collapse_vars`
23333
+
* @property {((node: Node, compressor: CompressorShape, movesEffects: boolean) => 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, given whether that value has effects
23334
+
* @property {boolean} finalPass whether the pass running is the last one asked for
23335
+
*/
23336
+
23298
23337
/**
23299
23338
* Creates terser's `tighten_body`, which joins, reorders and drops the
23300
23339
* statements of a block and folds assignments into their first use.
Copy file name to clipboardExpand all lines: test/unitCases/syntax-printer.unittest.js
+7-1Lines changed: 7 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -605,6 +605,10 @@ const IMPROVED_CASES = [
605
605
"an array of strings split beside long arrays holding a number or a hole, left alone",
606
606
`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);`
607
607
],
608
+
[
609
+
"a value moved past a read of `console`, a built-in or one of its methods",
610
+
"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);"
611
+
],
608
612
[
609
613
"an array of empty strings",
610
614
`var a = ${stringArray(100,()=>"")}; console.log(a.length, a.every((s) => s === ""));`
["a value with effects kept before a read of `console`, which it may patch",'var log = console.log; function g() { console.log = function (x) { log("patched", x); }; return 1; } function f() { var v = g(); console.log(v); console.log = log; } f(); f();'],
723
+
["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();'],
718
724
["a parameter given an argument",`!function (a) { ${TRY} console.log(a); }(Math.random());`],
719
725
["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)],
5700
-
["x = x || 1; var x; console.log(x);",target(2021)],
5706
+
["x = x || 1; var x; print(x); function print(v) { console.log(v); }",target(2021)],
5701
5707
["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