Add Val TypeType constructor taking an IntrusivePtr

This commit is contained in:
Jon Siwek 2020-05-07 21:15:39 -07:00
parent 3f07c57523
commit 4af1a26b1f
2 changed files with 7 additions and 3 deletions

View file

@ -233,7 +233,7 @@ IntrusivePtr<Val> NameExpr::Eval(Frame* f) const
IntrusivePtr<Val> v;
if ( id->IsType() )
return make_intrusive<Val>(id->GetType().get(), true);
return make_intrusive<Val>(id->GetType(), true);
if ( id->IsGlobal() )
v = {NewRef{}, id->ID_Val()};

View file

@ -137,8 +137,12 @@ public:
explicit Val(BroFile* f);
// Extra arg to differentiate from protected version.
Val(BroType* t, bool type_type)
: type(new TypeType({NewRef{}, t}))
Val(IntrusivePtr<BroType> t, bool type_type)
: type(new TypeType(std::move(t)))
{ }
[[deprecated("Remove in v4.1. Construct from IntrusivePtr instead.")]]
Val(BroType* t, bool type_type) : Val({NewRef{}, t}, type_type)
{
}