Skip to content

Commit

Permalink
Rename constructor funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
theunrepentantgeek committed May 27, 2021
1 parent 3225c93 commit 7e05710
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions hack/generator/pkg/codegen/storage/storage_type_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 7e05710

Please sign in to comment.