implement delayed resolution for reduce_vars (#1788)

Although it would be nice to enforce `AST_Node` cloning during transformation, that ship has sailed a long time ago.

We now get the assigned value when resolving `AST_SymbolRef` instead of `reset_opt_flags()`, which has the added advantage of improved compressor efficiency.

fixes #1787
This commit is contained in:
Alex Lam S.L
2017-04-05 21:06:42 +08:00
committed by GitHub
parent 9b6bc67c33
commit ff289b90a9
3 changed files with 53 additions and 23 deletions

View File

@@ -0,0 +1,19 @@
unary_prefix: {
options = {
evaluate: true,
reduce_vars: true,
unused: true,
}
input: {
console.log(function() {
var x = -(2 / 3);
return x;
}());
}
expect: {
console.log(function() {
return -2 / 3;
}());
}
expect_stdout: true
}