diff options
Diffstat (limited to 'src/wasm-validator.h')
-rw-r--r-- | src/wasm-validator.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/wasm-validator.h b/src/wasm-validator.h index 24affdb44..2ec530476 100644 --- a/src/wasm-validator.h +++ b/src/wasm-validator.h @@ -72,8 +72,9 @@ struct WasmValidator : public PostWalker<WasmValidator> { BreakInfo(WasmType type, Index arity) : type(type), arity(arity) {} }; - std::map<Name, std::vector<Expression*>> breakTargets; // more than one block/loop may use a label name, so stack them + std::map<Name, Expression*> breakTargets; std::map<Expression*, BreakInfo> breakInfos; + std::set<Name> namedBreakTargets; // even breaks not taken must not be named if they go to a place that does not exist WasmType returnType = unreachable; // type used in returns @@ -105,14 +106,14 @@ public: static void visitPreBlock(WasmValidator* self, Expression** currp) { auto* curr = (*currp)->cast<Block>(); - if (curr->name.is()) self->breakTargets[curr->name].push_back(curr); + if (curr->name.is()) self->breakTargets[curr->name] = curr; } void visitBlock(Block *curr); static void visitPreLoop(WasmValidator* self, Expression** currp) { auto* curr = (*currp)->cast<Loop>(); - if (curr->name.is()) self->breakTargets[curr->name].push_back(curr); + if (curr->name.is()) self->breakTargets[curr->name] = curr; } void visitLoop(Loop *curr); |