FuncInfo now tracks priority; some tidying/widening of its accessors

This commit is contained in:
Vern Paxson 2021-04-19 16:19:22 -07:00
parent 8d2bb28f03
commit 72f62f398a
3 changed files with 19 additions and 13 deletions

View file

@ -62,13 +62,15 @@ using ScriptFuncPtr = IntrusivePtr<ScriptFunc>;
// Info we need for tracking an instance of a function.
class FuncInfo {
public:
FuncInfo(ScriptFuncPtr _func, ScopePtr _scope, StmtPtr _body);
FuncInfo(ScriptFuncPtr func, ScopePtr scope, StmtPtr body, int priority);
ScriptFunc* Func() const { return func.get(); }
ScriptFuncPtr FuncPtr() const { return func; }
ScopePtr Scope() const { return scope; }
StmtPtr Body() const { return body; }
std::shared_ptr<ProfileFunc> Profile() const { return pf; }
ScriptFunc* Func() const { return func.get(); }
const ScriptFuncPtr& FuncPtr() const { return func; }
const ScopePtr& Scope() const { return scope; }
const StmtPtr& Body() const { return body; }
int Priority() const { return priority; }
const ProfileFunc* Profile() const { return pf.get(); }
std::shared_ptr<ProfileFunc> ProfilePtr() const { return pf; }
const std::string& SaveFile() const { return save_file; }
void SetBody(StmtPtr new_body) { body = std::move(new_body); }
@ -87,6 +89,7 @@ protected:
ScopePtr scope;
StmtPtr body;
std::shared_ptr<ProfileFunc> pf;
int priority;
// If we're saving this function in a file, this is the name
// of the file to use.