summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHeejin Ahn <aheejin@gmail.com>2024-01-16 15:19:18 -0800
committerGitHub <noreply@github.com>2024-01-16 15:19:18 -0800
commit2dfa01f09071ab78e8134fee5c96bcd022330635 (patch)
tree9031370f07f0923ce8211889a23d3150957ffa91 /src
parent1db044e9654b3147a8d57cc827892d0dcfdd4b85 (diff)
downloadbinaryen-2dfa01f09071ab78e8134fee5c96bcd022330635.tar.gz
binaryen-2dfa01f09071ab78e8134fee5c96bcd022330635.tar.bz2
binaryen-2dfa01f09071ab78e8134fee5c96bcd022330635.zip
Make blockifyWithName correctly use name and type (#6223)
- 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.
Diffstat (limited to 'src')
-rw-r--r--src/wasm-builder.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/wasm-builder.h b/src/wasm-builder.h
index 0c3cec5c2..4b5df766d 100644
--- a/src/wasm-builder.h
+++ b/src/wasm-builder.h
@@ -1338,11 +1338,14 @@ public:
block = any->dynCast<Block>();
}
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;