summaryrefslogtreecommitdiff
path: root/src/wasm.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm.h')
-rw-r--r--src/wasm.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/wasm.h b/src/wasm.h
index 5a8d57fd1..7c6ff85e7 100644
--- a/src/wasm.h
+++ b/src/wasm.h
@@ -412,7 +412,16 @@ public:
o << ' ' << in;
}
incIndent(o, indent);
- printFullLine(o, indent, body);
+ auto block = body->dyn_cast<Block>();
+ if (block && block->name.isNull()) {
+ // wasm spec has loops containing children directly, while our ast
+ // has a single child for simplicity. print out the optimal form.
+ for (auto expression : block->list) {
+ printFullLine(o, indent, expression);
+ }
+ } else {
+ printFullLine(o, indent, body);
+ }
return decIndent(o, indent);
}
};