mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 10:38:20 +00:00
track current script body's priority as well as its AST
This commit is contained in:
parent
00d66f1ac2
commit
3796e2508b
2 changed files with 8 additions and 4 deletions
|
@ -305,7 +305,7 @@ ScriptFunc::ScriptFunc(const IDPtr& arg_id, StmtPtr arg_body,
|
|||
Body b;
|
||||
b.stmts = AddInits(std::move(arg_body), aggr_inits);
|
||||
current_body = b.stmts;
|
||||
b.priority = priority;
|
||||
current_priority = b.priority = priority;
|
||||
bodies.push_back(b);
|
||||
}
|
||||
}
|
||||
|
@ -542,9 +542,8 @@ void ScriptFunc::AddBody(StmtPtr new_body,
|
|||
|
||||
Body b;
|
||||
b.stmts = new_body;
|
||||
b.priority = priority;
|
||||
|
||||
current_body = new_body;
|
||||
current_priority = b.priority = priority;
|
||||
|
||||
bodies.push_back(b);
|
||||
sort(bodies.begin(), bodies.end());
|
||||
|
@ -558,6 +557,7 @@ void ScriptFunc::ReplaceBody(const StmtPtr& old_body, StmtPtr new_body)
|
|||
if ( body.stmts.get() == old_body.get() )
|
||||
{
|
||||
body.stmts = new_body;
|
||||
current_priority = body.priority;
|
||||
found_it = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -239,6 +239,7 @@ public:
|
|||
detail::StmtPtr new_body);
|
||||
|
||||
StmtPtr CurrentBody() const { return current_body; }
|
||||
int CurrentPriority() const { return current_priority; }
|
||||
|
||||
/**
|
||||
* Returns the function's frame size.
|
||||
|
@ -307,8 +308,11 @@ private:
|
|||
|
||||
OffsetMap* captures_offset_mapping = nullptr;
|
||||
|
||||
// The most recently added/updated body.
|
||||
// The most recently added/updated body ...
|
||||
StmtPtr current_body;
|
||||
|
||||
// ... and its priority.
|
||||
int current_priority;
|
||||
};
|
||||
|
||||
using built_in_func = BifReturnVal (*)(Frame* frame, const Args* args);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue