johnson icon indicating copy to clipboard operation
johnson copied to clipboard

Parser won't parse typeof against expressions

Open caseyhoward opened this issue 15 years ago • 1 comments

To reproduce:

> Johnson::Parser.parse("x = {}; typeof x.blah;")
Unknown tok_unaryop type: jsop_typeofexpr

Putting parenthesis around x.blah doesn't work either.

This works fine: > Johnson::Parser.parse("x = {}; typeof x;")

"typeof x.blah" is legitimate and evaluates 'undefined'. Tested in firefox.

caseyhoward avatar Apr 14 '10 22:04 caseyhoward

Confirmed. There's a token type we're not covering in the AST, typeof against an expression rather than, among other things, a variable. It's not the dot per se.

This does work (don't know if you can use it as a workaround): Johnson::Parser.parse("x = {}; y = x.blah; typeof y;")

smparkes avatar Apr 14 '10 23:04 smparkes