Fix variable declarations in for-loop initializers

This commit is contained in:
Dale Weiler 2015-01-08 23:42:46 -05:00
parent 6fee3ec363
commit 114a1d3b14

View file

@ -2588,16 +2588,17 @@ static bool parse_for_go(parser_t *parser, ast_block *block, ast_expression **ou
initexpr = parse_expression_leave(parser, false, false, false);
if (!initexpr)
goto onerr;
}
/* move on to condition */
if (parser->tok != ';') {
parseerror(parser, "expected semicolon after for-loop initializer");
goto onerr;
}
if (!parser_next(parser)) {
parseerror(parser, "expected for-loop condition");
goto onerr;
/* move on to condition */
if (parser->tok != ';') {
parseerror(parser, "expected semicolon after for-loop initializer");
goto onerr;
}
if (!parser_next(parser)) {
parseerror(parser, "expected for-loop condition");
goto onerr;
}
}
/* parse the condition */