diff options
Diffstat (limited to 'src/wasm-builder.h')
-rw-r--r-- | src/wasm-builder.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/wasm-builder.h b/src/wasm-builder.h index 72d2a1db0..8f8895781 100644 --- a/src/wasm-builder.h +++ b/src/wasm-builder.h @@ -1387,8 +1387,10 @@ public: if (curr->type.isNullable() && curr->type.isNull()) { return ExpressionManipulator::refNull(curr, curr->type); } - if (curr->type.isRef() && curr->type.getHeapType() == HeapType::i31) { - Expression* ret = makeRefI31(makeConst(0)); + if (curr->type.isRef() && + curr->type.getHeapType().isMaybeShared(HeapType::i31)) { + Expression* ret = + makeRefI31(makeConst(0), curr->type.getHeapType().getShared()); if (curr->type.isNullable()) { // To keep the type identical, wrap it in a block that adds nullability. ret = makeBlock({ret}, curr->type); |