[ES6] output parens for yield when parented by AST_Dot or AST_Sub (#1419)

This commit is contained in:
kzc
2017-01-10 14:19:32 -05:00
committed by Richard van Velzen
parent b11c5151bc
commit abbeb266b5
2 changed files with 33 additions and 1 deletions

View File

@@ -163,4 +163,30 @@ empty_generator_as_parameter_without_side_effects: {
evaluate(GeneratorPrototype);
}
expect_exact: "var GeneratorPrototype=Object.getPrototypeOf(Object.getPrototypeOf(function*(){}()));evaluate(GeneratorPrototype);"
}
}
yield_dot: {
options = {
}
input: {
function* foo(){
yield x.foo;
(yield x).foo;
yield (yield obj.foo()).bar();
}
}
expect_exact: "function*foo(){yield x.foo;(yield x).foo;yield(yield obj.foo()).bar()}"
}
yield_sub: {
options = {
}
input: {
function* foo(){
yield x['foo'];
(yield x)['foo'];
yield (yield obj.foo())['bar']();
}
}
expect_exact: 'function*foo(){yield x["foo"];(yield x)["foo"];yield(yield obj.foo())["bar"]()}'
}