mirror of
https://github.com/zeek/zeek.git
synced 2025-10-11 02:58:20 +00:00
GH-786: fix Stmt::As methods casting incomplete types
This commit is contained in:
parent
c8b6badd54
commit
5cba12444a
2 changed files with 21 additions and 16 deletions
18
src/Stmt.cc
18
src/Stmt.cc
|
@ -51,6 +51,24 @@ Stmt::~Stmt()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StmtList* Stmt::AsStmtList()
|
||||||
|
{
|
||||||
|
CHECK_TAG(tag, STMT_LIST, "Stmt::AsStmtList", stmt_name)
|
||||||
|
return (StmtList*) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
const StmtList* Stmt::AsStmtList() const
|
||||||
|
{
|
||||||
|
CHECK_TAG(tag, STMT_LIST, "Stmt::AsStmtList", stmt_name)
|
||||||
|
return (const StmtList*) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
ForStmt* Stmt::AsForStmt()
|
||||||
|
{
|
||||||
|
CHECK_TAG(tag, STMT_FOR, "Stmt::AsForStmt", stmt_name)
|
||||||
|
return (ForStmt*) this;
|
||||||
|
}
|
||||||
|
|
||||||
bool Stmt::SetLocationInfo(const Location* start, const Location* end)
|
bool Stmt::SetLocationInfo(const Location* start, const Location* end)
|
||||||
{
|
{
|
||||||
if ( ! BroObj::SetLocationInfo(start, end) )
|
if ( ! BroObj::SetLocationInfo(start, end) )
|
||||||
|
|
19
src/Stmt.h
19
src/Stmt.h
|
@ -40,23 +40,10 @@ public:
|
||||||
// True if the statement has no side effects, false otherwise.
|
// True if the statement has no side effects, false otherwise.
|
||||||
virtual bool IsPure() const;
|
virtual bool IsPure() const;
|
||||||
|
|
||||||
StmtList* AsStmtList()
|
StmtList* AsStmtList();
|
||||||
{
|
const StmtList* AsStmtList() const;
|
||||||
CHECK_TAG(tag, STMT_LIST, "Stmt::AsStmtList", stmt_name)
|
|
||||||
return (StmtList*) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
const StmtList* AsStmtList() const
|
ForStmt* AsForStmt();
|
||||||
{
|
|
||||||
CHECK_TAG(tag, STMT_LIST, "Stmt::AsStmtList", stmt_name)
|
|
||||||
return (const StmtList*) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
ForStmt* AsForStmt()
|
|
||||||
{
|
|
||||||
CHECK_TAG(tag, STMT_FOR, "Stmt::AsForStmt", stmt_name)
|
|
||||||
return (ForStmt*) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RegisterAccess() const { last_access = network_time; access_count++; }
|
void RegisterAccess() const { last_access = network_time; access_count++; }
|
||||||
void AccessStats(ODesc* d) const;
|
void AccessStats(ODesc* d) const;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue