summaryrefslogtreecommitdiff
path: root/src/asm2wasm.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/asm2wasm.h')
-rw-r--r--src/asm2wasm.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/asm2wasm.h b/src/asm2wasm.h
index 2245bd2b5..e2b1802b5 100644
--- a/src/asm2wasm.h
+++ b/src/asm2wasm.h
@@ -1397,7 +1397,12 @@ void Asm2WasmBuilder::processAsm(Ref ast) {
void visitCallIndirect(CallIndirect* curr) {
// we already call into target = something + offset, where offset is a callImport with the name of the table. replace that with the table offset
// note that for an ftCall or mftCall, we have no asm.js mask, so have nothing to do here
- auto* add = curr->target->dynCast<Binary>();
+ auto* target = curr->target;
+ // might be a block with a fallthrough
+ if (auto* block = target->dynCast<Block>()) {
+ target = block->list.back();
+ }
+ auto* add = target->dynCast<Binary>();
if (!add) return;
if (add->right->is<CallImport>()) {
auto* offset = add->right->cast<CallImport>();