parent
fe647b083e
commit
f2b9c11e2a
|
|
@ -838,7 +838,9 @@ merge(Compressor.prototype, {
|
||||||
var sym;
|
var sym;
|
||||||
if (node instanceof AST_Call
|
if (node instanceof AST_Call
|
||||||
|| node instanceof AST_Exit
|
|| node instanceof AST_Exit
|
||||||
|| node instanceof AST_PropAccess && node.has_side_effects(compressor)
|
|| node instanceof AST_PropAccess
|
||||||
|
&& (node.has_side_effects(compressor)
|
||||||
|
|| get_symbol(node).name in lvalues)
|
||||||
|| node instanceof AST_SymbolRef
|
|| node instanceof AST_SymbolRef
|
||||||
&& (lvalues[node.name]
|
&& (lvalues[node.name]
|
||||||
|| side_effects && !references_in_scope(node.definition()))
|
|| side_effects && !references_in_scope(node.definition()))
|
||||||
|
|
|
||||||
|
|
@ -2601,7 +2601,7 @@ prop_side_effects_2: {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
issue_2364: {
|
issue_2365: {
|
||||||
options = {
|
options = {
|
||||||
collapse_vars: true,
|
collapse_vars: true,
|
||||||
pure_getters: true,
|
pure_getters: true,
|
||||||
|
|
@ -2652,3 +2652,62 @@ issue_2364: {
|
||||||
"1",
|
"1",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_2364_1: {
|
||||||
|
options = {
|
||||||
|
collapse_vars: true,
|
||||||
|
pure_getters: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
function inc(obj) {
|
||||||
|
return obj.count++;
|
||||||
|
}
|
||||||
|
function foo() {
|
||||||
|
var first = arguments[0];
|
||||||
|
var result = inc(first);
|
||||||
|
return foo.amount = first.count, result;
|
||||||
|
}
|
||||||
|
var data = {
|
||||||
|
count: 0,
|
||||||
|
};
|
||||||
|
var answer = foo(data);
|
||||||
|
console.log(foo.amount, answer);
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
function inc(obj) {
|
||||||
|
return obj.count++;
|
||||||
|
}
|
||||||
|
function foo() {
|
||||||
|
var first = arguments[0];
|
||||||
|
var result = inc(first);
|
||||||
|
return foo.amount = first.count, result;
|
||||||
|
}
|
||||||
|
var data = {
|
||||||
|
count: 0
|
||||||
|
};
|
||||||
|
var answer = foo(data);
|
||||||
|
console.log(foo.amount, answer);
|
||||||
|
}
|
||||||
|
expect_stdout: "1 0"
|
||||||
|
}
|
||||||
|
|
||||||
|
issue_2364_2: {
|
||||||
|
options = {
|
||||||
|
collapse_vars: true,
|
||||||
|
pure_getters: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
function callValidate() {
|
||||||
|
var validate = compilation.validate;
|
||||||
|
var result = validate.apply(null, arguments);
|
||||||
|
return callValidate.errors = validate.errors, result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
function callValidate() {
|
||||||
|
var validate = compilation.validate;
|
||||||
|
var result = validate.apply(null, arguments);
|
||||||
|
return callValidate.errors = validate.errors, result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user