summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/wasm.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/wasm.h b/src/wasm.h
index 86aca1fd3..37e79dddb 100644
--- a/src/wasm.h
+++ b/src/wasm.h
@@ -912,7 +912,16 @@ public:
doIndent(o, indent);
printMinorOpening(o, "local ") << local.name << ' ' << printWasmType(local.type) << ")\n";
}
- Expression::printFullLine(o, indent, body);
+ // It is ok to emit a block here, as a function can directly contain a list, even if our
+ // ast avoids that for simplicity. We can just do that optimization here..
+ if (body->is<Block>() && body->cast<Block>()->name.isNull()) {
+ Block* block = body->cast<Block>();
+ for (auto item : block->list) {
+ Expression::printFullLine(o, indent, item);
+ }
+ } else {
+ Expression::printFullLine(o, indent, body);
+ }
return decIndent(o, indent);
}
};