From 326c98ac3bff8dfc497053e8ace607361bfa22d2 Mon Sep 17 00:00:00 2001 From: Bevan Arps Date: Wed, 26 May 2021 15:03:38 +1200 Subject: [PATCH] Rename constructor funcs --- .../generator/pkg/codegen/storage/storage_type_factory.go | 4 ++-- .../pkg/conversions/property_assignment_function.go | 8 ++++---- .../pkg/conversions/property_assignment_function_test.go | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hack/generator/pkg/codegen/storage/storage_type_factory.go b/hack/generator/pkg/codegen/storage/storage_type_factory.go index 9383be5437d..5ae59329d55 100644 --- a/hack/generator/pkg/codegen/storage/storage_type_factory.go +++ b/hack/generator/pkg/codegen/storage/storage_type_factory.go @@ -166,12 +166,12 @@ func (f *StorageTypeFactory) injectConversions(definition astmodel.TypeDefinitio knownTypes.AddTypes(f.outputTypes) conversionContext := conversions.NewStorageConversionContext(knownTypes, f.idFactory) - convertFromFn, err := conversions.NewStorageConversionFromFunction(definition, nextDef, f.idFactory, conversionContext) + convertFromFn, err := conversions.NewPropertyAssignmentFromFunction(definition, nextDef, f.idFactory, conversionContext) if err != nil { return nil, errors.Wrapf(err, "creating ConvertFrom() function for %q", name) } - convertToFn, err := conversions.NewStorageConversionToFunction(definition, nextDef, f.idFactory, conversionContext) + convertToFn, err := conversions.NewPropertyAssignmentToFunction(definition, nextDef, f.idFactory, conversionContext) if err != nil { return nil, errors.Wrapf(err, "creating ConvertTo() function for %q", name) } diff --git a/hack/generator/pkg/conversions/property_assignment_function.go b/hack/generator/pkg/conversions/property_assignment_function.go index b5d9956c790..898c158a9f8 100644 --- a/hack/generator/pkg/conversions/property_assignment_function.go +++ b/hack/generator/pkg/conversions/property_assignment_function.go @@ -48,8 +48,8 @@ type StoragePropertyConversion func( // Ensure that PropertyAssignmentFunction implements Function var _ astmodel.Function = &PropertyAssignmentFunction{} -// NewStorageConversionFromFunction creates a new PropertyAssignmentFunction to convert from the specified source -func NewStorageConversionFromFunction( +// NewPropertyAssignmentFromFunction creates a new PropertyAssignmentFunction to convert from the specified source +func NewPropertyAssignmentFromFunction( receiver astmodel.TypeDefinition, otherDefinition astmodel.TypeDefinition, idFactory astmodel.IdentifierFactory, @@ -75,8 +75,8 @@ func NewStorageConversionFromFunction( return result, nil } -// NewStorageConversionToFunction creates a new PropertyAssignmentFunction to convert to the specified destination -func NewStorageConversionToFunction( +// NewPropertyAssignmentToFunction creates a new PropertyAssignmentFunction to convert to the specified destination +func NewPropertyAssignmentToFunction( receiver astmodel.TypeDefinition, otherDefinition astmodel.TypeDefinition, idFactory astmodel.IdentifierFactory, diff --git a/hack/generator/pkg/conversions/property_assignment_function_test.go b/hack/generator/pkg/conversions/property_assignment_function_test.go index d452955130c..e9c05453f3a 100644 --- a/hack/generator/pkg/conversions/property_assignment_function_test.go +++ b/hack/generator/pkg/conversions/property_assignment_function_test.go @@ -173,10 +173,10 @@ func RunTestStorageConversionFunction_AsFunc(c *StorageConversionPropertyTestCas currentType, ok := astmodel.AsObjectType(c.currentObject.Type()) g.Expect(ok).To(BeTrue()) - convertFrom, errs := NewStorageConversionFromFunction(c.currentObject, c.otherObject, idFactory, conversionContext) + convertFrom, errs := NewPropertyAssignmentFromFunction(c.currentObject, c.otherObject, idFactory, conversionContext) g.Expect(errs).To(BeNil()) - convertTo, errs := NewStorageConversionToFunction(c.currentObject, c.otherObject, idFactory, conversionContext) + convertTo, errs := NewPropertyAssignmentToFunction(c.currentObject, c.otherObject, idFactory, conversionContext) g.Expect(errs).To(BeNil()) receiverDefinition := c.currentObject.WithType(currentType.WithFunction(convertFrom).WithFunction(convertTo))