On 2011-04-06, at 17:17, André Bargull wrote:

> The special case for `typeof` is still necessary just as I've described in 
> the comments for visitUnaryExpression:
>> // Details: noteCallSite() may change the expression to =>
>> //   `typeof ($lzsc$a.lineno = 42, <ID>)`
>> // If <ID> is not defined in the lexical environment, the comma expression
>> // throws a ReferenceError when it is evaluated. Therefore we can't allow
>> // noteCallSite() for identifiers here.
> 
> If <ID> is not defined in the lexical enviroment, `typeof <ID>` yields 
> "undefined", but `typeof ($lzsc$a.lineno = 42, <ID>)` would throw a 
> ReferenceError because the comma expression is evaluated before the `typeof` 
> operator is applied.

Interesting.

I really thought that I invented the idea of being able to use `typeof` to 
check for the existence of a binding (by implementing it that way in our swf < 
9 code generator, and using it to escape our undefined reference checker).  I 
did not realize that behavior was standardized.  It's pretty obscurely 
documented in ES3, made more clear by ES5.

I learn something from you every day!

Reply via email to