diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-04-29 16:30:40 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-04-29 16:30:40 -0700 |
commit | 199c7d3e558d4c2f3dc6be1e0fc826ca45b52b8f (patch) | |
tree | c3a7cc43a52a5b006d2ae6acd9470c18a778d15d /src/wasm.h | |
parent | eb2ea67bf52eac93de977922763a0ee3787be240 (diff) | |
parent | af6b1a77673b1c49f4501918385bd463c50cb28b (diff) | |
download | binaryen-199c7d3e558d4c2f3dc6be1e0fc826ca45b52b8f.tar.gz binaryen-199c7d3e558d4c2f3dc6be1e0fc826ca45b52b8f.tar.bz2 binaryen-199c7d3e558d4c2f3dc6be1e0fc826ca45b52b8f.zip |
Merge pull request #416 from WebAssembly/full-validation-nice
Full validation
Diffstat (limited to 'src/wasm.h')
-rw-r--r-- | src/wasm.h | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/wasm.h b/src/wasm.h index b5dee81b8..b13011bae 100644 --- a/src/wasm.h +++ b/src/wasm.h @@ -833,11 +833,13 @@ public: Name name; ExpressionList list; - void finalize() { - if (list.size() > 0) { - type = list.back()->type; - } + // set the type of a block if you already know it + void finalize(WasmType type_) { + type = type; } + + // set the type of a block based on its contents. this scans the block, so it is not fast + void finalize(); }; class If : public SpecificExpression<Expression::IfId> { @@ -877,6 +879,12 @@ public: Name name; Expression *value; Expression *condition; + + void finalize() { + if (condition) { + type = none; + } + } }; class Switch : public SpecificExpression<Expression::SwitchId> { @@ -1022,7 +1030,6 @@ public: if (isRelational()) { type = i32; } else { - assert(left->type != unreachable && right->type != unreachable ? left->type == right->type : true); type = getReachableWasmType(left->type, right->type); } } |