summaryrefslogtreecommitdiff
path: root/src/wasm.h
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-04-29 16:30:40 -0700
committerAlon Zakai <alonzakai@gmail.com>2016-04-29 16:30:40 -0700
commit199c7d3e558d4c2f3dc6be1e0fc826ca45b52b8f (patch)
treec3a7cc43a52a5b006d2ae6acd9470c18a778d15d /src/wasm.h
parenteb2ea67bf52eac93de977922763a0ee3787be240 (diff)
parentaf6b1a77673b1c49f4501918385bd463c50cb28b (diff)
downloadbinaryen-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.h17
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);
}
}