diff options
Diffstat (limited to 'src/wasm/wasm-ir-builder.cpp')
-rw-r--r-- | src/wasm/wasm-ir-builder.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/wasm/wasm-ir-builder.cpp b/src/wasm/wasm-ir-builder.cpp index 4cb9514f5..5e5decca4 100644 --- a/src/wasm/wasm-ir-builder.cpp +++ b/src/wasm/wasm-ir-builder.cpp @@ -157,7 +157,7 @@ void IRBuilder::push(Expression* expr) { Result<Expression*> IRBuilder::build() { if (scopeStack.empty()) { - return builder.makeNop(); + return builder.makeBlock(); } if (scopeStack.size() > 1 || !scopeStack.back().isNone()) { return Err{"unfinished block context"}; @@ -792,12 +792,13 @@ Result<Expression*> IRBuilder::finishScope(Block* block) { Expression* ret = nullptr; if (scope.exprStack.size() == 0) { // No expressions for this scope, but we need something. If we were given a - // block, we can empty it out and return it, but otherwise we need a nop. + // block, we can empty it out and return it, but otherwise create a new + // empty block. if (block) { block->list.clear(); ret = block; } else { - ret = builder.makeNop(); + ret = builder.makeBlock(); } } else if (scope.exprStack.size() == 1) { // We can put our single expression directly into the surrounding scope. |