mirror of
https://github.com/zeek/zeek.git
synced 2025-10-13 03:58:20 +00:00
Reporter: Add ExprRuntimeWarning()
...and update Expr.cc invalidation messages to use it. This aligns the warning format to the one used by runtime errors.
This commit is contained in:
parent
0e97c29eb8
commit
a07b0c333f
4 changed files with 26 additions and 28 deletions
27
src/Expr.cc
27
src/Expr.cc
|
@ -274,14 +274,7 @@ void Expr::AssignToIndex(ValPtr v1, ValPtr v2, ValPtr v3) const
|
|||
iterators_invalidated);
|
||||
|
||||
if ( iterators_invalidated )
|
||||
{
|
||||
ODesc d;
|
||||
Describe(&d);
|
||||
reporter->PushLocation(GetLocationInfo());
|
||||
reporter->Warning("possible loop/iterator invalidation caused by expression: %s",
|
||||
d.Description());
|
||||
reporter->PopLocation();
|
||||
}
|
||||
reporter->ExprRuntimeWarning(this, "possible loop/iterator invalidation");
|
||||
|
||||
if ( error_msg )
|
||||
RuntimeErrorWithCallStack(error_msg);
|
||||
|
@ -2974,14 +2967,7 @@ void IndexExpr::Add(Frame* f)
|
|||
v1->AsTableVal()->Assign(std::move(v2), nullptr, true, &iterators_invalidated);
|
||||
|
||||
if ( iterators_invalidated )
|
||||
{
|
||||
ODesc d;
|
||||
Describe(&d);
|
||||
reporter->PushLocation(GetLocationInfo());
|
||||
reporter->Warning("possible loop/iterator invalidation caused by expression: %s",
|
||||
d.Description());
|
||||
reporter->PopLocation();
|
||||
}
|
||||
reporter->ExprRuntimeWarning(this, "possible loop/iterator invalidation");
|
||||
}
|
||||
|
||||
void IndexExpr::Delete(Frame* f)
|
||||
|
@ -3003,14 +2989,7 @@ void IndexExpr::Delete(Frame* f)
|
|||
v1->AsTableVal()->Remove(*v2, true, &iterators_invalidated);
|
||||
|
||||
if ( iterators_invalidated )
|
||||
{
|
||||
ODesc d;
|
||||
Describe(&d);
|
||||
reporter->PushLocation(GetLocationInfo());
|
||||
reporter->Warning("possible loop/iterator invalidation caused by expression: %s",
|
||||
d.Description());
|
||||
reporter->PopLocation();
|
||||
}
|
||||
reporter->ExprRuntimeWarning(this, "possible loop/iterator invalidation");
|
||||
}
|
||||
|
||||
ExprPtr IndexExpr::MakeLvalue()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue