shapesecurity / shift-parser-js

ECMAScript parser that produces a Shift format AST
http://shift-ast.org/parser.html
Apache License 2.0
249 stars 28 forks source link

fixes #304: validate exponentiation expression LHSs #306

Closed michaelficarra closed 7 years ago

michaelficarra commented 7 years ago

Fixes #304.

We should open a PR to test262-parser-tests adding these tests.

bakkot commented 7 years ago

This rejects (-a) ** b, which should also be added as a test.

bakkot commented 7 years ago

Because () => a ** b parses as () => (a ** b), I'm pretty sure you can get away with storing the first token of the LHS, and only throwing if the first token was not (. But it's kind of a hack.

michaelficarra commented 7 years ago

Oh yeah. Whoops.

bakkot commented 7 years ago

Fixed and added test.