Avoid syntax error in yield assignments (fixes #1054)

This commit is contained in:
not-an-aardvark
2016-04-25 19:14:44 -04:00
parent 8571a08a93
commit 5b893c8ec3
2 changed files with 10 additions and 2 deletions

View File

@@ -1234,9 +1234,7 @@ function OutputStream(options) {
}
isYield = (self.right.operator == "yield" || self.right.operator === "yield*");
isYield && output.print("(");
output.print(op);
isYield && output.print(")");
if ((op == "<" || op == "<<")
&& self.right instanceof AST_UnaryPrefix

View File

@@ -434,3 +434,13 @@ generators_yield: {
}
expect_exact: "function*fn(){yield remote()}"
}
generators_yield_assign: {
input: {
function* fn() {
var x = {};
x.prop = yield 5;
}
}
expect_exact: "function*fn(){var x={};x.prop=yield 5}"
}