summaryrefslogtreecommitdiff
path: root/src/wasm/wasm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm/wasm.cpp')
-rw-r--r--src/wasm/wasm.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp
index 0b45f494d..c03a9b281 100644
--- a/src/wasm/wasm.cpp
+++ b/src/wasm/wasm.cpp
@@ -206,6 +206,10 @@ const char* getExpressionName(Expression* curr) {
return "tuple.make";
case Expression::Id::TupleExtractId:
return "tuple.extract";
+ case Expression::Id::I31NewId:
+ return "i31.new";
+ case Expression::Id::I31GetId:
+ return "i31.get";
case Expression::Id::NumExpressionIds:
WASM_UNREACHABLE("invalid expr id");
}
@@ -969,6 +973,22 @@ void TupleExtract::finalize() {
}
}
+void I31New::finalize() {
+ if (value->type == Type::unreachable) {
+ type = Type::unreachable;
+ } else {
+ type = Type::i31ref;
+ }
+}
+
+void I31Get::finalize() {
+ if (i31->type == Type::unreachable) {
+ type = Type::unreachable;
+ } else {
+ type = Type::i32;
+ }
+}
+
size_t Function::getNumParams() { return sig.params.size(); }
size_t Function::getNumVars() { return vars.size(); }