diff options
author | Alon Zakai <alonzakai@gmail.com> | 2015-11-05 18:12:22 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2015-11-05 18:12:22 -0800 |
commit | 2b314faa4c50738473f977dcf9adae3708363e16 (patch) | |
tree | b14e7a2bafeab326ae8f516e8a9c67b60d529abc | |
parent | 12d6877a9361fa1a647541ba83e35272aeb319f3 (diff) | |
download | binaryen-2b314faa4c50738473f977dcf9adae3708363e16.tar.gz binaryen-2b314faa4c50738473f977dcf9adae3708363e16.tar.bz2 binaryen-2b314faa4c50738473f977dcf9adae3708363e16.zip |
discard return value if function has none
-rwxr-xr-x | check.py | 2 | ||||
-rw-r--r-- | src/wasm-interpreter.h | 6 |
2 files changed, 6 insertions, 2 deletions
@@ -83,7 +83,7 @@ if len(requested) == 0: #spec_tests = [] # XXX [os.path.join('spec', t) for t in sorted(os.listdir(os.path.join('test', 'spec')))] # 'address' : filed issue, test looks invalid # 'exports' : has a "return" https://github.com/WebAssembly/spec/issues/164 - spec_tests = [os.path.join('spec', t + '.wast') for t in ['conversions', 'endianness', 'f32_cmp', 'f32', 'f64_cmp', 'f64', 'float_exprs', 'forward', 'func_ptrs']] + spec_tests = [os.path.join('spec', t + '.wast') for t in ['conversions', 'endianness', 'f32_cmp', 'f32', 'f64_cmp', 'f64', 'float_exprs', 'forward', 'func_ptrs', 'functions']] else: spec_tests = requested[:] 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. |