diff options
author | Alon Zakai <alonzakai@gmail.com> | 2017-05-09 18:10:18 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-09 18:10:18 -0700 |
commit | dbe3384034e12909694c554149a1fb536fbece21 (patch) | |
tree | 9c14169a9479cdca8d03797c6b9e5a1f37951840 /src | |
parent | 647271a97ac534320ef5477367d1eb511afdebd5 (diff) | |
download | binaryen-dbe3384034e12909694c554149a1fb536fbece21.tar.gz binaryen-dbe3384034e12909694c554149a1fb536fbece21.tar.bz2 binaryen-dbe3384034e12909694c554149a1fb536fbece21.zip |
asm2wasm: properly infer return type of a call inside a sequence (#1006)
Diffstat (limited to 'src')
-rw-r--r-- | src/asm2wasm.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/asm2wasm.h b/src/asm2wasm.h index 2fbe4d0ae..6327920fe 100644 --- a/src/asm2wasm.h +++ b/src/asm2wasm.h @@ -478,8 +478,14 @@ private: } FunctionType* getFunctionType(Ref parent, ExpressionList& operands) { - // generate signature - WasmType result = !!parent ? detectWasmType(parent, nullptr) : none; + WasmType result = none; + if (!!parent) { + // if the parent is a seq, we cannot be the last element in it (we would have a coercion, which would be + // the parent), so we must be (us, somethingElse), and so our return is void + if (parent[0] != SEQ) { + result = detectWasmType(parent, nullptr); + } + } return ensureFunctionType(getSig(result, operands), &wasm); } |