summaryrefslogtreecommitdiff
path: root/src/wasm.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm.h')
-rw-r--r--src/wasm.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/wasm.h b/src/wasm.h
index 37aa495db..afc2cf88c 100644
--- a/src/wasm.h
+++ b/src/wasm.h
@@ -298,6 +298,12 @@ public:
return _id == T()._id ? (T*)this : nullptr;
}
+ template<class T>
+ T* cast() {
+ assert(_id == T()._id);
+ return (T*)this;
+ }
+
inline std::ostream& print(std::ostream &o, unsigned indent); // avoid virtual here, for performance
friend std::ostream& operator<<(std::ostream &o, Expression* expression) {