diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-01-23 14:31:11 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-01-23 14:31:11 -0800 |
commit | f5ae1c668553b56efd7c336b36c1d12c4fb07229 (patch) | |
tree | ba65173edecdb60a1ab4cf3c94accbec559284ac | |
parent | 81a1be8f2b0dbad3dfab020be9949bc6906b0e93 (diff) |
add value to returns when function returns a non-void
-rw-r--r-- | src/jsifier.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/jsifier.js b/src/jsifier.js index a8d3c329..39587c3c 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -1156,8 +1156,10 @@ function JSify(data, functionsOnly, givenFunctions) { + "INDENT = INDENT.substr(0, INDENT.length-2);\n"; } ret += 'return'; - if (item.value) { - ret += ' ' + asmCoercion(finalizeLLVMParameter(item.value), item.type); + var value = item.value ? finalizeLLVMParameter(item.value) : null; + if (!value && item.funcData.returnType != 'void') value = '0'; // no-value returns must become value returns if function returns + if (value) { + ret += ' ' + asmCoercion(value, item.type); } return ret + ';'; }); |