fix escape analysis for AST_Yield

fixes #2565
This commit is contained in:
alexlamsl
2017-12-10 14:25:23 +08:00
parent 7fd4b66eaa
commit f778a0aa01
2 changed files with 41 additions and 1 deletions

View File

@@ -5148,3 +5148,42 @@ issue_2560_6: {
}
expect_stdout: "PASS"
}
escape_yield: {
options = {
reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
}
input: {
function main() {
var thing = gen.next().value;
if (thing !== (thing = gen.next().value))
console.log("FAIL");
else
console.log("PASS");
}
function foo() {}
function* baz(s) {
for (;;) yield foo;
}
var gen = baz();
main();
}
expect: {
function foo() {}
var gen = function*(s) {
for (;;) yield foo;
}();
(function() {
var thing = gen.next().value;
if (thing !== (thing = gen.next().value))
console.log("FAIL");
else
console.log("PASS");
})();
}
expect_stdout: "PASS"
node_version: ">=4"
}