From 2b314faa4c50738473f977dcf9adae3708363e16 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 5 Nov 2015 18:12:22 -0800 Subject: discard return value if function has none --- src/wasm-interpreter.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/wasm-interpreter.h') diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h index ae3f470ce..c4bf21d54 100644 --- a/src/wasm-interpreter.h +++ b/src/wasm-interpreter.h @@ -576,7 +576,11 @@ public: Function *function = functions[name]; FunctionScope scope(function, arguments); - return ExpressionRunner(*this, scope).visit(function->body).value; + + Literal ret = ExpressionRunner(*this, scope).visit(function->body).value; + if (function->result == none) ret = Literal(); + assert(function->result == ret.type); + return ret; } // Convenience method, for the case where you have no arguments. -- cgit v1.2.3