summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-01-14 11:45:13 -0800
committerAlon Zakai <alonzakai@gmail.com>2016-01-14 11:45:13 -0800
commitdb7285b8f8e1a536fdfee60103bafc4ecfe3ed1f (patch)
treec6e7b85c634f6a41437de0883ae6313180ab5fff
parent786e95242caa4343edc6781a5738ebfbe1df1592 (diff)
downloadbinaryen-db7285b8f8e1a536fdfee60103bafc4ecfe3ed1f.tar.gz
binaryen-db7285b8f8e1a536fdfee60103bafc4ecfe3ed1f.tar.bz2
binaryen-db7285b8f8e1a536fdfee60103bafc4ecfe3ed1f.zip
break assert
-rw-r--r--src/wasm-binary.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/wasm-binary.h b/src/wasm-binary.h
index 9890453a6..16b9419e5 100644
--- a/src/wasm-binary.h
+++ b/src/wasm-binary.h
@@ -593,12 +593,15 @@ public:
void visitBreak(Break *curr) {
if (debug) std::cerr << "zz node: Break" << std::endl;
o << int8_t(curr->condition ? BinaryConsts::BrIf : BinaryConsts::Br);
+ bool found = false;
for (int i = breakStack.size() - 1; i >= 0; i--) {
if (breakStack[i] == curr->name) {
o << int8_t(breakStack.size() - 1 - i);
+ found = true;
break;
}
}
+ assert(found);
if (curr->condition) recurse(curr->condition);
}
void visitSwitch(Switch *curr) {