diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-02-01 11:14:39 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-02-01 11:14:39 -0800 |
commit | b4e04afe0a74edf35642908e715e2497f6c18e7f (patch) | |
tree | f2b319b0982900aaa1d3fb3052f52870362d0021 /src/wasm.h | |
parent | 45aa22043f265eafe701d5dda76f78cf50b2bf9c (diff) | |
download | binaryen-b4e04afe0a74edf35642908e715e2497f6c18e7f.tar.gz binaryen-b4e04afe0a74edf35642908e715e2497f6c18e7f.tar.bz2 binaryen-b4e04afe0a74edf35642908e715e2497f6c18e7f.zip |
use getReachableWasmType in if_else and select
Diffstat (limited to 'src/wasm.h')
-rw-r--r-- | src/wasm.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/wasm.h b/src/wasm.h index 52082f3a8..ca396fd24 100644 --- a/src/wasm.h +++ b/src/wasm.h @@ -432,6 +432,12 @@ public: if (ifFalse) printFullLine(o, indent, ifFalse); return decIndent(o, indent); } + + void finalize() { + if (condition) { + type = getReachableWasmType(ifTrue->type, ifFalse->type); + } + } }; class Loop : public Expression { @@ -892,8 +898,7 @@ public: } void finalize() { - type = ifTrue->type; - if (type == none) type = ifFalse->type; // ifTrue might be unreachable + type = getReachableWasmType(ifTrue->type, ifFalse->type); } }; |