Closed bakkot closed 8 years ago
parseScript(`function *g() { 1+yield; }`, {earlyErrors:false});
fails with 'Unexpected token "yield"'. !yield and etc. in the generator body also fail, although 0, yield and [yield] do not.
!yield
0, yield
[yield]
Compare
parseScript(`function *g() { yield+1; }`, {earlyErrors:false});
which (correctly) succeeds.
Never mind; this is correct. yield needs to be parenthesized in these contexts.
yield
fails with 'Unexpected token "yield"'.
!yield
and etc. in the generator body also fail, although0, yield
and[yield]
do not.Compare
which (correctly) succeeds.