lezer-parser/javascript

`yield` expressions aren't parsed correctly when used with arrays or with `yield*`

Closed this issue · 2 comments

It looks like yield [valid_array] is parsed as MemberExpression, considering yield a variable in this context. yield* is generally parsed as BinaryExpression.

Indeed, the parser was exploring both the case where yield (or await) was a keyword, and the case where it acted as a variable. For yield [1] both were valid, and we needed dynamic precedence to make the outcome predictably choose the keyword rule. Attached patch does this (and adds yield* support).