summaryrefslogtreecommitdiff
path: root/src/wasm
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm')
-rw-r--r--src/wasm/literal.cpp2
-rw-r--r--src/wasm/wasm-binary.cpp2
-rw-r--r--src/wasm/wasm-type.cpp10
3 files changed, 11 insertions, 3 deletions
diff --git a/src/wasm/literal.cpp b/src/wasm/literal.cpp
index 4ff354e56..151ea83e5 100644
--- a/src/wasm/literal.cpp
+++ b/src/wasm/literal.cpp
@@ -34,7 +34,7 @@ Literal::Literal(Type type) : type(type) {
// i31ref is special in that it is non-nullable, so we construct with zero
i32 = 0;
} else {
- assert(type != Type::unreachable && (!type.isRef() || type.isNullable()));
+ assert(type != Type::unreachable && !type.isNonNullable());
if (isData()) {
new (&gcData) std::shared_ptr<GCData>();
} else if (type.isRtt()) {
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp
index 43ab509a8..f58c4f783 100644
--- a/src/wasm/wasm-binary.cpp
+++ b/src/wasm/wasm-binary.cpp
@@ -2572,7 +2572,7 @@ void WasmBinaryBuilder::pushExpression(Expression* curr) {
std::vector<Type> finalTypes;
if (!wasm.features.hasGCNNLocals()) {
for (auto t : type) {
- if (t.isRef() && !t.isNullable()) {
+ if (t.isNonNullable()) {
t = Type(t.getHeapType(), Nullable);
}
finalTypes.push_back(t);
diff --git a/src/wasm/wasm-type.cpp b/src/wasm/wasm-type.cpp
index eb1bd14b1..d4f38cc2c 100644
--- a/src/wasm/wasm-type.cpp
+++ b/src/wasm/wasm-type.cpp
@@ -845,6 +845,14 @@ bool Type::isNullable() const {
}
}
+bool Type::isNonNullable() const {
+ if (isRef()) {
+ return !isNullable();
+ } else {
+ return false;
+ }
+}
+
bool Type::isRtt() const {
if (isBasic()) {
return false;
@@ -869,7 +877,7 @@ bool Type::isDefaultable() const {
}
return true;
}
- return isConcrete() && (!isRef() || isNullable()) && !isRtt();
+ return isConcrete() && !isNonNullable() && !isRtt();
}
Nullability Type::getNullability() const {