diff options
-rw-r--r-- | src/ast_utils.h | 2 | ||||
-rw-r--r-- | src/wasm-builder.h | 4 | ||||
-rw-r--r-- | src/wasm-linker.cpp | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/src/ast_utils.h b/src/ast_utils.h index c2a3db435..77bfaf1f3 100644 --- a/src/ast_utils.h +++ b/src/ast_utils.h @@ -258,7 +258,7 @@ struct ExpressionManipulator { return ret; } Expression* visitCallImport(CallImport *curr) { - auto* ret = builder.makeCallImport(curr->target, {}); + auto* ret = builder.makeCallImport(curr->target, {}, curr->type); for (Index i = 0; i < curr->operands.size(); i++) { ret->operands.push_back(copy(curr->operands[i])); } diff --git a/src/wasm-builder.h b/src/wasm-builder.h index e58d66795..501124999 100644 --- a/src/wasm-builder.h +++ b/src/wasm-builder.h @@ -107,9 +107,9 @@ public: call->operands.set(args); return call; } - CallImport* makeCallImport(Name target, const std::vector<Expression*>& args) { + CallImport* makeCallImport(Name target, const std::vector<Expression*>& args, WasmType type) { auto* call = wasm.allocator.alloc<CallImport>(); - call->type = wasm.getImport(target)->type->result; + call->type = type; // similar to makeCall, for consistency call->target = target; call->operands.set(args); return call; diff --git a/src/wasm-linker.cpp b/src/wasm-linker.cpp index eb7f9e00d..34dbc7f9c 100644 --- a/src/wasm-linker.cpp +++ b/src/wasm-linker.cpp @@ -396,7 +396,7 @@ Function* Linker::getImportThunk(Name name, const FunctionType* funcType) { for (Index i = 0; i < funcType->params.size(); ++i) { args.push_back(wasmBuilder.makeGetLocal(i, funcType->params[i])); } - Expression* call = wasmBuilder.makeCallImport(name, args); + Expression* call = wasmBuilder.makeCallImport(name, args, funcType->result); f->body = call; out.wasm.addFunction(f); return f; |