diff options
author | Ben Smith <binji@chromium.org> | 2016-04-23 23:05:01 -0700 |
---|---|---|
committer | Ben Smith <binji@chromium.org> | 2016-04-28 23:45:46 -0700 |
commit | 712942698bd2a26d5274634854bb2fe9f0c879e8 (patch) | |
tree | b50548e520a483256e3bd00b5039e35935276bfc /src/wasm-ast-checker.c | |
parent | aace63e852422d9da89d1ed034d13b8965fe6205 (diff) | |
download | wabt-712942698bd2a26d5274634854bb2fe9f0c879e8.tar.gz wabt-712942698bd2a26d5274634854bb2fe9f0c879e8.tar.bz2 wabt-712942698bd2a26d5274634854bb2fe9f0c879e8.zip |
use post-order style if
Diffstat (limited to 'src/wasm-ast-checker.c')
-rw-r--r-- | src/wasm-ast-checker.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/wasm-ast-checker.c b/src/wasm-ast-checker.c index 7f6ac82e..39aad36a 100644 --- a/src/wasm-ast-checker.c +++ b/src/wasm-ast-checker.c @@ -572,21 +572,32 @@ static void check_expr(WasmContext* ctx, break; case WASM_EXPR_TYPE_IF: { + WasmLabelNode node; check_expr(ctx, module, func, expr->if_.cond, WASM_TYPE_I32, " of condition"); - check_expr(ctx, module, func, expr->if_.true_, expected_type, + push_label(ctx, &expr->loc, &node, &expr->if_.true_.label, expected_type, + "if branch"); + check_exprs(ctx, module, func, &expr->if_.true_.exprs, expected_type, " of if branch"); + pop_label(ctx); check_type(ctx, &expr->loc, WASM_TYPE_VOID, expected_type, desc); break; } case WASM_EXPR_TYPE_IF_ELSE: { + WasmLabelNode node; check_expr(ctx, module, func, expr->if_else.cond, WASM_TYPE_I32, " of condition"); - check_expr(ctx, module, func, expr->if_else.true_, expected_type, + push_label(ctx, &expr->loc, &node, &expr->if_else.true_.label, + expected_type, "if true branch"); + check_exprs(ctx, module, func, &expr->if_else.true_.exprs, expected_type, " of if branch"); - check_expr(ctx, module, func, expr->if_else.false_, expected_type, + pop_label(ctx); + push_label(ctx, &expr->loc, &node, &expr->if_else.false_.label, + expected_type, "if false branch"); + check_exprs(ctx, module, func, &expr->if_else.false_.exprs, expected_type, " of if branch"); + pop_label(ctx); break; } |