diff options
Diffstat (limited to 'src/wasm/wasm.cpp')
-rw-r--r-- | src/wasm/wasm.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp index 387ea577f..fe7c1b229 100644 --- a/src/wasm/wasm.cpp +++ b/src/wasm/wasm.cpp @@ -209,10 +209,10 @@ const char* getExpressionName(Expression* curr) { Literal getSingleLiteralFromConstExpression(Expression* curr) { if (auto* c = curr->dynCast<Const>()) { return c->value; - } else if (curr->is<RefNull>()) { - return Literal::makeNullref(); + } else if (auto* n = curr->dynCast<RefNull>()) { + return Literal::makeNull(n->type); } else if (auto* r = curr->dynCast<RefFunc>()) { - return Literal::makeFuncref(r->func); + return Literal::makeFunc(r->func); } else { WASM_UNREACHABLE("Not a constant expression"); } @@ -896,7 +896,16 @@ void Host::finalize() { } } -void RefNull::finalize() { type = Type::nullref; } +void RefNull::finalize(HeapType heapType) { type = Type(heapType, true); } + +void RefNull::finalize(Type type_) { + assert(type_ == Type::unreachable || type_.isNullable()); + type = type_; +} + +void RefNull::finalize() { + assert(type == Type::unreachable || type.isNullable()); +} void RefIsNull::finalize() { if (value->type == Type::unreachable) { |