mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 10:38:20 +00:00
Merge branch 'master' into topic/vern/lambda-copy-semantics
This commit is contained in:
commit
614fade0a4
68 changed files with 21745 additions and 252 deletions
83
src/Stmt.cc
83
src/Stmt.cc
|
@ -70,6 +70,30 @@ ForStmt* Stmt::AsForStmt()
|
|||
return (ForStmt*) this;
|
||||
}
|
||||
|
||||
const ForStmt* Stmt::AsForStmt() const
|
||||
{
|
||||
CHECK_TAG(tag, STMT_FOR, "Stmt::AsForStmt", stmt_name)
|
||||
return (const ForStmt*) this;
|
||||
}
|
||||
|
||||
const InitStmt* Stmt::AsInitStmt() const
|
||||
{
|
||||
CHECK_TAG(tag, STMT_INIT, "Stmt::AsInitStmt", stmt_name)
|
||||
return (const InitStmt*) this;
|
||||
}
|
||||
|
||||
const WhenStmt* Stmt::AsWhenStmt() const
|
||||
{
|
||||
CHECK_TAG(tag, STMT_WHEN, "Stmt::AsWhenStmt", stmt_name)
|
||||
return (const WhenStmt*) this;
|
||||
}
|
||||
|
||||
const SwitchStmt* Stmt::AsSwitchStmt() const
|
||||
{
|
||||
CHECK_TAG(tag, STMT_SWITCH, "Stmt::AsSwitchStmt", stmt_name)
|
||||
return (const SwitchStmt*) this;
|
||||
}
|
||||
|
||||
bool Stmt::SetLocationInfo(const Location* start, const Location* end)
|
||||
{
|
||||
if ( ! Obj::SetLocationInfo(start, end) )
|
||||
|
@ -111,6 +135,11 @@ bool Stmt::IsPure() const
|
|||
}
|
||||
|
||||
void Stmt::Describe(ODesc* d) const
|
||||
{
|
||||
StmtDescribe(d);
|
||||
}
|
||||
|
||||
void Stmt::StmtDescribe(ODesc* d) const
|
||||
{
|
||||
if ( ! d->IsReadable() || Tag() != STMT_EXPR )
|
||||
AddTag(d);
|
||||
|
@ -181,9 +210,9 @@ ValPtr ExprListStmt::Exec(Frame* f, StmtFlowType& flow) const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void ExprListStmt::Describe(ODesc* d) const
|
||||
void ExprListStmt::StmtDescribe(ODesc* d) const
|
||||
{
|
||||
Stmt::Describe(d);
|
||||
Stmt::StmtDescribe(d);
|
||||
l->Describe(d);
|
||||
DescribeDone(d);
|
||||
}
|
||||
|
@ -348,9 +377,9 @@ bool ExprStmt::IsPure() const
|
|||
return ! e || e->IsPure();
|
||||
}
|
||||
|
||||
void ExprStmt::Describe(ODesc* d) const
|
||||
void ExprStmt::StmtDescribe(ODesc* d) const
|
||||
{
|
||||
Stmt::Describe(d);
|
||||
Stmt::StmtDescribe(d);
|
||||
|
||||
if ( d->IsReadable() && Tag() == STMT_IF )
|
||||
d->Add("(");
|
||||
|
@ -425,9 +454,9 @@ bool IfStmt::IsPure() const
|
|||
return e->IsPure() && s1->IsPure() && s2->IsPure();
|
||||
}
|
||||
|
||||
void IfStmt::Describe(ODesc* d) const
|
||||
void IfStmt::StmtDescribe(ODesc* d) const
|
||||
{
|
||||
ExprStmt::Describe(d);
|
||||
ExprStmt::StmtDescribe(d);
|
||||
|
||||
d->PushIndent();
|
||||
s1->AccessStats(d);
|
||||
|
@ -895,9 +924,9 @@ bool SwitchStmt::IsPure() const
|
|||
return true;
|
||||
}
|
||||
|
||||
void SwitchStmt::Describe(ODesc* d) const
|
||||
void SwitchStmt::StmtDescribe(ODesc* d) const
|
||||
{
|
||||
ExprStmt::Describe(d);
|
||||
ExprStmt::StmtDescribe(d);
|
||||
|
||||
if ( ! d->IsBinary() )
|
||||
d->Add("{");
|
||||
|
@ -1048,9 +1077,9 @@ bool WhileStmt::IsPure() const
|
|||
return loop_condition->IsPure() && body->IsPure();
|
||||
}
|
||||
|
||||
void WhileStmt::Describe(ODesc* d) const
|
||||
void WhileStmt::StmtDescribe(ODesc* d) const
|
||||
{
|
||||
Stmt::Describe(d);
|
||||
Stmt::StmtDescribe(d);
|
||||
|
||||
if ( d->IsReadable() )
|
||||
d->Add("(");
|
||||
|
@ -1326,9 +1355,9 @@ bool ForStmt::IsPure() const
|
|||
return e->IsPure() && body->IsPure();
|
||||
}
|
||||
|
||||
void ForStmt::Describe(ODesc* d) const
|
||||
void ForStmt::StmtDescribe(ODesc* d) const
|
||||
{
|
||||
Stmt::Describe(d);
|
||||
Stmt::StmtDescribe(d);
|
||||
|
||||
if ( d->IsReadable() )
|
||||
d->Add("(");
|
||||
|
@ -1395,9 +1424,9 @@ bool NextStmt::IsPure() const
|
|||
return true;
|
||||
}
|
||||
|
||||
void NextStmt::Describe(ODesc* d) const
|
||||
void NextStmt::StmtDescribe(ODesc* d) const
|
||||
{
|
||||
Stmt::Describe(d);
|
||||
Stmt::StmtDescribe(d);
|
||||
Stmt::DescribeDone(d);
|
||||
}
|
||||
|
||||
|
@ -1422,9 +1451,9 @@ bool BreakStmt::IsPure() const
|
|||
return true;
|
||||
}
|
||||
|
||||
void BreakStmt::Describe(ODesc* d) const
|
||||
void BreakStmt::StmtDescribe(ODesc* d) const
|
||||
{
|
||||
Stmt::Describe(d);
|
||||
Stmt::StmtDescribe(d);
|
||||
Stmt::DescribeDone(d);
|
||||
}
|
||||
|
||||
|
@ -1449,9 +1478,9 @@ bool FallthroughStmt::IsPure() const
|
|||
return false;
|
||||
}
|
||||
|
||||
void FallthroughStmt::Describe(ODesc* d) const
|
||||
void FallthroughStmt::StmtDescribe(ODesc* d) const
|
||||
{
|
||||
Stmt::Describe(d);
|
||||
Stmt::StmtDescribe(d);
|
||||
Stmt::DescribeDone(d);
|
||||
}
|
||||
|
||||
|
@ -1519,9 +1548,9 @@ ValPtr ReturnStmt::Exec(Frame* f, StmtFlowType& flow) const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void ReturnStmt::Describe(ODesc* d) const
|
||||
void ReturnStmt::StmtDescribe(ODesc* d) const
|
||||
{
|
||||
Stmt::Describe(d);
|
||||
Stmt::StmtDescribe(d);
|
||||
if ( ! d->IsReadable() )
|
||||
d->Add(e != nullptr);
|
||||
|
||||
|
@ -1581,7 +1610,7 @@ bool StmtList::IsPure() const
|
|||
return true;
|
||||
}
|
||||
|
||||
void StmtList::Describe(ODesc* d) const
|
||||
void StmtList::StmtDescribe(ODesc* d) const
|
||||
{
|
||||
if ( ! d->IsReadable() )
|
||||
{
|
||||
|
@ -1657,7 +1686,7 @@ ValPtr EventBodyList::Exec(Frame* f, StmtFlowType& flow) const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void EventBodyList::Describe(ODesc* d) const
|
||||
void EventBodyList::StmtDescribe(ODesc* d) const
|
||||
{
|
||||
if ( d->IsReadable() && stmts.length() > 0 )
|
||||
{
|
||||
|
@ -1681,7 +1710,7 @@ void EventBodyList::Describe(ODesc* d) const
|
|||
}
|
||||
|
||||
else
|
||||
StmtList::Describe(d);
|
||||
StmtList::StmtDescribe(d);
|
||||
}
|
||||
|
||||
InitStmt::InitStmt(std::vector<IDPtr> arg_inits) : Stmt(STMT_INIT)
|
||||
|
@ -1724,7 +1753,7 @@ ValPtr InitStmt::Exec(Frame* f, StmtFlowType& flow) const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void InitStmt::Describe(ODesc* d) const
|
||||
void InitStmt::StmtDescribe(ODesc* d) const
|
||||
{
|
||||
AddTag(d);
|
||||
|
||||
|
@ -1769,7 +1798,7 @@ bool NullStmt::IsPure() const
|
|||
return true;
|
||||
}
|
||||
|
||||
void NullStmt::Describe(ODesc* d) const
|
||||
void NullStmt::StmtDescribe(ODesc* d) const
|
||||
{
|
||||
if ( d->IsReadable() )
|
||||
DescribeDone(d);
|
||||
|
@ -1831,9 +1860,9 @@ bool WhenStmt::IsPure() const
|
|||
return cond->IsPure() && s1->IsPure() && (! s2 || s2->IsPure());
|
||||
}
|
||||
|
||||
void WhenStmt::Describe(ODesc* d) const
|
||||
void WhenStmt::StmtDescribe(ODesc* d) const
|
||||
{
|
||||
Stmt::Describe(d);
|
||||
Stmt::StmtDescribe(d);
|
||||
|
||||
if ( d->IsReadable() )
|
||||
d->Add("(");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue