@@ -9469,16 +9469,12 @@ Compressor.prototype.compress = function(node) {
|
||||
if (self.bfinally) {
|
||||
body.push(make_node(AST_BlockStatement, self.bfinally, self.bfinally).optimize(compressor));
|
||||
}
|
||||
return make_node(AST_BlockStatement, self, {
|
||||
body: body
|
||||
}).optimize(compressor);
|
||||
return make_node(AST_BlockStatement, self, { body: body }).optimize(compressor);
|
||||
}
|
||||
if (self.bfinally && has_declarations_only(self.bfinally)) {
|
||||
var body = make_node(AST_BlockStatement, self.bfinally, self.bfinally).optimize(compressor);
|
||||
body = self.body.concat(body);
|
||||
if (!self.bcatch) return make_node(AST_BlockStatement, self, {
|
||||
body: body
|
||||
}).optimize(compressor);
|
||||
if (!self.bcatch) return make_node(AST_BlockStatement, self, { body: body }).optimize(compressor);
|
||||
self.body = body;
|
||||
self.bfinally = null;
|
||||
}
|
||||
@@ -13174,6 +13170,7 @@ Compressor.prototype.compress = function(node) {
|
||||
if (fn.contains_this()) return;
|
||||
if (!scope) scope = find_scope(compressor);
|
||||
var defined = new Dictionary();
|
||||
defined.set("NaN", true);
|
||||
while (!(scope instanceof AST_Scope)) {
|
||||
scope.variables.each(function(def) {
|
||||
defined.set(def.name, true);
|
||||
@@ -13263,13 +13260,6 @@ Compressor.prototype.compress = function(node) {
|
||||
if (sym instanceof AST_SymbolCatch) return;
|
||||
body.push(make_node(AST_SimpleStatement, sym, { body: init_ref(compressor, flatten_var(sym)) }));
|
||||
});
|
||||
if (fn.variables.has("NaN")) scope.transform(new TreeTransformer(function(node) {
|
||||
if (node instanceof AST_NaN) return make_node(AST_Binary, node, {
|
||||
operator: "/",
|
||||
left: make_node(AST_Number, node, { value: 0 }),
|
||||
right: make_node(AST_Number, node, { value: 0 }),
|
||||
});
|
||||
}));
|
||||
var defs = Object.create(null), syms = new Dictionary();
|
||||
if (simple_argnames && all(call.args, function(arg) {
|
||||
return !(arg instanceof AST_Spread);
|
||||
|
||||
@@ -927,3 +927,78 @@ issue_5251: {
|
||||
expect_stdout: true
|
||||
node_version: ">=4"
|
||||
}
|
||||
|
||||
issue_5342_1: {
|
||||
options = {
|
||||
dead_code: true,
|
||||
inline: true,
|
||||
toplevel: true,
|
||||
unused: true,
|
||||
}
|
||||
input: {
|
||||
for (var a in 0) {
|
||||
(() => {
|
||||
while (1);
|
||||
})(new function(NaN) {
|
||||
a.p;
|
||||
}());
|
||||
}
|
||||
console.log(function() {
|
||||
return b;
|
||||
try {
|
||||
b;
|
||||
} catch (e) {
|
||||
var b;
|
||||
}
|
||||
}());
|
||||
}
|
||||
expect: {
|
||||
for (var a in 0) {
|
||||
(function(NaN) {
|
||||
a.p;
|
||||
})();
|
||||
while (1);
|
||||
}
|
||||
console.log(b);
|
||||
var b;
|
||||
}
|
||||
expect_stdout: "undefined"
|
||||
node_version: ">=4"
|
||||
}
|
||||
|
||||
issue_5342_2: {
|
||||
rename = true
|
||||
options = {
|
||||
dead_code: true,
|
||||
inline: true,
|
||||
toplevel: true,
|
||||
unused: true,
|
||||
}
|
||||
input: {
|
||||
for (var a in 0) {
|
||||
(() => {
|
||||
while (1);
|
||||
})(new function(NaN) {
|
||||
a.p;
|
||||
}());
|
||||
}
|
||||
console.log(function() {
|
||||
return b;
|
||||
try {
|
||||
b;
|
||||
} catch (e) {
|
||||
var b;
|
||||
}
|
||||
}());
|
||||
}
|
||||
expect: {
|
||||
for (var a in 0) {
|
||||
a.p;
|
||||
while (1);
|
||||
}
|
||||
console.log(c);
|
||||
var c;
|
||||
}
|
||||
expect_stdout: "undefined"
|
||||
node_version: ">=4"
|
||||
}
|
||||
|
||||
@@ -1713,16 +1713,14 @@ issue_2620_5: {
|
||||
}
|
||||
expect: {
|
||||
var c = "FAIL";
|
||||
(function() {
|
||||
var a = 0/0;
|
||||
var NaN = void 0;
|
||||
!function(a, NaN) {
|
||||
switch (a) {
|
||||
case a:
|
||||
break;
|
||||
case c = "PASS", NaN:
|
||||
break;
|
||||
}
|
||||
})();
|
||||
}(NaN);
|
||||
console.log(c);
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
@@ -7635,9 +7633,10 @@ issue_5237: {
|
||||
}
|
||||
expect: {
|
||||
function f() {
|
||||
while (console.log(0/0));
|
||||
var NaN = console && console.log(NaN);
|
||||
return;
|
||||
while (console.log(NaN));
|
||||
(function() {
|
||||
var NaN = console && console.log(NaN);
|
||||
})();
|
||||
}
|
||||
f();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user