@@ -681,7 +681,8 @@ merge(Compressor.prototype, {
|
|||||||
if (parent instanceof AST_Assign && parent.operator == "=" && node === parent.right
|
if (parent instanceof AST_Assign && parent.operator == "=" && node === parent.right
|
||||||
|| parent instanceof AST_Call && node !== parent.expression
|
|| parent instanceof AST_Call && node !== parent.expression
|
||||||
|| parent instanceof AST_Exit && node === parent.value && node.scope !== d.scope
|
|| parent instanceof AST_Exit && node === parent.value && node.scope !== d.scope
|
||||||
|| parent instanceof AST_VarDef && node === parent.value) {
|
|| parent instanceof AST_VarDef && node === parent.value
|
||||||
|
|| parent instanceof AST_Yield && node === parent.value && node.scope !== d.scope) {
|
||||||
d.escaped = true;
|
d.escaped = true;
|
||||||
return;
|
return;
|
||||||
} else if (parent instanceof AST_Array
|
} else if (parent instanceof AST_Array
|
||||||
|
|||||||
@@ -5148,3 +5148,42 @@ issue_2560_6: {
|
|||||||
}
|
}
|
||||||
expect_stdout: "PASS"
|
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"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user