diff options
Diffstat (limited to 'src/wasm/wasm-validator.cpp')
-rw-r--r-- | src/wasm/wasm-validator.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp index 3abb106b3..ce7d0df3c 100644 --- a/src/wasm/wasm-validator.cpp +++ b/src/wasm/wasm-validator.cpp @@ -2230,10 +2230,19 @@ void FunctionValidator::visitRefIsNull(RefIsNull* curr) { } void FunctionValidator::visitRefAs(RefAs* curr) { + if (curr->value->type != Type::unreachable && + !shouldBeTrue( + curr->value->type.isRef(), curr, "ref.as value must be reference")) { + return; + } switch (curr->op) { - default: - // TODO: validate all the other ref.as_* + case RefAsNonNull: { + shouldBeTrue( + getModule()->features.hasReferenceTypes(), + curr, + "ref.as requires reference-types [--enable-reference-types]"); break; + } case AnyConvertExtern: { shouldBeTrue(getModule()->features.hasGC(), curr, |