On 6/28/2013 7:49 PM, A. Sundararajan wrote:
Hi,
I've filed one big umbrella issue for all the issues that you sent
today. (JDK-8019398).
Two observations:
* with({}) function() {}
seems to be accepted by rhino as well. Need to check with what spec.
says though.
It's an error per spec, because
(1) FunctionDeclaration productions can only appear at top-level (that
means in SourceElement)
(2) FunctionDeclarations must be named
and it cannot be parsed as an ExpressionStatement due to the lookahead
restriction in ExpressionStatement.
For compatibility reasons number (1) needs to be dropped, that means the
FunctionDeclaration production moves to the Statement production (with
more or less custom semantics, es-discuss has several threads about this
issue). But (2) still holds. And an unnamed function declaration is
somewhat useless because it's never callable, isn't it?
* for each with initializer - for each(var v=0;false;);
is also permitted by rhino as well - "each" is treated as a noise word
in that case. Given that we included for..each for compatibility with
rhino, we might as well leave that noise word (or is it a bug with
rhino as well?)
I'd call this a Rhino bug, too. By checking the commit history, I've
found out that this bug was already present when E4X support w.r.t.
for-each was initially added. SpiderMonkey reports an error for that code.
- André
-Sundar
On Friday 28 June 2013 03:04 PM, André Bargull wrote:
[....]