summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/binaryen-c.cpp6
-rw-r--r--src/binaryen-c.h5
2 files changed, 11 insertions, 0 deletions
diff --git a/src/binaryen-c.cpp b/src/binaryen-c.cpp
index 9c9a1c54f..be80206f5 100644
--- a/src/binaryen-c.cpp
+++ b/src/binaryen-c.cpp
@@ -5684,6 +5684,12 @@ void BinaryenFunctionSetBody(BinaryenFunctionRef func,
assert(body);
((Function*)func)->body = (Expression*)body;
}
+BinaryenHeapType BinaryenFunctionGetType(BinaryenFunctionRef func) {
+ return ((Function*)func)->type.getID();
+}
+void BinaryenFunctionSetType(BinaryenFunctionRef func, BinaryenHeapType type) {
+ ((Function*)func)->type = HeapType(type);
+}
void BinaryenFunctionOptimize(BinaryenFunctionRef func,
BinaryenModuleRef module) {
PassRunner passRunner((Module*)module);
diff --git a/src/binaryen-c.h b/src/binaryen-c.h
index 45230a117..35f1d8eb8 100644
--- a/src/binaryen-c.h
+++ b/src/binaryen-c.h
@@ -3136,6 +3136,11 @@ BinaryenFunctionGetBody(BinaryenFunctionRef func);
// Sets the body of the specified `Function`.
BINARYEN_API void BinaryenFunctionSetBody(BinaryenFunctionRef func,
BinaryenExpressionRef body);
+// Gets the type of the specified `Function`.
+BINARYEN_API BinaryenHeapType BinaryenFunctionGetType(BinaryenFunctionRef func);
+// Sets the type of the specified `Function`.
+BINARYEN_API void BinaryenFunctionSetType(BinaryenFunctionRef func,
+ BinaryenHeapType type);
// Runs the standard optimization passes on the function. Uses the currently set
// global optimize and shrink level.