fix nested hoist_props substitution (#2523)

fixes #2519
This commit is contained in:
Alex Lam S.L
2017-11-28 14:39:00 +08:00
committed by GitHub
parent 32def5ebf5
commit 206a54a746
2 changed files with 33 additions and 1 deletions

View File

@@ -633,3 +633,34 @@ issue_2508_5: {
}
expect_stdout: true
}
issue_2519: {
options = {
collapse_vars: true,
evaluate: true,
hoist_props: true,
reduce_vars: true,
unused: true,
}
input: {
function testFunc() {
var dimensions = {
minX: 5,
maxX: 6,
};
var scale = 1;
var d = {
x: (dimensions.maxX + dimensions.minX) / 2,
};
return d.x * scale;
}
console.log(testFunc());
}
expect: {
function testFunc() {
return 1 * ((6 + 5) / 2);
}
console.log(testFunc());
}
expect_stdout: "5.5"
}