X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=parser.c;h=4d50bad5e15232cc0da981bd08484b3362b131f8;hb=a0fa90ddd555f7d55042b0fb542e63e6b10ad7e2;hp=6ad55025c3896b9cf9d435985ad9b9a2cb45e92e;hpb=c5225b2fa1e314447392febdd1dee2a2a1744016;p=xonotic%2Fgmqcc.git diff --git a/parser.c b/parser.c index 6ad5502..4d50bad 100644 --- a/parser.c +++ b/parser.c @@ -2227,8 +2227,8 @@ static ast_expression* parse_expression_leave(parser_t *parser, bool stopatcomma } parser->lex->flags.noops = true; - if (!vec_size(sy.out)) { - parseerror(parser, "empty expression"); + if (vec_size(sy.out) != 1) { + parseerror(parser, "expression with not 1 but %lu output values...", (unsigned long) vec_size(sy.out)); expr = NULL; } else expr = sy.out[0].out; @@ -2779,7 +2779,6 @@ static bool parse_for_go(parser_t *parser, ast_block *block, ast_expression **ou ast_expression *initexpr, *cond, *increment, *ontrue; ast_value *typevar; - bool retval = true; bool ifnot = false; lex_ctx ctx = parser_ctx(parser); @@ -2879,9 +2878,11 @@ static bool parse_for_go(parser_t *parser, ast_block *block, ast_expression **ou aloop = ast_loop_new(ctx, initexpr, cond, ifnot, NULL, false, increment, ontrue); *out = (ast_expression*)aloop; - if (!parser_leaveblock(parser)) - retval = false; - return retval; + if (!parser_leaveblock(parser)) { + ast_delete(aloop); + return false; + } + return true; onerr: if (initexpr) ast_unref(initexpr); if (cond) ast_unref(cond);