From 9ab71508839188499c1265fbb7c697c044affdbb Mon Sep 17 00:00:00 2001 From: Jon Siwek Date: Wed, 6 May 2020 17:56:23 -0700 Subject: [PATCH] Deprecate SetType::SetElements(), replace with SetType::Elements() --- src/Type.h | 4 ++++ src/Var.cc | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) 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; } }