From 4af1a26b1f37d764fe3cdd9ce95bbe2b408fd218 Mon Sep 17 00:00:00 2001 From: Jon Siwek Date: Thu, 7 May 2020 21:15:39 -0700 Subject: [PATCH] Add Val TypeType constructor taking an IntrusivePtr --- src/Expr.cc | 2 +- src/Val.h | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Expr.cc b/src/Expr.cc index 223c27da2a..3ff94d3242 100644 --- a/src/Expr.cc +++ b/src/Expr.cc @@ -233,7 +233,7 @@ IntrusivePtr NameExpr::Eval(Frame* f) const IntrusivePtr v; if ( id->IsType() ) - return make_intrusive(id->GetType().get(), true); + return make_intrusive(id->GetType(), true); if ( id->IsGlobal() ) v = {NewRef{}, id->ID_Val()}; diff --git a/src/Val.h b/src/Val.h index 455ae7b19c..eb81241c3a 100644 --- a/src/Val.h +++ b/src/Val.h @@ -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 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) { }