summaryrefslogtreecommitdiff
path: root/src/wasm-builder.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm-builder.h')
-rw-r--r--src/wasm-builder.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/wasm-builder.h b/src/wasm-builder.h
index 8e7cc9908..9024ea6b1 100644
--- a/src/wasm-builder.h
+++ b/src/wasm-builder.h
@@ -547,10 +547,12 @@ public:
// block
Block* blockify(Expression* any, Expression* append = nullptr) {
Block* block = nullptr;
- if (any)
+ if (any) {
block = any->dynCast<Block>();
- if (!block)
+ }
+ if (!block) {
block = makeBlock(any);
+ }
if (append) {
block->list.push_back(append);
block->finalize();
@@ -569,10 +571,12 @@ public:
Block*
blockifyWithName(Expression* any, Name name, Expression* append = nullptr) {
Block* block = nullptr;
- if (any)
+ if (any) {
block = any->dynCast<Block>();
- if (!block || block->name.is())
+ }
+ if (!block || block->name.is()) {
block = makeBlock(any);
+ }
block->name = name;
if (append) {
block->list.push_back(append);
@@ -619,8 +623,9 @@ public:
// Drop an expression if it has a concrete type
Expression* dropIfConcretelyTyped(Expression* curr) {
- if (!isConcreteType(curr->type))
+ if (!isConcreteType(curr->type)) {
return curr;
+ }
return makeDrop(curr);
}