diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-01-06 16:35:16 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-01-06 16:35:16 -0800 |
commit | d8c94b6ad4094b580f4a788de3733b5433ca4c2a (patch) | |
tree | bb24aab222947170b58fa4396b5b99a4cf88fd4c | |
parent | 750cb1029cea2dfe5ae98ac4aa9fa47e522228e0 (diff) | |
download | binaryen-d8c94b6ad4094b580f4a788de3733b5433ca4c2a.tar.gz binaryen-d8c94b6ad4094b580f4a788de3733b5433ca4c2a.tar.bz2 binaryen-d8c94b6ad4094b580f4a788de3733b5433ca4c2a.zip |
fix switch parsing and semantics, for br in the table
-rw-r--r-- | src/wasm-interpreter.h | 6 | ||||
-rw-r--r-- | src/wasm-s-parser.h | 8 |
2 files changed, 5 insertions, 9 deletions
diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h index d231aee42..5dbd09ef1 100644 --- a/src/wasm-interpreter.h +++ b/src/wasm-interpreter.h @@ -252,8 +252,10 @@ private: } auto iter = caseMap.find(target); if (iter == caseMap.end()) { - // not in the cases, so this is a break outside - return Flow(target); + // not in the cases, so this is a break + Flow flow(target); + flow.clearIf(curr->name); + return flow; } size_t caseIndex = iter->second; assert(caseIndex < curr->cases.size()); diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h index dfef00d9b..afcc8e2ec 100644 --- a/src/wasm-s-parser.h +++ b/src/wasm-s-parser.h @@ -920,13 +920,7 @@ private: i++; for (size_t j = 1; j < table.size(); j++) { Element& curr = *table[j]; - if (curr[0]->str() == CASE) { - ret->targets.push_back(curr[1]->str()); - } else { - assert(curr[0]->str() == BR); - assert(curr[1]->str() == ret->name); - ret->targets.push_back(Name()); - } + ret->targets.push_back(curr[1]->str()); } Element& curr = *s[i]; if (curr[0]->str() == CASE) { |