fix usage accounting within assignment
This commit is contained in:
parent
1d1a8575dd
commit
874beea90a
|
|
@ -283,10 +283,16 @@ merge(Compressor.prototype, {
|
|||
if (node instanceof AST_VarDef) {
|
||||
var d = node.name.definition();
|
||||
if (d.fixed == null) {
|
||||
d.fixed = node.value && function() {
|
||||
return node.value;
|
||||
};
|
||||
if (node.value) {
|
||||
d.fixed = function() {
|
||||
return node.value;
|
||||
};
|
||||
descend();
|
||||
} else {
|
||||
d.fixed = null;
|
||||
}
|
||||
mark_as_safe(d);
|
||||
return true;
|
||||
} else if (node.value) {
|
||||
d.fixed = false;
|
||||
}
|
||||
|
|
@ -1167,6 +1173,9 @@ merge(Compressor.prototype, {
|
|||
def(AST_UnaryPrefix, function() {
|
||||
return this.operator == "void";
|
||||
});
|
||||
def(AST_Seq, function(compressor) {
|
||||
return this.cdr.may_eq_null(compressor);
|
||||
});
|
||||
def(AST_PropAccess, function(compressor) {
|
||||
return !compressor.option("unsafe");
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1916,3 +1916,25 @@ side_effects_assign: {
|
|||
}
|
||||
expect_stdout: "undefined"
|
||||
}
|
||||
|
||||
pure_getters: {
|
||||
options = {
|
||||
pure_getters: true,
|
||||
reduce_vars: true,
|
||||
side_effects: true,
|
||||
toplevel: true,
|
||||
}
|
||||
input: {
|
||||
try {
|
||||
var a = (a.b, 2);
|
||||
} catch (e) {}
|
||||
console.log(a);
|
||||
}
|
||||
expect: {
|
||||
try {
|
||||
var a = (a.b, 2);
|
||||
} catch (e) {}
|
||||
console.log(a);
|
||||
}
|
||||
expect_stdout: "undefined"
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user