Handle block sub-expressions that produce results.

This commit is contained in:
Bill Currie 2011-01-21 10:57:47 +09:00
parent 16e013ff5d
commit ff6e2584da

View file

@ -276,6 +276,16 @@ statement_assign (sblock_t *sblock, expr_t *e)
return sblock; 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 * static sblock_t *
expr_expr (sblock_t *sblock, expr_t *e, operand_t **op) 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_state
0, // ex_bool 0, // ex_bool
0, // ex_label 0, // ex_label
0, // ex_block expr_block, // ex_block
expr_expr, expr_expr,
expr_uexpr, expr_uexpr,
expr_symbol, expr_symbol,