diff --git a/src/Type.h b/src/Type.h index 24a3e181b0..2b077146e4 100644 --- a/src/Type.h +++ b/src/Type.h @@ -429,8 +429,12 @@ public: IntrusivePtr ShallowClone() override; + [[deprecated("Remove in v4.1. Use Elements() isntead.")]] ListExpr* SetElements() const { return elements.get(); } + const IntrusivePtr& Elements() const + { return elements; } + protected: IntrusivePtr elements; }; diff --git a/src/Var.cc b/src/Var.cc index 8fc1214755..9ca437a5e2 100644 --- a/src/Var.cc +++ b/src/Var.cc @@ -162,7 +162,7 @@ static void make_var(ID* id, IntrusivePtr t, init_class c, if ( t && t->IsSet() ) { // Check for set with explicit elements. SetType* st = t->AsTableType()->AsSetType(); - ListExpr* elements = st->SetElements(); + const auto& elements = st->Elements(); if ( elements ) { @@ -172,7 +172,7 @@ static void make_var(ID* id, IntrusivePtr t, init_class c, return; } - init = {NewRef{}, elements}; + init = elements; } }