On Apr 19, 2011, at 10:41 AM, Bob Nystrom wrote:
> On Mon, Apr 18, 2011 at 7:46 PM, Mike Samuel <[email protected]> wrote:
> If I understand semicolon elision, then
>
> myLabel:
> for (;;) {}
>
> would be interpreted as
>
> myLabel: ;
> for (;;) {}
>
> I'm still learning to details of the ES grammar, but I didn't think there
> were cases where a ";" is valid after a ":". Object literals need a value
> after it, labels need a subsequent statement, and switch cases need a
> statement, right?
No, labeling an empty statement is permitted by the grammar:
js> L:;
js>
Same as in C, but useless without goto. Still, back in the old days we did not
want to add complexity to limit labels to apply only to non-empty statements.
You can break from the then part of a labeled if, in lieu of a downward goto,
e.g.
/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss