summaryrefslogtreecommitdiff
path: root/src/wasm2asm.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm2asm.h')
-rw-r--r--src/wasm2asm.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/wasm2asm.h b/src/wasm2asm.h
index 6a27337a8..8f8025dfa 100644
--- a/src/wasm2asm.h
+++ b/src/wasm2asm.h
@@ -236,13 +236,13 @@ Ref Wasm2AsmBuilder::processFunction(Function* func) {
flattenAppend(ret, ValueBuilder::makeStatement(processFunctionBody(func->body, result)));
if (func->result != none) {
// do the actual return
- ret[3]->push_back(ValueBuilder::makeStatement(ValueBuilder::makeReturn(ValueBuilder::makeName(result))));
+ ret[3]->push_back(ValueBuilder::makeStatement(ValueBuilder::makeReturn(makeAsmCoercion(ValueBuilder::makeName(result), wasmToAsmType(func->result)))));
freeTemp(func->result, result);
}
} else {
// whole thing is an expression, just do a return
if (func->result != none) {
- ret[3]->push_back(ValueBuilder::makeStatement(ValueBuilder::makeReturn(processFunctionBody(func->body, EXPRESSION_RESULT))));
+ ret[3]->push_back(ValueBuilder::makeStatement(ValueBuilder::makeReturn(makeAsmCoercion(processFunctionBody(func->body, EXPRESSION_RESULT), wasmToAsmType(func->result)))));
} else {
flattenAppend(ret, processFunctionBody(func->body, NO_RESULT));
}