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.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/wasm-builder.h b/src/wasm-builder.h
index bc670bb8f..8ab4cfec9 100644
--- a/src/wasm-builder.h
+++ b/src/wasm-builder.h
@@ -90,12 +90,44 @@ public:
ret->finalize();
return ret;
}
+ Block* makeBlock(const ExpressionList& items) {
+ auto* ret = allocator.alloc<Block>();
+ ret->list.set(items);
+ ret->finalize();
+ return ret;
+ }
+ Block* makeBlock(const ExpressionList& items, WasmType type) {
+ auto* ret = allocator.alloc<Block>();
+ ret->list.set(items);
+ ret->finalize(type);
+ return ret;
+ }
+ Block* makeBlock(Name name, const ExpressionList& items) {
+ auto* ret = allocator.alloc<Block>();
+ ret->name = name;
+ ret->list.set(items);
+ ret->finalize();
+ return ret;
+ }
+ Block* makeBlock(Name name, const ExpressionList& items, WasmType type) {
+ auto* ret = allocator.alloc<Block>();
+ ret->name = name;
+ ret->list.set(items);
+ ret->finalize(type);
+ return ret;
+ }
If* makeIf(Expression* condition, Expression* ifTrue, Expression* ifFalse = nullptr) {
auto* ret = allocator.alloc<If>();
ret->condition = condition; ret->ifTrue = ifTrue; ret->ifFalse = ifFalse;
ret->finalize();
return ret;
}
+ If* makeIf(Expression* condition, Expression* ifTrue, Expression* ifFalse, WasmType type) {
+ auto* ret = allocator.alloc<If>();
+ ret->condition = condition; ret->ifTrue = ifTrue; ret->ifFalse = ifFalse;
+ ret->finalize(type);
+ return ret;
+ }
Loop* makeLoop(Name name, Expression* body) {
auto* ret = allocator.alloc<Loop>();
ret->name = name; ret->body = body;