diff options
Diffstat (limited to 'src/wasm/wasm.cpp')
-rw-r--r-- | src/wasm/wasm.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp index a94bda066..f8d8890ec 100644 --- a/src/wasm/wasm.cpp +++ b/src/wasm/wasm.cpp @@ -936,13 +936,24 @@ void BrOn::finalize() { (rtt && rtt->type == Type::unreachable)) { type = Type::unreachable; } else { - type = ref->type; + if (op == BrOnNull) { + // If BrOnNull does not branch, it flows out the existing value as + // non-null. + // FIXME: When we support non-nullable types, this should be non-nullable. + type = Type(ref->type.getHeapType(), Nullable); + } else { + type = ref->type; + } } } Type BrOn::getCastType() { switch (op) { + case BrOnNull: + // BrOnNull does not send a value on the branch. + return Type::none; case BrOnCast: + // FIXME: When we support non-nullable types, this should be non-nullable. return Type(rtt->type.getHeapType(), Nullable); case BrOnFunc: return Type::funcref; |