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) {
|
if (node instanceof AST_VarDef) {
|
||||||
var d = node.name.definition();
|
var d = node.name.definition();
|
||||||
if (d.fixed == null) {
|
if (d.fixed == null) {
|
||||||
d.fixed = node.value && function() {
|
if (node.value) {
|
||||||
return node.value;
|
d.fixed = function() {
|
||||||
};
|
return node.value;
|
||||||
|
};
|
||||||
|
descend();
|
||||||
|
} else {
|
||||||
|
d.fixed = null;
|
||||||
|
}
|
||||||
mark_as_safe(d);
|
mark_as_safe(d);
|
||||||
|
return true;
|
||||||
} else if (node.value) {
|
} else if (node.value) {
|
||||||
d.fixed = false;
|
d.fixed = false;
|
||||||
}
|
}
|
||||||
|
|
@ -1167,6 +1173,9 @@ merge(Compressor.prototype, {
|
||||||
def(AST_UnaryPrefix, function() {
|
def(AST_UnaryPrefix, function() {
|
||||||
return this.operator == "void";
|
return this.operator == "void";
|
||||||
});
|
});
|
||||||
|
def(AST_Seq, function(compressor) {
|
||||||
|
return this.cdr.may_eq_null(compressor);
|
||||||
|
});
|
||||||
def(AST_PropAccess, function(compressor) {
|
def(AST_PropAccess, function(compressor) {
|
||||||
return !compressor.option("unsafe");
|
return !compressor.option("unsafe");
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1916,3 +1916,25 @@ side_effects_assign: {
|
||||||
}
|
}
|
||||||
expect_stdout: "undefined"
|
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