diff --git a/src/ID.h b/src/ID.h index a051a9a47c..ba63c46a03 100644 --- a/src/ID.h +++ b/src/ID.h @@ -102,6 +102,11 @@ public: void AddAttrs(IntrusivePtr attr); void RemoveAttr(attr_tag a); void UpdateValAttrs(); + + const IntrusivePtr& GetAttrs() const + { return attrs; } + + [[deprecated("Remove in 4.1. Use GetAttrs().")]] Attributes* Attrs() const { return attrs.get(); } Attr* FindAttr(attr_tag t) const; diff --git a/src/Stmt.cc b/src/Stmt.cc index 0c2e3235d7..a163e6362e 100644 --- a/src/Stmt.cc +++ b/src/Stmt.cc @@ -1664,7 +1664,7 @@ IntrusivePtr InitStmt::Exec(Frame* f, stmt_flow_type& flow) const break; case TYPE_TABLE: v = make_intrusive(cast_intrusive(t), - IntrusivePtr{NewRef{}, aggr->Attrs()}); + aggr->GetAttrs()); break; default: break; diff --git a/src/Var.cc b/src/Var.cc index 590823587e..0665169abc 100644 --- a/src/Var.cc +++ b/src/Var.cc @@ -250,8 +250,8 @@ static void make_var(ID* id, IntrusivePtr t, init_class c, } else if ( t->Tag() == TYPE_TABLE ) - aggr = make_intrusive(IntrusivePtr{NewRef{}, t->AsTableType()}, - IntrusivePtr{NewRef{}, id->Attrs()}); + aggr = make_intrusive(cast_intrusive(t), + id->GetAttrs()); else if ( t->Tag() == TYPE_VECTOR ) aggr = make_intrusive(cast_intrusive(t)); @@ -326,7 +326,7 @@ IntrusivePtr add_local(IntrusivePtr id, IntrusivePtr t, *init->GetLocationInfo() : no_location; auto name_expr = make_intrusive(id, dt == VAR_CONST); - auto attrs = id->Attrs() ? id->Attrs()->Attrs() : nullptr; + auto attrs = id->GetAttrs() ? id->GetAttrs()->Attrs() : nullptr; auto assign_expr = make_intrusive(std::move(name_expr), std::move(init), 0, nullptr, attrs);