summaryrefslogtreecommitdiff
path: root/src/wasm
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm')
-rw-r--r--src/wasm/wasm-type.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/wasm/wasm-type.cpp b/src/wasm/wasm-type.cpp
index 148b55716..024894dfb 100644
--- a/src/wasm/wasm-type.cpp
+++ b/src/wasm/wasm-type.cpp
@@ -237,6 +237,19 @@ bool Type::isSubType(Type left, Type right) {
(right == Type::anyref || left == Type::nullref)) {
return true;
}
+ if (left.isMulti() && right.isMulti()) {
+ const auto& leftElems = left.expand();
+ const auto& rightElems = right.expand();
+ if (leftElems.size() != rightElems.size()) {
+ return false;
+ }
+ for (size_t i = 0; i < leftElems.size(); ++i) {
+ if (!isSubType(leftElems[i], rightElems[i])) {
+ return false;
+ }
+ }
+ return true;
+ }
return false;
}