summaryrefslogtreecommitdiff
path: root/src/wasm.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm.h')
-rw-r--r--src/wasm.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/wasm.h b/src/wasm.h
index a4fb7e357..258ed0f35 100644
--- a/src/wasm.h
+++ b/src/wasm.h
@@ -54,7 +54,7 @@ struct FeatureSet {
FeatureSet(uint32_t features) : features(features) {}
bool isMVP() const { return features == MVP; }
- bool has(Feature f) { return (features & f) == f; }
+ bool has(Feature f) const { return (features & f) == f; }
bool hasAtomics() const { return features & Atomics; }
bool hasMutableGlobals() const { return features & MutableGlobals; }
bool hasTruncSat() const { return features & TruncSat; }
@@ -270,7 +270,7 @@ public:
void finalize() {}
template<class T>
- bool is() {
+ bool is() const {
return int(_id) == int(T::SpecificId);
}
@@ -279,11 +279,22 @@ public:
return int(_id) == int(T::SpecificId) ? (T*)this : nullptr;
}
+ template <class T>
+ const T* dynCast() const {
+ return int(_id) == int(T::SpecificId) ? (const T*)this : nullptr;
+ }
+
template<class T>
T* cast() {
assert(int(_id) == int(T::SpecificId));
return (T*)this;
}
+
+ template<class T>
+ const T* cast() const {
+ assert(int(_id) == int(T::SpecificId));
+ return (const T*)this;
+ }
};
const char* getExpressionName(Expression* curr);