diff options
author | Alon Zakai <alonzakai@gmail.com> | 2015-12-04 17:58:22 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2015-12-04 17:58:22 -0800 |
commit | ed4e14a5fc0f928db29690b35c06ada80ef68102 (patch) | |
tree | 9dc1c8594a59732a9e980a906c55b92119200490 /src/wasm2asm.h | |
parent | f81abd08214a17e257d08c24408ff395b919e2dc (diff) | |
download | binaryen-ed4e14a5fc0f928db29690b35c06ada80ef68102.tar.gz binaryen-ed4e14a5fc0f928db29690b35c06ada80ef68102.tar.bz2 binaryen-ed4e14a5fc0f928db29690b35c06ada80ef68102.zip |
add a return in the non-expression case in wasm2asm
Diffstat (limited to 'src/wasm2asm.h')
-rw-r--r-- | src/wasm2asm.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/wasm2asm.h b/src/wasm2asm.h index 600f3d2ef..0a6c26739 100644 --- a/src/wasm2asm.h +++ b/src/wasm2asm.h @@ -172,7 +172,11 @@ Ref Wasm2AsmBuilder::processFunction(Function* func) { if (isStatement(func->body)) { IString result = func->result != none ? getTemp(func->result) : NO_RESULT; ret[3]->push_back(processFunctionBody(func->body, result)); - if (result != NO_RESULT) freeTemp(func->result, result); + if (func->result != none) { + // do the actual return + ret[3]->push_back(ValueBuilder::makeStatement(ValueBuilder::makeReturn(ValueBuilder::makeName(result)))); + freeTemp(func->result, result); + } } else { // whole thing is an expression, just do a return ret[3]->push_back(ValueBuilder::makeStatement(ValueBuilder::makeReturn(processFunctionBody(func->body, EXPRESSION_RESULT)))); |