use a subclass of TableType for incremental construction of compiled scripts

This commit is contained in:
Vern Paxson 2023-03-07 10:15:18 -08:00 committed by Arne Welzel
parent c0dd2b4e81
commit a934acc4f1
3 changed files with 17 additions and 12 deletions

View file

@ -16,6 +16,21 @@ using FuncValPtr = IntrusivePtr<zeek::FuncVal>;
namespace detail
{
// A version of TableType that allows us to first build a "stub" and
// then fill in its actual index & yield later - necessary for dealing
// with recursive types.
class CPPTableType : public TableType
{
public:
CPPTableType() : TableType(nullptr, nullptr){};
void SetIndexAndYield(TypeListPtr ind, TypePtr yield)
{
ind = std::move(indices);
yield_type = std::move(yield);
}
};
// An initialization hook for a collection of compiled-to-C++ functions
// (the result of a single invocation of the compiler on a set of scripts).
using CPP_init_func = void (*)();