enable collapse_vars & reduce_vars by default

- fix corner cases in `const` optimisation
- deprecate `/*@const*/`

fixes #1497
closes #1498
This commit is contained in:
alexlamsl
2017-02-24 01:46:57 +08:00
parent 1e51586996
commit 4e49302916
8 changed files with 56 additions and 25 deletions

View File

@@ -648,3 +648,34 @@ drop_value: {
foo(), bar();
}
}
const_assign: {
options = {
evaluate: true,
reduce_vars: true,
unused: true,
}
input: {
function f() {
const b = 2;
return 1 + b;
}
function g() {
const b = 2;
b = 3;
return 1 + b;
}
}
expect: {
function f() {
return 3;
}
function g() {
const b = 2;
b = 3;
return 1 + b;
}
}
}