-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Description
// original code
// (beautified)
var _calls_ = 10, a = 100, b = 10, c = 0;
if (0 === 1 ? a : b) {
var expr2 = a++ + [ (c = c + 1) + +function() {
for (var brake3 = 5; a++ + a++ && brake3 > 0; --brake3) {}
}(), typeof f1 == "function" && --_calls_ >= 0 && f1((a++ + (("" ^ "c") + (c = c + 1,
"c"), 25 - this < ("b" && 24..toString())) || a || 3).toString()), ((yield, foo_2, ...a_2) => {
{
var brake5 = 5;
L11622: while ((c = c + 1) + (typeof f1 == "function" && --_calls_ >= 0 && f1(...[ foo_2, , a++ ], --b + 5)) && --brake5 > 0) {
var Infinity_2 = {
...a_2
};
}
}
})(a++ + a--), (c = c + 1) + (typeof a == "function" && --_calls_ >= 0 && a(3)), a && typeof a.foo == "function" && --_calls_ >= 0 && a.foo() ];
L11621: for (var key2 in expr2) {
c = 1 + c;
var arguments = expr2[key2];
L11623: for (var brake7 = 5; key2 && key2.in && brake7 > 0; --brake7) {
b--;
}
}
}
console.log(null, a, b, c, Infinity, NaN, undefined);// uglified code
// (beautified)
var _calls_ = 10, a = 100, b = 10, c = 0;
if (b) {
var key2, expr2 = a++ + [ (c += 1) + +function() {
for (var brake3 = 5; a++ + a++ && 0 < brake3; --brake3) {}
}(), "function" == typeof f1 && 0 <= --_calls_ && f1((a++ + (c += 1, 25 - this < 24..toString()) || a || 3).toString()), (() => {
for (var brake5 = 5; (c += 1) + ("function" == typeof f1 && 0 <= --_calls_ && f1(void 0, void 0, a++, 5 + --b)) && 0 < --brake5; ) {
({
...a_2
});
}
})((a++, a--)), (c += 1) + ("function" == typeof a && 0 <= --_calls_ && a(3)), a && "function" == typeof a.foo && 0 <= --_calls_ && a.foo() ];
for (key2 in expr2) {
for (var c = 1 + c, arguments = expr2[key2], brake7 = 5; key2 && key2.in && 0 < brake7; --brake7) {
b--;
}
}
}
console.log(null, a, b, c, 1 / 0, NaN, void 0);original result:
null 113 10 28 Infinity NaN undefined
uglified result:
evalmachine.<anonymous>:1
var _calls_=10,a=100,b=10,c=0;if(b){var key2,expr2=a+++[(c+=1)+ +function(){for(var brake3=5;a+++a++&&0<brake3;--brake3);}(),"function"==typeof f1&&0<=--_calls_&&f1((a+++(c+=1,25-this<24..toString())||a||3).toString()),(()=>{for(var brake5=5;(c+=1)+("function"==typeof f1&&0<=--_calls_&&f1(void 0,void 0,a++,5+--b))&&0<--brake5;)({...a_2})})((a++,a--)),(c+=1)+("function"==typeof a&&0<=--_calls_&&a(3)),a&&"function"==typeof a.foo&&0<=--_calls_&&a.foo()];for(key2 in expr2)for(var c=1+c,arguments=expr2[key2],brake7=5;key2&&key2.in&&0<brake7;--brake7)b--}console.log(null,a,b,c,1/0,NaN,void 0);
^
ReferenceError: a_2 is not defined
at evalmachine.<anonymous>:1:330
at evalmachine.<anonymous>:1:342
at Script.runInContext (vm.js:130:18)
at Object.runInContext (vm.js:293:6)
at run_code_vm (D:\a\UglifyJS\UglifyJS\test\sandbox.js:263:12)
at Object.exports.run_code (D:\a\UglifyJS\UglifyJS\test\sandbox.js:36:38)
at run_code (D:\a\UglifyJS\UglifyJS\test\ufuzz\index.js:2122:20)
at D:\a\UglifyJS\UglifyJS\test\ufuzz\index.js:2569:29
at Array.forEach (<anonymous>)
at Object.<anonymous> (D:\a\UglifyJS\UglifyJS\test\ufuzz\index.js:2556:20)
// reduced test case (output will differ)
// (beautified)
var a;
((...a_2) => {
var Infinity_2 = {
...a_2
};
})(a);
// output:
// minify: ReferenceError: a_2 is not defined
// options: {
// "mangle": false,
// "output": {
// "v8": true
// },
// "validate": true
// }minify(options):
{
"mangle": false,
"output": {
"v8": true
}
}
Suspicious compress options:
reduce_vars
rests
unused