summaryrefslogtreecommitdiff
path: root/src/wasm-type.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm-type.h')
-rw-r--r--src/wasm-type.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/wasm-type.h b/src/wasm-type.h
index 39ec1640e..98c6c70ed 100644
--- a/src/wasm-type.h
+++ b/src/wasm-type.h
@@ -17,6 +17,7 @@
#ifndef wasm_wasm_type_h
#define wasm_wasm_type_h
+#include "support/name.h"
#include "wasm-features.h"
#include <ostream>
#include <vector>
@@ -285,11 +286,12 @@ struct Field {
i16,
} packedType; // applicable iff type=i32
bool mutable_;
+ Name name;
- Field(Type type, bool mutable_ = false)
- : type(type), packedType(not_packed), mutable_(mutable_) {}
- Field(PackedType packedType, bool mutable_ = false)
- : type(Type::i32), packedType(packedType), mutable_(mutable_) {}
+ Field(Type type, bool mutable_, Name name = Name())
+ : type(type), packedType(not_packed), mutable_(mutable_), name(name) {}
+ Field(PackedType packedType, bool mutable_, Name name = Name())
+ : type(Type::i32), packedType(packedType), mutable_(mutable_), name(name) {}
constexpr bool isPacked() const {
if (packedType != not_packed) {
@@ -300,6 +302,8 @@ struct Field {
}
bool operator==(const Field& other) const {
+ // Note that the name is not checked here - it is pure metadata for printing
+ // purposes only.
return type == other.type && packedType == other.packedType &&
mutable_ == other.mutable_;
}
@@ -362,6 +366,7 @@ struct HeapType {
HeapType(const HeapType& other);
~HeapType();
+ bool isBasic() const { return kind <= _last_basic_kind; }
bool isSignature() const { return kind == SignatureKind; }
Signature getSignature() const {
assert(isSignature() && "Not a signature");