diff --git a/src/wasm-builder.h b/src/wasm-builder.h index 0c3cec5c2b6..4b5df766d0c 100644 --- a/src/wasm-builder.h +++ b/src/wasm-builder.h @@ -1338,11 +1338,14 @@ class Builder { block = any->dynCast(); } if (!block || block->name.is()) { - block = makeBlock(any); + block = makeBlock(name, any); + } else { + block->name = name; } - block->name = name; if (append) { block->list.push_back(append); + } + if (append || type) { block->finalize(type); } return block;