From 114a1d3b14119460e85597eeda4f2d2c8ed956b3 Mon Sep 17 00:00:00 2001 From: Dale Weiler Date: Thu, 8 Jan 2015 23:42:46 -0500 Subject: [PATCH] Fix variable declarations in for-loop initializers --- parser.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/parser.c b/parser.c index 4a09583..b629c87 100644 --- a/parser.c +++ b/parser.c @@ -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 */ -- 2.39.2