@@ -710,20 +710,20 @@ merge(Compressor.prototype, {
|
|||||||
def(AST_VarDef, function(tw, descend) {
|
def(AST_VarDef, function(tw, descend) {
|
||||||
var node = this;
|
var node = this;
|
||||||
var d = node.name.definition();
|
var d = node.name.definition();
|
||||||
if (safe_to_assign(tw, d, node.value)) {
|
|
||||||
if (node.value) {
|
if (node.value) {
|
||||||
|
if (safe_to_assign(tw, d, node.value)) {
|
||||||
d.fixed = function() {
|
d.fixed = function() {
|
||||||
return node.value;
|
return node.value;
|
||||||
};
|
};
|
||||||
tw.loop_ids[d.id] = tw.in_loop;
|
tw.loop_ids[d.id] = tw.in_loop;
|
||||||
mark(tw, d, false);
|
mark(tw, d, false);
|
||||||
descend();
|
descend();
|
||||||
}
|
|
||||||
mark(tw, d, true);
|
mark(tw, d, true);
|
||||||
return true;
|
return true;
|
||||||
} else if (node.value) {
|
} else {
|
||||||
d.fixed = false;
|
d.fixed = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
def(AST_While, function(tw) {
|
def(AST_While, function(tw) {
|
||||||
var saved_loop = tw.in_loop;
|
var saved_loop = tw.in_loop;
|
||||||
|
|||||||
@@ -5507,3 +5507,29 @@ issue_2860_2: {
|
|||||||
}
|
}
|
||||||
expect_stdout: "1"
|
expect_stdout: "1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_2869: {
|
||||||
|
options = {
|
||||||
|
evaluate: true,
|
||||||
|
reduce_vars: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
var c = "FAIL";
|
||||||
|
(function f(a) {
|
||||||
|
var a;
|
||||||
|
if (!f) a = 0;
|
||||||
|
if (a) c = "PASS";
|
||||||
|
})(1);
|
||||||
|
console.log(c);
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
var c = "FAIL";
|
||||||
|
(function f(a) {
|
||||||
|
var a;
|
||||||
|
if (!f) a = 0;
|
||||||
|
if (a) c = "PASS";
|
||||||
|
})(1);
|
||||||
|
console.log(c);
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user