mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
support for rewriting script function bodies
This commit is contained in:
parent
63502e655f
commit
8f001062bf
2 changed files with 20 additions and 0 deletions
15
src/Func.cc
15
src/Func.cc
|
@ -503,6 +503,21 @@ void ScriptFunc::AddBody(StmtPtr new_body,
|
|||
sort(bodies.begin(), bodies.end());
|
||||
}
|
||||
|
||||
void ScriptFunc::ReplaceBody(const StmtPtr& old_body, StmtPtr new_body)
|
||||
{
|
||||
bool found_it = false;
|
||||
|
||||
for ( auto& body : bodies )
|
||||
if ( body.stmts.get() == old_body.get() )
|
||||
{
|
||||
body.stmts = new_body;
|
||||
found_it = true;
|
||||
}
|
||||
|
||||
ASSERT(found_it);
|
||||
current_body = new_body;
|
||||
}
|
||||
|
||||
void ScriptFunc::AddClosure(IDPList ids, Frame* f)
|
||||
{
|
||||
if ( ! f )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue