From ff6e2584dabbcf6f89e9a93ad9de4dffd6e40c65 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Fri, 21 Jan 2011 10:57:47 +0900 Subject: [PATCH] Handle block sub-expressions that produce results. --- tools/qfcc/source/statements.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/qfcc/source/statements.c b/tools/qfcc/source/statements.c index c50d9cccb..f6f357046 100644 --- a/tools/qfcc/source/statements.c +++ b/tools/qfcc/source/statements.c @@ -276,6 +276,16 @@ statement_assign (sblock_t *sblock, expr_t *e) return sblock; } +static sblock_t * +expr_block (sblock_t *sblock, expr_t *e, operand_t **op) +{ + if (!e->e.block.result) + internal_error (e, "block sub-expression without result"); + sblock = statement_slist (sblock, e->e.block.head); + sblock = statement_subexpr (sblock, e->e.block.result, op); + return sblock; +} + static sblock_t * expr_expr (sblock_t *sblock, expr_t *e, operand_t **op) { @@ -341,7 +351,7 @@ statement_subexpr (sblock_t *sblock, expr_t *e, operand_t **op) 0, // ex_state 0, // ex_bool 0, // ex_label - 0, // ex_block + expr_block, // ex_block expr_expr, expr_uexpr, expr_symbol,