@@ -1793,7 +1793,7 @@ merge(Compressor.prototype, {
|
|||||||
return make_node(AST_Assign, candidate, {
|
return make_node(AST_Assign, candidate, {
|
||||||
operator: "=",
|
operator: "=",
|
||||||
left: make_node(AST_SymbolRef, candidate.name, candidate.name),
|
left: make_node(AST_SymbolRef, candidate.name, candidate.name),
|
||||||
right: candidate.value
|
right: candidate.value,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
var assign = candidate;
|
var assign = candidate;
|
||||||
@@ -8433,6 +8433,7 @@ merge(Compressor.prototype, {
|
|||||||
if (value) {
|
if (value) {
|
||||||
if (value instanceof AST_Sequence) value = value.clone();
|
if (value instanceof AST_Sequence) value = value.clone();
|
||||||
var name = make_node(AST_SymbolRef, defn.name, defn.name);
|
var name = make_node(AST_SymbolRef, defn.name, defn.name);
|
||||||
|
name.fixed = value;
|
||||||
a.push(make_node(AST_Assign, defn, {
|
a.push(make_node(AST_Assign, defn, {
|
||||||
operator: "=",
|
operator: "=",
|
||||||
left: name,
|
left: name,
|
||||||
|
|||||||
@@ -295,3 +295,81 @@ issue_4859: {
|
|||||||
}
|
}
|
||||||
expect_stdout: "Infinity"
|
expect_stdout: "Infinity"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_4893_1: {
|
||||||
|
options = {
|
||||||
|
collapse_vars: true,
|
||||||
|
evaluate: true,
|
||||||
|
hoist_vars: true,
|
||||||
|
reduce_vars: true,
|
||||||
|
toplevel: true,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
function f() {
|
||||||
|
function g() {}
|
||||||
|
var a = null;
|
||||||
|
var b = null;
|
||||||
|
var c = null;
|
||||||
|
b.p += a = 42;
|
||||||
|
f;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
f();
|
||||||
|
} catch (e) {
|
||||||
|
console.log("PASS");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
try{
|
||||||
|
(function f() {
|
||||||
|
var b;
|
||||||
|
b = null;
|
||||||
|
b.p += 42;
|
||||||
|
f;
|
||||||
|
})();
|
||||||
|
} catch (e) {
|
||||||
|
console.log("PASS");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
}
|
||||||
|
|
||||||
|
issue_4893_2: {
|
||||||
|
options = {
|
||||||
|
collapse_vars: true,
|
||||||
|
hoist_vars: true,
|
||||||
|
pure_getters: "strict",
|
||||||
|
reduce_vars: true,
|
||||||
|
side_effects: true,
|
||||||
|
toplevel: true,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
function f() {
|
||||||
|
function g() {}
|
||||||
|
var a = null;
|
||||||
|
var b = null;
|
||||||
|
var c = null;
|
||||||
|
b.p += a = 42;
|
||||||
|
f;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
f();
|
||||||
|
} catch (e) {
|
||||||
|
console.log("PASS");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
try{
|
||||||
|
(function() {
|
||||||
|
var b;
|
||||||
|
b = null;
|
||||||
|
b.p += 42;
|
||||||
|
})();
|
||||||
|
} catch (e) {
|
||||||
|
console.log("PASS");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
}
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ conditional: {
|
|||||||
relational: {
|
relational: {
|
||||||
options = {
|
options = {
|
||||||
pure_funcs: [ "foo" ],
|
pure_funcs: [ "foo" ],
|
||||||
side_effects :true,
|
side_effects: true,
|
||||||
}
|
}
|
||||||
input: {
|
input: {
|
||||||
foo() in new foo();
|
foo() in new foo();
|
||||||
@@ -158,7 +158,7 @@ relational: {
|
|||||||
arithmetic: {
|
arithmetic: {
|
||||||
options = {
|
options = {
|
||||||
pure_funcs: [ "foo" ],
|
pure_funcs: [ "foo" ],
|
||||||
side_effects :true,
|
side_effects: true,
|
||||||
}
|
}
|
||||||
input: {
|
input: {
|
||||||
foo() + foo();
|
foo() + foo();
|
||||||
@@ -183,7 +183,7 @@ arithmetic: {
|
|||||||
boolean_and: {
|
boolean_and: {
|
||||||
options = {
|
options = {
|
||||||
pure_funcs: [ "foo" ],
|
pure_funcs: [ "foo" ],
|
||||||
side_effects :true,
|
side_effects: true,
|
||||||
}
|
}
|
||||||
input: {
|
input: {
|
||||||
foo() && foo();
|
foo() && foo();
|
||||||
@@ -208,7 +208,7 @@ boolean_and: {
|
|||||||
boolean_or: {
|
boolean_or: {
|
||||||
options = {
|
options = {
|
||||||
pure_funcs: [ "foo" ],
|
pure_funcs: [ "foo" ],
|
||||||
side_effects :true,
|
side_effects: true,
|
||||||
}
|
}
|
||||||
input: {
|
input: {
|
||||||
foo() || foo();
|
foo() || foo();
|
||||||
@@ -233,7 +233,7 @@ boolean_or: {
|
|||||||
assign: {
|
assign: {
|
||||||
options = {
|
options = {
|
||||||
pure_funcs: [ "foo" ],
|
pure_funcs: [ "foo" ],
|
||||||
side_effects :true,
|
side_effects: true,
|
||||||
}
|
}
|
||||||
input: {
|
input: {
|
||||||
var a;
|
var a;
|
||||||
@@ -256,7 +256,7 @@ assign: {
|
|||||||
unary: {
|
unary: {
|
||||||
options = {
|
options = {
|
||||||
pure_funcs: [ "foo" ],
|
pure_funcs: [ "foo" ],
|
||||||
side_effects :true,
|
side_effects: true,
|
||||||
}
|
}
|
||||||
input: {
|
input: {
|
||||||
typeof foo();
|
typeof foo();
|
||||||
|
|||||||
@@ -343,7 +343,7 @@ issue_4676: {
|
|||||||
reduce_vars: true,
|
reduce_vars: true,
|
||||||
templates: true,
|
templates: true,
|
||||||
toplevel: true,
|
toplevel: true,
|
||||||
unsafe:true,
|
unsafe: true,
|
||||||
unused: true,
|
unused: true,
|
||||||
}
|
}
|
||||||
input: {
|
input: {
|
||||||
|
|||||||
Reference in New Issue
Block a user