Fix bug in newdecls in for loop initializers.

This commit is contained in:
David Anderson 2014-07-05 00:48:32 -07:00
parent 680a8e0283
commit bfc65b086a
2 changed files with 27 additions and 0 deletions

View File

@ -6965,6 +6965,28 @@ static int dofor(void)
autozero=1;
declloc(tok.id); /* declare local variable */
break;
case tSYMBOL:
{
// See comment in statement() near tSYMBOL.
int is_decl = FALSE;
if (matchtoken('[')) {
if (lexpeek(']'))
is_decl = TRUE;
lexpush();
} else if (lexpeek(tSYMBOL)) {
is_decl = TRUE;
}
if (is_decl) {
lexpush();
nestlevel++;
autozero=1;
declloc(tSYMBOL);
break;
}
// Fall-through to default!
}
default:
lexpush();
doexpr(TRUE,TRUE,TRUE,TRUE,NULL,NULL,FALSE); /* expression 1 */

View File

@ -0,0 +1,5 @@
public OnPluginStart()
{
for (bool x; x;) {
}
}