summaryrefslogtreecommitdiff
path: root/src/wasm-type.h
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2020-12-03 16:40:56 -0800
committerGitHub <noreply@github.com>2020-12-03 16:40:56 -0800
commitbd9872ddf850bf177298a5274a15807e6227cd3d (patch)
tree7336966d47bf4b54610e62a835e06f4ec29ceddc /src/wasm-type.h
parentd6444b5032a64f3abe35bf60eb96e151669d2fa5 (diff)
downloadbinaryen-bd9872ddf850bf177298a5274a15807e6227cd3d.tar.gz
binaryen-bd9872ddf850bf177298a5274a15807e6227cd3d.tar.bz2
binaryen-bd9872ddf850bf177298a5274a15807e6227cd3d.zip
[Types] Refactor signature collection to heap type collection. NFC. (#3420)
This will allow writing GC types in the future, which are non-signature heap types. To allow this PR to work, it adds operator< for HeapType so that it can be used in the data structures that collect uses. Drive-by fix of a weird hack with sending a Name* in Print.
Diffstat (limited to 'src/wasm-type.h')
-rw-r--r--src/wasm-type.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/wasm-type.h b/src/wasm-type.h
index 77f7120bf..39ec1640e 100644
--- a/src/wasm-type.h
+++ b/src/wasm-type.h
@@ -304,6 +304,7 @@ struct Field {
mutable_ == other.mutable_;
}
bool operator!=(const Field& other) const { return !(*this == other); }
+ bool operator<(const Field& other) const;
std::string toString() const;
};
@@ -316,6 +317,7 @@ struct Struct {
Struct(FieldList&& fields) : fields(std::move(fields)) {}
bool operator==(const Struct& other) const { return fields == other.fields; }
bool operator!=(const Struct& other) const { return !(*this == other); }
+ bool operator<(const Struct& other) const { return fields < other.fields; }
std::string toString() const;
};
@@ -326,6 +328,7 @@ struct Array {
Array(Field&& element) : element(std::move(element)) {}
bool operator==(const Array& other) const { return element == other.element; }
bool operator!=(const Array& other) const { return !(*this == other); }
+ bool operator<(const Array& other) const { return element < other.element; }
std::string toString() const;
};
@@ -378,6 +381,7 @@ struct HeapType {
bool operator==(const HeapType& other) const;
bool operator!=(const HeapType& other) const { return !(*this == other); }
+ bool operator<(const HeapType& other) const;
HeapType& operator=(const HeapType& other);
std::string toString() const;
};