summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-02-01 10:54:20 -0800
committerAlon Zakai <alonzakai@gmail.com>2016-02-01 11:04:36 -0800
commit34c5a1756596119e84349d97b01946a3522a5902 (patch)
treeaf6b4e2387a61b8b9fc7bc8f143d05ca65f54766
parent27bdda2e01d83a5b4023a729ed2a427f1ee9fe41 (diff)
downloadbinaryen-34c5a1756596119e84349d97b01946a3522a5902.tar.gz
binaryen-34c5a1756596119e84349d97b01946a3522a5902.tar.bz2
binaryen-34c5a1756596119e84349d97b01946a3522a5902.zip
set type for loop #161
-rw-r--r--src/wasm-binary.h1
-rw-r--r--src/wasm-s-parser.h1
-rw-r--r--src/wasm.h4
3 files changed, 6 insertions, 0 deletions
diff --git a/src/wasm-binary.h b/src/wasm-binary.h
index f89ffa23a..c020c3efb 100644
--- a/src/wasm-binary.h
+++ b/src/wasm-binary.h
@@ -1327,6 +1327,7 @@ public:
readExpression(curr->body);
breakStack.pop_back();
breakStack.pop_back();
+ curr->finalize();
}
Name getBreakName(int offset) {
diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h
index 34cd168cd..bf9cd239f 100644
--- a/src/wasm-s-parser.h
+++ b/src/wasm-s-parser.h
@@ -834,6 +834,7 @@ private:
ret->body = makeMaybeBlock(s, i);
labelStack.pop_back();
labelStack.pop_back();
+ ret->finalize();
return ret;
}
diff --git a/src/wasm.h b/src/wasm.h
index 528e9c0b0..6c3efbfbe 100644
--- a/src/wasm.h
+++ b/src/wasm.h
@@ -455,6 +455,10 @@ public:
}
return decIndent(o, indent);
}
+
+ void finalize() {
+ type = body->type; // loop might have a type, if the body ends in something that does not break
+ }
};
class Break : public Expression {