| 95 | } |
| 96 | |
| 97 | static bool RecursiveMatch(const ValueTypes& expected, |
| 98 | std::vector<FuncType>* expected_func_types, |
| 99 | const ValueTypes& actual, |
| 100 | std::vector<FuncType>* actual_func_types) { |
| 101 | if (expected_func_types == nullptr || actual_func_types == nullptr) { |
| 102 | return false; |
| 103 | } |
| 104 | |
| 105 | size_t size = expected.size(); |
| 106 | if (size != actual.size()) { |
| 107 | return false; |
| 108 | } |
| 109 | |
| 110 | for (size_t i = 0; i < size; i++) { |
| 111 | if (!expected[i].IsReferenceWithIndex()) { |
| 112 | if (expected[i] != actual[i]) { |
| 113 | return false; |
| 114 | } |
| 115 | continue; |
| 116 | } |
| 117 | |
| 118 | if (static_cast<Type::Enum>(expected[i]) != |
| 119 | static_cast<Type::Enum>(actual[i])) { |
| 120 | return false; |
| 121 | } |
| 122 | |
| 123 | const FuncType& expected_type = |
| 124 | (*expected_func_types)[expected[i].GetReferenceIndex()]; |
| 125 | const FuncType& actual_type = |
| 126 | (*actual_func_types)[actual[i].GetReferenceIndex()]; |
| 127 | |
| 128 | assert(expected_type.func_types == expected_func_types); |
| 129 | assert(actual_type.func_types == actual_func_types); |
| 130 | |
| 131 | if (!RecursiveMatch(expected_type.params, expected_func_types, |
| 132 | actual_type.params, actual_func_types) || |
| 133 | !RecursiveMatch(expected_type.results, expected_func_types, |
| 134 | actual_type.results, actual_func_types)) { |
| 135 | return false; |
| 136 | } |
| 137 | } |
| 138 | |
| 139 | return true; |
| 140 | } |
| 141 | |
| 142 | Result Match(const FuncType& expected, |
| 143 | const FuncType& actual, |
no test coverage detected