From d5ef034842202c74192182717beb33b90bd667a3 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Fri, 12 Jan 2024 15:26:51 -0800 Subject: [PATCH] Make blockifyWithName correctly use name and type - This passes `name` to `makeBlock` call, because `makeBlock` uses `BranchSeeker` when finalizing only when the block has a `name`. - This also refinalizes the block when an optional `type` is given. This was spun off from #6210, but I'm not sure how to add a standalone test for this. --- src/wasm-builder.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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;