summaryrefslogtreecommitdiff
path: root/src/asm2wasm.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/asm2wasm.h')
-rw-r--r--src/asm2wasm.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/asm2wasm.h b/src/asm2wasm.h
index c13c847e7..cb1998aa4 100644
--- a/src/asm2wasm.h
+++ b/src/asm2wasm.h
@@ -431,6 +431,7 @@ private:
if (expression->is<Block>()) return expression->dyn_cast<Block>();
auto ret = allocator.alloc<Block>();
ret->list.push_back(expression);
+ ret->finalize();
return ret;
}
@@ -1154,7 +1155,7 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) {
select->condition = isNegative;
select->type = i32;
block->list.push_back(select);
- block->type = i32;
+ block->finalize();
return block;
} else if (value->type == f32 || value->type == f64) {
auto ret = allocator.alloc<Unary>();
@@ -1237,6 +1238,7 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) {
block = allocator.alloc<Block>();
block->name = name;
block->list.push_back(ret);
+ block->finalize();
ret = block;
}
}
@@ -1279,6 +1281,7 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) {
auto body = allocator.alloc<Block>();
body->list.push_back(condition);
body->list.push_back(process(ast[2]));
+ body->finalize();
ret->body = body;
}
// loops do not automatically loop, add a branch back
@@ -1313,6 +1316,7 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) {
auto block = allocator.alloc<Block>();
block->list.push_back(child);
block->name = stop;
+ block->finalize();
return block;
} else {
auto loop = allocator.alloc<Loop>();
@@ -1376,6 +1380,7 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) {
body->list.push_back(condition);
body->list.push_back(process(fbody));
body->list.push_back(process(finc));
+ body->finalize();
ret->body = body;
// loops do not automatically loop, add a branch back
Block* block = blockify(ret->body);
@@ -1389,6 +1394,7 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) {
// add an outer block for the init as well
outer->list.push_back(process(finit));
outer->list.push_back(ret);
+ outer->finalize();
return outer;
} else if (what == LABEL) {
assert(parentLabel.isNull());
@@ -1405,7 +1411,7 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) {
auto ret = allocator.alloc<Block>();
ret->list.push_back(process(ast[1]));
ret->list.push_back(process(ast[2]));
- ret->type = ret->list[1]->type;
+ ret->finalize();
return ret;
} else if (what == SWITCH) {
IString name;
@@ -1510,6 +1516,7 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) {
for (unsigned i = from; i < ast->size(); i++) {
block->list.push_back(process(ast[i]));
}
+ block->finalize();
return block;
};
// body