summaryrefslogtreecommitdiff
path: root/src/wasm-binary-writer.c
diff options
context:
space:
mode:
authorBen Smith <binjimin@gmail.com>2016-07-06 15:25:09 -0700
committerGitHub <noreply@github.com>2016-07-06 15:25:09 -0700
commitb487574ba29dd85c64be6aa1406b58084b14b8b4 (patch)
tree68141591b2004bfa860b107777f6bc695a18c30f /src/wasm-binary-writer.c
parent35600ece919c127db39e625be103a149746fb7b1 (diff)
downloadwabt-b487574ba29dd85c64be6aa1406b58084b14b8b4.tar.gz
wabt-b487574ba29dd85c64be6aa1406b58084b14b8b4.tar.bz2
wabt-b487574ba29dd85c64be6aa1406b58084b14b8b4.zip
functions have an implicit block scope (#91)
`(func (br 0))` is valid, because the function introduces an implicit block scope. This change also updates the testsuite (which has tests for this behavior).
Diffstat (limited to 'src/wasm-binary-writer.c')
-rw-r--r--src/wasm-binary-writer.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/wasm-binary-writer.c b/src/wasm-binary-writer.c
index f7f58b56..385c773a 100644
--- a/src/wasm-binary-writer.c
+++ b/src/wasm-binary-writer.c
@@ -760,8 +760,12 @@ static void write_func_locals(WasmContext* ctx,
static void write_func(WasmContext* ctx,
const WasmModule* module,
const WasmFunc* func) {
+ WasmLabelNode node;
+ WasmLabel label = wasm_empty_string_slice();
write_func_locals(ctx, module, func, &func->local_types);
+ push_label(ctx, &node, &label);
write_expr_list(ctx, module, func, func->first_expr);
+ pop_label(ctx, &label);
}
static void write_module(WasmContext* ctx, const WasmModule* module) {