Skip to content

Commit c9f5a65

Browse files
committed
operator fix
1 parent c6d7655 commit c9f5a65

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

src/wasm/wasm-type.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ std::vector<std::unique_ptr<std::vector<Type>>> typeLists = [] {
5656
};
5757

5858
add({});
59-
add({});
59+
add({Type::unreachable});
6060
add({Type::i32});
6161
add({Type::i64});
6262
add({Type::f32});
@@ -71,7 +71,7 @@ std::vector<std::unique_ptr<std::vector<Type>>> typeLists = [] {
7171

7272
std::unordered_map<std::vector<Type>, uint32_t> indices = {
7373
{{}, Type::none},
74-
{{}, Type::unreachable},
74+
{{Type::unreachable}, Type::unreachable},
7575
{{Type::i32}, Type::i32},
7676
{{Type::i64}, Type::i64},
7777
{{Type::f32}, Type::f32},
@@ -139,14 +139,6 @@ const std::vector<Type>& Type::expand() const {
139139
}
140140

141141
bool Type::operator<(const Type& other) const {
142-
// Both none and unreachable do not have a vector to expand, so we have to
143-
// handle them specially here.
144-
if (id == none && other.id == unreachable) {
145-
return true;
146-
} else if (id == unreachable && other.id == none) {
147-
return false;
148-
}
149-
150142
const std::vector<Type>& these = expand();
151143
const std::vector<Type>& others = other.expand();
152144
return std::lexicographical_compare(

test/example/c-api-kitchen-sink.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ void test_types() {
161161
printf(" // BinaryenTypeUnreachable: %d\n", unreachable);
162162
assert(BinaryenTypeArity(unreachable) == 0);
163163
BinaryenTypeExpand(unreachable, &valueType);
164-
assert(valueType == 0xdeadbeef);
164+
assert(valueType == unreachable);
165165

166166
BinaryenType i32 = BinaryenTypeInt32();
167167
printf(" // BinaryenTypeInt32: %d\n", i32);

0 commit comments

Comments
 (0)