jbarnette / johnson

Johnson wraps JavaScript in a loving Ruby embrace.

Home Page:http://github.com/jbarnette/johnson/wikis

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Parser won't parse typeof against expressions

caseyhoward opened this issue · 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.

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;")