mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 01:28:20 +00:00
Type: use class IntrusivePtr in TypeType
This commit is contained in:
parent
184fb9a980
commit
dd74df9c5e
3 changed files with 5 additions and 8 deletions
|
@ -218,7 +218,7 @@ NameExpr::NameExpr(IntrusivePtr<ID> arg_id, bool const_init)
|
||||||
in_const_init = const_init;
|
in_const_init = const_init;
|
||||||
|
|
||||||
if ( id->AsType() )
|
if ( id->AsType() )
|
||||||
SetType(make_intrusive<TypeType>(id->AsType()));
|
SetType(make_intrusive<TypeType>(IntrusivePtr{NewRef{}, id->AsType()}));
|
||||||
else
|
else
|
||||||
SetType({NewRef{}, id->Type()});
|
SetType({NewRef{}, id->Type()});
|
||||||
|
|
||||||
|
|
|
@ -468,16 +468,13 @@ protected:
|
||||||
|
|
||||||
class TypeType : public BroType {
|
class TypeType : public BroType {
|
||||||
public:
|
public:
|
||||||
explicit TypeType(BroType* t) : BroType(TYPE_TYPE) { type = t->Ref(); }
|
explicit TypeType(IntrusivePtr<BroType> t) : BroType(TYPE_TYPE), type(std::move(t)) {}
|
||||||
TypeType* ShallowClone() override { return new TypeType(type); }
|
TypeType* ShallowClone() override { return new TypeType(type); }
|
||||||
~TypeType() override { Unref(type); }
|
|
||||||
|
|
||||||
BroType* Type() { return type; }
|
BroType* Type() { return type.get(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
TypeType() {}
|
IntrusivePtr<BroType> type;
|
||||||
|
|
||||||
BroType* type;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class TypeDecl {
|
class TypeDecl {
|
||||||
|
|
|
@ -141,7 +141,7 @@ public:
|
||||||
|
|
||||||
// Extra arg to differentiate from protected version.
|
// Extra arg to differentiate from protected version.
|
||||||
Val(BroType* t, bool type_type)
|
Val(BroType* t, bool type_type)
|
||||||
: type(new TypeType(t->Ref()))
|
: type(new TypeType({NewRef{}, t}))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue