Referencing a global is assumed to have side effects.

Close #550
This commit is contained in:
Mihai Bazon
2014-09-28 11:16:51 +03:00
parent f0c1a01bc2
commit 01d19b4b52
3 changed files with 30 additions and 1 deletions

View File

@@ -239,6 +239,7 @@ cond_7: {
evaluate : true
};
input: {
var x, y, z, a, b;
// compress these
if (y) {
x = 1+1;
@@ -281,6 +282,7 @@ cond_7: {
x = y ? 'foo' : 'fo';
}
expect: {
var x, y, z, a, b;
x = 2;
x = 2;
x = 'foo';
@@ -293,3 +295,20 @@ cond_7: {
}
}
cond_7_1: {
options = {
conditionals: true,
evaluate : true
};
input: {
// access to global should be assumed to have side effects
if (y) {
x = 1+1;
} else {
x = 2;
}
}
expect: {
x = (y, 2);
}
}