summaryrefslogtreecommitdiff
path: root/src/binaryen-c.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/binaryen-c.cpp')
-rw-r--r--src/binaryen-c.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/binaryen-c.cpp b/src/binaryen-c.cpp
index c854fcb03..5ae3b7a10 100644
--- a/src/binaryen-c.cpp
+++ b/src/binaryen-c.cpp
@@ -281,14 +281,15 @@ BinaryenExpressionRef BinaryenCallImport(BinaryenModuleRef module, const char *t
ret->finalize();
return static_cast<Expression*>(ret);
}
-BinaryenExpressionRef BinaryenCallIndirect(BinaryenModuleRef module, BinaryenExpressionRef target, BinaryenExpressionRef* operands, BinaryenIndex numOperands, BinaryenFunctionTypeRef type) {
- auto* ret = ((Module*)module)->allocator.alloc<CallIndirect>();
+BinaryenExpressionRef BinaryenCallIndirect(BinaryenModuleRef module, BinaryenExpressionRef target, BinaryenExpressionRef* operands, BinaryenIndex numOperands, const char* type) {
+ auto* wasm = (Module*)module;
+ auto* ret = wasm->allocator.alloc<CallIndirect>();
ret->target = (Expression*)target;
for (BinaryenIndex i = 0; i < numOperands; i++) {
ret->operands.push_back((Expression*)operands[i]);
}
- ret->fullType = (FunctionType*)type;
- ret->finalize();
+ ret->fullType = type;
+ ret->type = wasm->getFunctionType(ret->fullType)->result;
return static_cast<Expression*>(ret);
}
BinaryenExpressionRef BinaryenGetLocal(BinaryenModuleRef module, BinaryenIndex index, BinaryenType type) {