1.1 --- a/sourcepawn/compiler/sc1.c Fri Jul 08 07:55:20 2011 -0400
1.2 +++ b/sourcepawn/compiler/sc1.c Sat Jul 09 20:47:43 2011 -0700
1.3 @@ -5660,9 +5660,13 @@
1.4 case '{':
1.5 case tBEGIN:
1.6 save=fline;
1.7 - if (!matchtoken('}')) /* {} is the empty statement */
1.8 + if (!matchtoken('}')) { /* {} is the empty statement */
1.9 compound(save==fline,tok);
1.10 - /* lastst (for "last statement") does not change */
1.11 + } else {
1.12 + lastst = tEMPTYBLOCK;
1.13 + }
1.14 + /* lastst (for "last statement") does not change
1.15 + you're not my father, don't tell me what to do */
1.16 break;
1.17 case ';':
1.18 error(36); /* empty statement */
1.19 @@ -5990,6 +5994,12 @@
1.20 setlabel(flab1); /* print false label */
1.21 statement(NULL,FALSE); /* do "else" clause */
1.22 setlabel(flab2); /* print true label */
1.23 + /* if both the "true" branch and the "false" branch ended with the same
1.24 + * kind of statement, set the last statement id to that kind, rather than
1.25 + * to the generic tIF; this allows for better "unreachable code" checking
1.26 + */
1.27 + if (lastst==lastst_true)
1.28 + return lastst;
1.29 } /* if */
1.30 return tIF;
1.31 }