From dc4962cc6710ff52733037987f105167bc821409 Mon Sep 17 00:00:00 2001 From: Alba Hita Catala Date: Wed, 18 Dec 2024 13:44:41 +0100 Subject: [PATCH] Remove unused code Signed-off-by: Alba Hita Catala --- pkg/generators/golang/json_generator.go | 11 ----------- pkg/generators/golang/types_generator.go | 7 ------- pkg/language/reader.go | 19 ++----------------- 3 files changed, 2 insertions(+), 35 deletions(-) diff --git a/pkg/generators/golang/json_generator.go b/pkg/generators/golang/json_generator.go index 76ad8a8..de6c314 100644 --- a/pkg/generators/golang/json_generator.go +++ b/pkg/generators/golang/json_generator.go @@ -173,17 +173,6 @@ func (g *JSONSupportGenerator) Run() error { } for _, typ := range version.Types() { for _, att := range typ.Attributes() { - // if att.Type().Owner().Name() != version.Name() || - // (att.Type().IsList() && att.Type().Element().Owner().Name() != version.Name()) { - // importRefs = append(importRefs, - // struct { - // path string - // selector string - // }{ - // path: g.packages.VersionImport(att.Type().Owner()), - // selector: g.packages.VersionSelector(att.Type().Owner()), - // }) - // } if att.LinkOwner() != nil { importRefs = append(importRefs, struct { diff --git a/pkg/generators/golang/types_generator.go b/pkg/generators/golang/types_generator.go index f62720c..652bbf0 100644 --- a/pkg/generators/golang/types_generator.go +++ b/pkg/generators/golang/types_generator.go @@ -707,10 +707,3 @@ func (g *TypesGenerator) listName(typ *concepts.Type) string { } return typeName + "List" } - -func (g *TypesGenerator) versionSelector(attribute *concepts.Attribute) string { - if attribute.LinkOwner() == nil { - return "" - } - return fmt.Sprintf("*%s.", g.packages.VersionSelector(attribute.LinkOwner())) -} diff --git a/pkg/language/reader.go b/pkg/language/reader.go index 9107f4d..07f2481 100644 --- a/pkg/language/reader.go +++ b/pkg/language/reader.go @@ -487,23 +487,8 @@ func (r *Reader) recursivelyAddTypeToVersion(currType *concepts.Type, } for _, attribute := range referencedType.Attributes() { if attribute.Link() { - // We need to check if the type was previously introduced - // in that case we would simply changes the owner of the attribue - // as we had already compiled it in this version. - // if attribute.Type().IsList() { - // if r.version.FindType(attribute.Type().Element().Name()) == nil { - // r.version.AddTypeWithoutOwner(attribute.Type()) - // r.version.AddTypeWithoutOwner(attribute.Type().Element()) - // } else { - // elementOwner := r.version.FindType(attribute.Type().Element().Name()).Owner() - // if attribute.Type().Owner() != elementOwner { - // attribute.Type().SetOwner(elementOwner) - // attribute.Type().Element().SetOwner(elementOwner) - // } - // } - // } else if r.version.FindType(attribute.Type().Name()) == nil { - // r.version.AddTypeWithoutOwner(attribute.Type()) - // } + // If the attribute is a Link set the LinkOwner + // to the attribute type Owner attribute.SetLinkOwner(attribute.Type().Owner()) } else if attribute.Type().IsList() || attribute.Type().IsMap() { r.version.AddType(attribute.Type())