mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 02:28:21 +00:00
Fix for nested "when" statements leading to confusion over scoping
This commit is contained in:
parent
0b217e0e76
commit
a1d25670fc
3 changed files with 25 additions and 14 deletions
14
src/Var.cc
14
src/Var.cc
|
@ -767,7 +767,6 @@ class OuterIDBindingFinder : public TraversalCallback
|
|||
public:
|
||||
OuterIDBindingFinder(ScopePtr s) { scopes.emplace_back(s); }
|
||||
|
||||
TraversalCode PreStmt(const Stmt*) override;
|
||||
TraversalCode PreExpr(const Expr*) override;
|
||||
TraversalCode PostExpr(const Expr*) override;
|
||||
|
||||
|
@ -775,19 +774,6 @@ public:
|
|||
std::unordered_set<ID*> outer_id_references;
|
||||
};
|
||||
|
||||
TraversalCode OuterIDBindingFinder::PreStmt(const Stmt* stmt)
|
||||
{
|
||||
if ( stmt->Tag() != STMT_WHEN )
|
||||
return TC_CONTINUE;
|
||||
|
||||
auto ws = static_cast<const WhenStmt*>(stmt);
|
||||
|
||||
for ( auto& cl : ws->Info()->WhenExprLocals() )
|
||||
outer_id_references.insert(const_cast<ID*>(cl.get()));
|
||||
|
||||
return TC_ABORTSTMT;
|
||||
}
|
||||
|
||||
TraversalCode OuterIDBindingFinder::PreExpr(const Expr* expr)
|
||||
{
|
||||
if ( expr->Tag() == EXPR_LAMBDA )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue