summaryrefslogtreecommitdiff
path: root/src/wasm/wasm.cpp
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2017-07-27 12:59:02 -0700
committerGitHub <noreply@github.com>2017-07-27 12:59:02 -0700
commit203b7f758c34bf38357ec770659713647585538e (patch)
tree57c423c405ce4f85eb2703fec5fa0a72aa45f4f1 /src/wasm/wasm.cpp
parentc8218452f1048449dff6c54a3f2d910538fe8f4e (diff)
parent96e9398420dd4612bc3f72ad8fedbcbc55e1577a (diff)
downloadbinaryen-203b7f758c34bf38357ec770659713647585538e.tar.gz
binaryen-203b7f758c34bf38357ec770659713647585538e.tar.bz2
binaryen-203b7f758c34bf38357ec770659713647585538e.zip
Merge pull request #1114 from WebAssembly/fuzz
Fuzz fixes
Diffstat (limited to 'src/wasm/wasm.cpp')
-rw-r--r--src/wasm/wasm.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp
index 4f5f46f0a..635d14354 100644
--- a/src/wasm/wasm.cpp
+++ b/src/wasm/wasm.cpp
@@ -109,18 +109,20 @@ struct TypeSeeker : public PostWalker<TypeSeeker> {
Name targetName;
std::vector<WasmType> types;
+
TypeSeeker(Expression* target, Name targetName) : target(target), targetName(targetName) {
Expression* temp = target;
walk(temp);
}
void visitBreak(Break* curr) {
- if (curr->name == targetName) {
+ if (curr->name == targetName && BranchUtils::isBranchTaken(curr)) {
types.push_back(curr->value ? curr->value->type : none);
}
}
void visitSwitch(Switch* curr) {
+ if (!BranchUtils::isBranchTaken(curr)) return;
for (auto name : curr->targets) {
if (name == targetName) types.push_back(curr->value ? curr->value->type : none);
}