Eric Suen wrote: > I think top-down parser has no issue to parse following code: > > function() { > }(); > > but this is not a valid statement because: > > ExpressionStatement ::= [lookahead ! {{, function}] Expression ;
There is a good reason for that. It's because of semicolon insertion. You'd break things if you tried to "fix" it. Folks write code such as: function f() { ... } (a + b).... and this would turn the expression into a function call. Another issue is that the function name (the "f" in this case) does entirely different things depending on whether it's a function expression or a function definition. Waldemar _______________________________________________ Es-discuss mailing list Es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss