mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 00:28:21 +00:00
state-holding fix: track unique identifiers for Func's in CompHash's, not Func's themselves
This commit is contained in:
parent
0235541a95
commit
323b919eef
4 changed files with 45 additions and 31 deletions
14
src/Func.h
14
src/Func.h
|
@ -61,9 +61,7 @@ public:
|
|||
BUILTIN_FUNC
|
||||
};
|
||||
|
||||
explicit Func(Kind arg_kind);
|
||||
|
||||
~Func() override;
|
||||
explicit Func(Kind arg_kind) : kind(arg_kind) { }
|
||||
|
||||
virtual bool IsPure() const = 0;
|
||||
FunctionFlavor Flavor() const { return GetType()->Flavor(); }
|
||||
|
@ -122,14 +120,8 @@ public:
|
|||
|
||||
virtual detail::TraversalCode Traverse(detail::TraversalCallback* cb) const;
|
||||
|
||||
uint32_t GetUniqueFuncID() const { return unique_id; }
|
||||
static const FuncPtr& GetFuncPtrByID(uint32_t id)
|
||||
{
|
||||
return id >= unique_ids.size() ? Func::nil : unique_ids[id];
|
||||
}
|
||||
|
||||
protected:
|
||||
Func();
|
||||
Func() = default;
|
||||
|
||||
// Copies this function's state into other.
|
||||
void CopyStateInto(Func* other) const;
|
||||
|
@ -140,10 +132,8 @@ protected:
|
|||
std::vector<Body> bodies;
|
||||
detail::ScopePtr scope;
|
||||
Kind kind = SCRIPT_FUNC;
|
||||
uint32_t unique_id = 0;
|
||||
FuncTypePtr type;
|
||||
std::string name;
|
||||
static inline std::vector<FuncPtr> unique_ids;
|
||||
};
|
||||
|
||||
namespace detail
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue