diff options
Diffstat (limited to 'src/wasm/wasm-validator.cpp')
-rw-r--r-- | src/wasm/wasm-validator.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp index bec9b0ad0..486f13d24 100644 --- a/src/wasm/wasm-validator.cpp +++ b/src/wasm/wasm-validator.cpp @@ -2554,14 +2554,19 @@ void FunctionValidator::visitBrOn(BrOn* curr) { return; } if (curr->op == BrOnCast || curr->op == BrOnCastFail) { + if (!shouldBeTrue(curr->castType.isRef(), + curr, + "br_on_cast must have reference cast type")) { + return; + } shouldBeEqual( - curr->intendedType.getBottom(), + curr->castType.getHeapType().getBottom(), curr->ref->type.getHeapType().getBottom(), curr, "br_on_cast* target type and ref type must have a common supertype"); } else { - shouldBeEqual(curr->intendedType, - HeapType(), + shouldBeEqual(curr->castType, + Type(Type::none), curr, "non-cast br_on* must not set intendedType field"); } |