mirror of
https://github.com/zeek/zeek.git
synced 2025-10-03 07:08:19 +00:00
Type: use class IntrusivePtr in TypeList
This commit is contained in:
parent
de0289125b
commit
73cea5dcad
13 changed files with 62 additions and 74 deletions
|
@ -173,9 +173,9 @@ void DNS_Mgr_mapping_delete_func(void* v)
|
||||||
|
|
||||||
static TableVal* empty_addr_set()
|
static TableVal* empty_addr_set()
|
||||||
{
|
{
|
||||||
BroType* addr_t = base_type(TYPE_ADDR);
|
IntrusivePtr<BroType> addr_t{AdoptRef{}, base_type(TYPE_ADDR)};
|
||||||
auto set_index = make_intrusive<TypeList>(addr_t);
|
auto set_index = make_intrusive<TypeList>(addr_t);
|
||||||
set_index->Append(addr_t);
|
set_index->Append(std::move(addr_t));
|
||||||
auto s = make_intrusive<SetType>(std::move(set_index), nullptr);
|
auto s = make_intrusive<SetType>(std::move(set_index), nullptr);
|
||||||
return new TableVal(std::move(s));
|
return new TableVal(std::move(s));
|
||||||
}
|
}
|
||||||
|
|
16
src/Expr.cc
16
src/Expr.cc
|
@ -3109,7 +3109,7 @@ TableConstructorExpr::TableConstructorExpr(IntrusivePtr<ListExpr> constructor_li
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( op->AsListExpr()->Exprs().empty() )
|
if ( op->AsListExpr()->Exprs().empty() )
|
||||||
SetType(make_intrusive<TableType>(make_intrusive<TypeList>(base_type(TYPE_ANY)), nullptr));
|
SetType(make_intrusive<TableType>(make_intrusive<TypeList>(IntrusivePtr{AdoptRef{}, base_type(TYPE_ANY)}), nullptr));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetType({AdoptRef{}, init_type(op.get())});
|
SetType({AdoptRef{}, init_type(op.get())});
|
||||||
|
@ -3223,7 +3223,7 @@ SetConstructorExpr::SetConstructorExpr(IntrusivePtr<ListExpr> constructor_list,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( op->AsListExpr()->Exprs().empty() )
|
if ( op->AsListExpr()->Exprs().empty() )
|
||||||
SetType(make_intrusive<::SetType>(make_intrusive<TypeList>(base_type(TYPE_ANY)), nullptr));
|
SetType(make_intrusive<::SetType>(make_intrusive<TypeList>(IntrusivePtr{AdoptRef{}, base_type(TYPE_ANY)}), nullptr));
|
||||||
else
|
else
|
||||||
SetType({AdoptRef{}, init_type(op.get())});
|
SetType({AdoptRef{}, init_type(op.get())});
|
||||||
}
|
}
|
||||||
|
@ -3841,7 +3841,7 @@ FlattenExpr::FlattenExpr(IntrusivePtr<Expr> arg_op)
|
||||||
auto tl = make_intrusive<TypeList>();
|
auto tl = make_intrusive<TypeList>();
|
||||||
|
|
||||||
for ( int i = 0; i < num_fields; ++i )
|
for ( int i = 0; i < num_fields; ++i )
|
||||||
tl->Append(rt->FieldType(i)->Ref());
|
tl->Append({NewRef{}, rt->FieldType(i)});
|
||||||
|
|
||||||
Unref(rt);
|
Unref(rt);
|
||||||
SetType(std::move(tl));
|
SetType(std::move(tl));
|
||||||
|
@ -4481,7 +4481,7 @@ ListExpr::~ListExpr()
|
||||||
void ListExpr::Append(IntrusivePtr<Expr> e)
|
void ListExpr::Append(IntrusivePtr<Expr> e)
|
||||||
{
|
{
|
||||||
exprs.push_back(e.release());
|
exprs.push_back(e.release());
|
||||||
((TypeList*) type.get())->Append(exprs.back()->Type()->Ref());
|
((TypeList*) type.get())->Append({NewRef{}, exprs.back()->Type()});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ListExpr::IsPure() const
|
bool ListExpr::IsPure() const
|
||||||
|
@ -4568,12 +4568,12 @@ IntrusivePtr<BroType> ListExpr::InitType() const
|
||||||
|
|
||||||
if ( ! til->IsPure() ||
|
if ( ! til->IsPure() ||
|
||||||
! til->AllMatch(til->PureType(), 1) )
|
! til->AllMatch(til->PureType(), 1) )
|
||||||
tl->Append(til->Ref());
|
tl->Append({NewRef{}, til});
|
||||||
else
|
else
|
||||||
tl->Append(til->PureType()->Ref());
|
tl->Append({NewRef{}, til->PureType()});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
tl->Append(ti->Ref());
|
tl->Append({NewRef{}, ti});
|
||||||
}
|
}
|
||||||
|
|
||||||
return tl;
|
return tl;
|
||||||
|
@ -5121,7 +5121,7 @@ int check_and_promote_args(ListExpr* const args, RecordType* types)
|
||||||
TypeList* tl = new TypeList();
|
TypeList* tl = new TypeList();
|
||||||
|
|
||||||
for ( int i = 0; i < types->NumFields(); ++i )
|
for ( int i = 0; i < types->NumFields(); ++i )
|
||||||
tl->Append(types->FieldType(i)->Ref());
|
tl->Append({NewRef{}, types->FieldType(i)});
|
||||||
|
|
||||||
int rval = check_and_promote_exprs(args, tl);
|
int rval = check_and_promote_exprs(args, tl);
|
||||||
Unref(tl);
|
Unref(tl);
|
||||||
|
|
|
@ -793,8 +793,8 @@ bool BloomFilterVal::Typify(BroType* arg_type)
|
||||||
type = arg_type;
|
type = arg_type;
|
||||||
type->Ref();
|
type->Ref();
|
||||||
|
|
||||||
auto tl = make_intrusive<TypeList>(type);
|
auto tl = make_intrusive<TypeList>(IntrusivePtr{NewRef{}, type});
|
||||||
tl->Append(type->Ref());
|
tl->Append({NewRef{}, type});
|
||||||
hash = new CompositeHash(std::move(tl));
|
hash = new CompositeHash(std::move(tl));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -963,8 +963,8 @@ bool CardinalityVal::Typify(BroType* arg_type)
|
||||||
type = arg_type;
|
type = arg_type;
|
||||||
type->Ref();
|
type->Ref();
|
||||||
|
|
||||||
auto tl = make_intrusive<TypeList>(type);
|
auto tl = make_intrusive<TypeList>(IntrusivePtr{NewRef{}, type});
|
||||||
tl->Append(type->Ref());
|
tl->Append({NewRef{}, type});
|
||||||
hash = new CompositeHash(std::move(tl));
|
hash = new CompositeHash(std::move(tl));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -145,8 +145,8 @@ RuleConditionEval::RuleConditionEval(const char* func)
|
||||||
rules_error("eval function type must yield a 'bool'", func);
|
rules_error("eval function type must yield a 'bool'", func);
|
||||||
|
|
||||||
TypeList tl;
|
TypeList tl;
|
||||||
tl.Append(internal_type("signature_state")->Ref());
|
tl.Append({NewRef{}, internal_type("signature_state")});
|
||||||
tl.Append(base_type(TYPE_STRING));
|
tl.Append({AdoptRef{}, base_type(TYPE_STRING)});
|
||||||
|
|
||||||
if ( ! f->CheckArgs(tl.Types()) )
|
if ( ! f->CheckArgs(tl.Types()) )
|
||||||
rules_error("eval function parameters must be a 'signature_state' "
|
rules_error("eval function parameters must be a 'signature_state' "
|
||||||
|
|
|
@ -587,7 +587,7 @@ static void int_del_func(void* v)
|
||||||
void SwitchStmt::Init()
|
void SwitchStmt::Init()
|
||||||
{
|
{
|
||||||
auto t = make_intrusive<TypeList>();
|
auto t = make_intrusive<TypeList>();
|
||||||
t->Append(e->Type()->Ref());
|
t->Append({NewRef{}, e->Type()});
|
||||||
comp_hash = new CompositeHash(std::move(t));
|
comp_hash = new CompositeHash(std::move(t));
|
||||||
|
|
||||||
case_label_value_map.SetDeleteFunc(int_del_func);
|
case_label_value_map.SetDeleteFunc(int_del_func);
|
||||||
|
|
45
src/Type.cc
45
src/Type.cc
|
@ -155,8 +155,6 @@ TypeList::~TypeList()
|
||||||
{
|
{
|
||||||
for ( const auto& type : types )
|
for ( const auto& type : types )
|
||||||
Unref(type);
|
Unref(type);
|
||||||
|
|
||||||
Unref(pure_type);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int TypeList::AllMatch(const BroType* t, int is_init) const
|
int TypeList::AllMatch(const BroType* t, int is_init) const
|
||||||
|
@ -167,23 +165,20 @@ int TypeList::AllMatch(const BroType* t, int is_init) const
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TypeList::Append(BroType* t)
|
void TypeList::Append(IntrusivePtr<BroType> t)
|
||||||
{
|
{
|
||||||
if ( pure_type && ! same_type(t, pure_type) )
|
if ( pure_type && ! same_type(t.get(), pure_type.get()) )
|
||||||
reporter->InternalError("pure type-list violation");
|
reporter->InternalError("pure type-list violation");
|
||||||
|
|
||||||
types.push_back(t);
|
types.push_back(t.release());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TypeList::AppendEvenIfNotPure(BroType* t)
|
void TypeList::AppendEvenIfNotPure(IntrusivePtr<BroType> t)
|
||||||
{
|
{
|
||||||
if ( pure_type && ! same_type(t, pure_type) )
|
if ( pure_type && ! same_type(t.get(), pure_type.get()) )
|
||||||
{
|
|
||||||
Unref(pure_type);
|
|
||||||
pure_type = 0;
|
pure_type = 0;
|
||||||
}
|
|
||||||
|
|
||||||
types.push_back(t);
|
types.push_back(t.release());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TypeList::Describe(ODesc* d) const
|
void TypeList::Describe(ODesc* d) const
|
||||||
|
@ -368,7 +363,7 @@ TypeList* TableType::ExpandRecordIndex(RecordType* rt) const
|
||||||
for ( int i = 0; i < n; ++i )
|
for ( int i = 0; i < n; ++i )
|
||||||
{
|
{
|
||||||
TypeDecl* td = rt->FieldDecl(i);
|
TypeDecl* td = rt->FieldDecl(i);
|
||||||
tl->Append(td->type->Ref());
|
tl->Append({NewRef{}, td->type});
|
||||||
}
|
}
|
||||||
|
|
||||||
return tl;
|
return tl;
|
||||||
|
@ -396,21 +391,17 @@ SetType::SetType(IntrusivePtr<TypeList> ind, IntrusivePtr<ListExpr> arg_elements
|
||||||
|
|
||||||
else if ( tl->length() == 1 )
|
else if ( tl->length() == 1 )
|
||||||
{
|
{
|
||||||
BroType* t = flatten_type((*tl)[0]->Ref());
|
IntrusivePtr<BroType> t{AdoptRef{}, flatten_type((*tl)[0]->Ref())};
|
||||||
indices = make_intrusive<TypeList>(t);
|
indices = make_intrusive<TypeList>(t);
|
||||||
indices->Append(t->Ref());
|
indices->Append(std::move(t));
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BroType* t = merge_types((*tl)[0], (*tl)[1]);
|
IntrusivePtr<BroType> t{AdoptRef{}, merge_types((*tl)[0], (*tl)[1])};
|
||||||
|
|
||||||
for ( int i = 2; t && i < tl->length(); ++i )
|
for ( int i = 2; t && i < tl->length(); ++i )
|
||||||
{
|
t = {AdoptRef{}, merge_types(t.get(), (*tl)[i])};
|
||||||
BroType* t_new = merge_types(t, (*tl)[i]);
|
|
||||||
Unref(t);
|
|
||||||
t = t_new;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ! t )
|
if ( ! t )
|
||||||
{
|
{
|
||||||
|
@ -419,7 +410,7 @@ SetType::SetType(IntrusivePtr<TypeList> ind, IntrusivePtr<ListExpr> arg_elements
|
||||||
}
|
}
|
||||||
|
|
||||||
indices = make_intrusive<TypeList>(t);
|
indices = make_intrusive<TypeList>(t);
|
||||||
indices->Append(t);
|
indices->Append(std::move(t));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -457,7 +448,7 @@ FuncType::FuncType(RecordType* arg_args, BroType* arg_yield, function_flavor arg
|
||||||
args->Error(err_str);
|
args->Error(err_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
arg_types->Append(args->FieldType(i)->Ref());
|
arg_types->Append({NewRef{}, args->FieldType(i)});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1832,11 +1823,11 @@ BroType* merge_types(const BroType* t1, const BroType* t2)
|
||||||
|
|
||||||
loop_over_list(*tl1, i)
|
loop_over_list(*tl1, i)
|
||||||
{
|
{
|
||||||
BroType* tl3_i = merge_types((*tl1)[i], (*tl2)[i]);
|
IntrusivePtr<BroType> tl3_i{AdoptRef{}, merge_types((*tl1)[i], (*tl2)[i])};
|
||||||
if ( ! tl3_i )
|
if ( ! tl3_i )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
tl3->Append(tl3_i);
|
tl3->Append(std::move(tl3_i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1952,7 +1943,7 @@ BroType* merge_types(const BroType* t1, const BroType* t2)
|
||||||
|
|
||||||
TypeList* tl3 = new TypeList();
|
TypeList* tl3 = new TypeList();
|
||||||
loop_over_list(*l1, i)
|
loop_over_list(*l1, i)
|
||||||
tl3->Append(merge_types((*l1)[i], (*l2)[i]));
|
tl3->Append({AdoptRef{}, merge_types((*l1)[i], (*l2)[i])});
|
||||||
|
|
||||||
return tl3;
|
return tl3;
|
||||||
}
|
}
|
||||||
|
@ -2105,8 +2096,8 @@ BroType* init_type(Expr* init)
|
||||||
// it one, as that's what's required for creating a set type.
|
// it one, as that's what's required for creating a set type.
|
||||||
if ( t->Tag() != TYPE_LIST )
|
if ( t->Tag() != TYPE_LIST )
|
||||||
{
|
{
|
||||||
auto tl = make_intrusive<TypeList>(t.get()->Ref());
|
auto tl = make_intrusive<TypeList>(t);
|
||||||
tl->Append(t.release());
|
tl->Append(std::move(t));
|
||||||
t = std::move(tl);
|
t = std::move(tl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
15
src/Type.h
15
src/Type.h
|
@ -347,11 +347,8 @@ private:
|
||||||
|
|
||||||
class TypeList : public BroType {
|
class TypeList : public BroType {
|
||||||
public:
|
public:
|
||||||
explicit TypeList(BroType* arg_pure_type = 0) : BroType(TYPE_LIST)
|
explicit TypeList(IntrusivePtr<BroType> arg_pure_type = nullptr) : BroType(TYPE_LIST), pure_type(std::move(arg_pure_type))
|
||||||
{
|
{
|
||||||
pure_type = arg_pure_type;
|
|
||||||
if ( pure_type )
|
|
||||||
pure_type->Ref();
|
|
||||||
}
|
}
|
||||||
~TypeList() override;
|
~TypeList() override;
|
||||||
|
|
||||||
|
@ -362,23 +359,23 @@ public:
|
||||||
|
|
||||||
// Returns the underlying pure type, or nil if the list
|
// Returns the underlying pure type, or nil if the list
|
||||||
// is not pure or is empty.
|
// is not pure or is empty.
|
||||||
BroType* PureType() { return pure_type; }
|
BroType* PureType() { return pure_type.get(); }
|
||||||
const BroType* PureType() const { return pure_type; }
|
const BroType* PureType() const { return pure_type.get(); }
|
||||||
|
|
||||||
// True if all of the types match t, false otherwise. If
|
// True if all of the types match t, false otherwise. If
|
||||||
// is_init is true, then the matching is done in the context
|
// is_init is true, then the matching is done in the context
|
||||||
// of an initialization.
|
// of an initialization.
|
||||||
int AllMatch(const BroType* t, int is_init) const;
|
int AllMatch(const BroType* t, int is_init) const;
|
||||||
|
|
||||||
void Append(BroType* t);
|
void Append(IntrusivePtr<BroType> t);
|
||||||
void AppendEvenIfNotPure(BroType* t);
|
void AppendEvenIfNotPure(IntrusivePtr<BroType> t);
|
||||||
|
|
||||||
void Describe(ODesc* d) const override;
|
void Describe(ODesc* d) const override;
|
||||||
|
|
||||||
unsigned int MemoryAllocation() const override;
|
unsigned int MemoryAllocation() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
BroType* pure_type;
|
IntrusivePtr<BroType> pure_type;
|
||||||
type_list types;
|
type_list types;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1185,7 +1185,7 @@ IntrusivePtr<Val> PatternVal::DoClone(CloneState* state)
|
||||||
}
|
}
|
||||||
|
|
||||||
ListVal::ListVal(TypeTag t)
|
ListVal::ListVal(TypeTag t)
|
||||||
: Val(new TypeList(t == TYPE_ANY ? 0 : base_type_no_ref(t)))
|
: Val(new TypeList({NewRef{}, t == TYPE_ANY ? 0 : base_type_no_ref(t)}))
|
||||||
{
|
{
|
||||||
tag = t;
|
tag = t;
|
||||||
}
|
}
|
||||||
|
@ -1226,7 +1226,7 @@ void ListVal::Append(Val* v)
|
||||||
}
|
}
|
||||||
|
|
||||||
vals.push_back(v);
|
vals.push_back(v);
|
||||||
type->AsTypeList()->Append(v->Type()->Ref());
|
type->AsTypeList()->Append({NewRef{}, v->Type()});
|
||||||
}
|
}
|
||||||
|
|
||||||
TableVal* ListVal::ConvertToSet() const
|
TableVal* ListVal::ConvertToSet() const
|
||||||
|
@ -1234,8 +1234,8 @@ TableVal* ListVal::ConvertToSet() const
|
||||||
if ( tag == TYPE_ANY )
|
if ( tag == TYPE_ANY )
|
||||||
Internal("conversion of heterogeneous list to set");
|
Internal("conversion of heterogeneous list to set");
|
||||||
|
|
||||||
auto set_index = make_intrusive<TypeList>(type->AsTypeList()->PureType());
|
auto set_index = make_intrusive<TypeList>(IntrusivePtr{NewRef{}, type->AsTypeList()->PureType()});
|
||||||
set_index->Append(base_type(tag));
|
set_index->Append({AdoptRef{}, base_type(tag)});
|
||||||
auto s = make_intrusive<SetType>(std::move(set_index), nullptr);
|
auto s = make_intrusive<SetType>(std::move(set_index), nullptr);
|
||||||
TableVal* t = new TableVal(std::move(s));
|
TableVal* t = new TableVal(std::move(s));
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,8 @@ static void analyzer_del_func(void* v)
|
||||||
AnalyzerSet::AnalyzerSet(File* arg_file) : file(arg_file)
|
AnalyzerSet::AnalyzerSet(File* arg_file) : file(arg_file)
|
||||||
{
|
{
|
||||||
auto t = make_intrusive<TypeList>();
|
auto t = make_intrusive<TypeList>();
|
||||||
t->Append(file_mgr->GetTagEnumType()->Ref());
|
t->Append({NewRef{}, file_mgr->GetTagEnumType()});
|
||||||
t->Append(BifType::Record::Files::AnalyzerArgs->Ref());
|
t->Append({NewRef{}, BifType::Record::Files::AnalyzerArgs});
|
||||||
analyzer_hash = new CompositeHash(std::move(t));
|
analyzer_hash = new CompositeHash(std::move(t));
|
||||||
analyzer_map.SetDeleteFunc(analyzer_del_func);
|
analyzer_map.SetDeleteFunc(analyzer_del_func);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,8 +23,8 @@ using namespace file_analysis;
|
||||||
|
|
||||||
static Val* empty_connection_table()
|
static Val* empty_connection_table()
|
||||||
{
|
{
|
||||||
auto tbl_index = make_intrusive<TypeList>(conn_id);
|
auto tbl_index = make_intrusive<TypeList>(IntrusivePtr{NewRef{}, conn_id});
|
||||||
tbl_index->Append(conn_id->Ref());
|
tbl_index->Append({NewRef{}, conn_id});
|
||||||
auto tbl_type = make_intrusive<TableType>(std::move(tbl_index), IntrusivePtr{NewRef{}, connection_type});
|
auto tbl_type = make_intrusive<TableType>(std::move(tbl_index), IntrusivePtr{NewRef{}, connection_type});
|
||||||
return new TableVal(std::move(tbl_type));
|
return new TableVal(std::move(tbl_type));
|
||||||
}
|
}
|
||||||
|
|
|
@ -2377,8 +2377,8 @@ Val* Manager::ValueToVal(const Stream* i, const Value* val, BroType* request_typ
|
||||||
{
|
{
|
||||||
// all entries have to have the same type...
|
// all entries have to have the same type...
|
||||||
BroType* type = request_type->AsTableType()->Indices()->PureType();
|
BroType* type = request_type->AsTableType()->Indices()->PureType();
|
||||||
auto set_index = make_intrusive<TypeList>(type->Ref());
|
auto set_index = make_intrusive<TypeList>(IntrusivePtr{NewRef{}, type});
|
||||||
set_index->Append(type->Ref());
|
set_index->Append({NewRef{}, type});
|
||||||
auto s = make_intrusive<SetType>(std::move(set_index), nullptr);
|
auto s = make_intrusive<SetType>(std::move(set_index), nullptr);
|
||||||
TableVal* t = new TableVal(std::move(s));
|
TableVal* t = new TableVal(std::move(s));
|
||||||
for ( int j = 0; j < val->val.set_val.size; j++ )
|
for ( int j = 0; j < val->val.set_val.size; j++ )
|
||||||
|
@ -2534,7 +2534,7 @@ Val* Manager::ValueToVal(const Stream* i, const Value* val, bool& have_error) co
|
||||||
if ( stag == TYPE_VOID )
|
if ( stag == TYPE_VOID )
|
||||||
TypeTag stag = val->val.set_val.vals[0]->type;
|
TypeTag stag = val->val.set_val.vals[0]->type;
|
||||||
|
|
||||||
BroType* index_type;
|
IntrusivePtr<BroType> index_type;
|
||||||
|
|
||||||
if ( stag == TYPE_ENUM )
|
if ( stag == TYPE_ENUM )
|
||||||
{
|
{
|
||||||
|
@ -2552,13 +2552,13 @@ Val* Manager::ValueToVal(const Stream* i, const Value* val, bool& have_error) co
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
index_type = enum_id->Type()->AsEnumType();
|
index_type = {NewRef{}, enum_id->Type()->AsEnumType()};
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
index_type = base_type_no_ref(stag);
|
index_type = {NewRef{}, base_type_no_ref(stag)};
|
||||||
|
|
||||||
set_index = make_intrusive<TypeList>(index_type);
|
set_index = make_intrusive<TypeList>(index_type);
|
||||||
set_index->Append(index_type->Ref());
|
set_index->Append(std::move(index_type));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto s = make_intrusive<SetType>(std::move(set_index), nullptr);
|
auto s = make_intrusive<SetType>(std::move(set_index), nullptr);
|
||||||
|
|
|
@ -1027,11 +1027,11 @@ type:
|
||||||
|
|
||||||
type_list:
|
type_list:
|
||||||
type_list ',' type
|
type_list ',' type
|
||||||
{ $1->AppendEvenIfNotPure($3); }
|
{ $1->AppendEvenIfNotPure({AdoptRef{}, $3}); }
|
||||||
| type
|
| type
|
||||||
{
|
{
|
||||||
$$ = new TypeList($1);
|
$$ = new TypeList({NewRef{}, $1});
|
||||||
$$->Append($1);
|
$$->Append({AdoptRef{}, $1});
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,8 @@ void TopkVal::Typify(BroType* t)
|
||||||
{
|
{
|
||||||
assert(!hash && !type);
|
assert(!hash && !type);
|
||||||
type = t->Ref();
|
type = t->Ref();
|
||||||
auto tl = make_intrusive<TypeList>(t);
|
auto tl = make_intrusive<TypeList>(IntrusivePtr{NewRef{}, t});
|
||||||
tl->Append(t->Ref());
|
tl->Append({NewRef{}, t});
|
||||||
hash = new CompositeHash(std::move(tl));
|
hash = new CompositeHash(std::move(tl));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,8 +199,8 @@ VectorVal* TopkVal::GetTopK(int k) const // returns vector
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TypeList* vector_index = new TypeList(type);
|
TypeList* vector_index = new TypeList({NewRef{}, type});
|
||||||
vector_index->Append(type->Ref());
|
vector_index->Append({NewRef{}, type});
|
||||||
VectorType* v = new VectorType(vector_index);
|
VectorType* v = new VectorType(vector_index);
|
||||||
VectorVal* t = new VectorVal(v);
|
VectorVal* t = new VectorVal(v);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue