mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 15:48:19 +00:00
fix for deprecated when's where the inner frame is larger than the outer frame
This commit is contained in:
parent
19ba30d77a
commit
71d1022269
3 changed files with 20 additions and 1 deletions
14
src/Scope.cc
14
src/Scope.cc
|
@ -190,6 +190,20 @@ ScopePtr pop_scope()
|
|||
return old_top;
|
||||
}
|
||||
|
||||
void merge_top_scope()
|
||||
{
|
||||
if ( scopes.size() < 2 )
|
||||
reporter->InternalError("scope merge underflow");
|
||||
|
||||
auto t = pop_scope();
|
||||
|
||||
for ( auto v : t->OrderedVars() )
|
||||
{
|
||||
v->SetOffset(top_scope->Length());
|
||||
top_scope->Insert(v->Name(), v);
|
||||
}
|
||||
}
|
||||
|
||||
ScopePtr current_scope()
|
||||
{
|
||||
return top_scope;
|
||||
|
|
|
@ -92,6 +92,11 @@ extern void push_existing_scope(ScopePtr scope);
|
|||
|
||||
// Returns the one popped off.
|
||||
extern ScopePtr pop_scope();
|
||||
|
||||
// Merges the elements of the current scope with the one surrounding it,
|
||||
// popping it in the process.
|
||||
extern void merge_top_scope();
|
||||
|
||||
extern ScopePtr current_scope();
|
||||
extern ScopePtr global_scope();
|
||||
|
||||
|
|
|
@ -1893,7 +1893,7 @@ void WhenInfo::Build(StmtPtr ws)
|
|||
{
|
||||
if ( IsDeprecatedSemantics(ws) )
|
||||
{
|
||||
pop_scope();
|
||||
merge_top_scope();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue