Add "fallthrough" keyword, require a flow statement to end case blocks.

Case blocks in switch statements now must end in a break, return, or
fallthrough statement to give best mix of safety, readability, and
flexibility.

The new fallthrough keyword explicitly allows control to be passed to the
next case block in a switch statement.

Addresses #754.
This commit is contained in:
Jon Siwek 2013-01-16 16:17:17 -06:00
parent 8695053e27
commit be71a42f4c
8 changed files with 150 additions and 33 deletions

View file

@ -282,6 +282,7 @@ else return TOK_ELSE;
enum return TOK_ENUM;
event return TOK_EVENT;
export return TOK_EXPORT;
fallthrough return TOK_FALLTHROUGH;
file return TOK_FILE;
for return TOK_FOR;
function return TOK_FUNCTION;