diff options
Diffstat (limited to 'src/wasm/wasm.cpp')
-rw-r--r-- | src/wasm/wasm.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp index 2eed06981..93a14aecc 100644 --- a/src/wasm/wasm.cpp +++ b/src/wasm/wasm.cpp @@ -1080,8 +1080,23 @@ void CallRef::finalize(Type type_) { finalize(); } -// TODO (gc): ref.test -// TODO (gc): ref.cast +void RefTest::finalize() { + if (ref->type == Type::unreachable || rtt->type == Type::unreachable) { + type = Type::unreachable; + } else { + type = Type::i32; + } +} + +void RefCast::finalize() { + if (ref->type == Type::unreachable || rtt->type == Type::unreachable) { + type = Type::unreachable; + } else { + // TODO: make non-nullable when we support that + type = Type(rtt->type.getHeapType(), /* nullable = */ true); + } +} + // TODO (gc): br_on_cast void RttCanon::finalize() { |