Skip to content

Commit 80fefcd

Browse files
committed
Remove use of Expr in naming
1 parent c76c25f commit 80fefcd

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

patchers/value/value.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
// }
1919
//
2020
// // Lets us return nil if we need to
21-
// func (v *customInt) ExprValue() any {
21+
// func (v *customInt) AnyValue() any {
2222
// return v.Int
2323
// }
2424
//
@@ -62,13 +62,13 @@ var ValueGetter = func() expr.Option {
6262
}
6363
}()
6464

65-
// A ExprValuer provides a generic function for a custom type to return standard go values.
65+
// A AnyValuer provides a generic function for a custom type to return standard go values.
6666
// It allows for returning a `nil` value but does not provide any type checking at expression compile.
6767
//
68-
// A custom type may implement both ExprValuer and a type specific interface to enable both
68+
// A custom type may implement both AnyValuer and a type specific interface to enable both
6969
// compile time checking and the ability to return a `nil` value.
70-
type ExprValuer interface {
71-
ExprValue() any
70+
type AnyValuer interface {
71+
AnyValue() any
7272
}
7373

7474
type IntValuer interface {
@@ -144,7 +144,7 @@ type MapValuer interface {
144144
}
145145

146146
var supportedInterfaces = []reflect.Type{
147-
reflect.TypeOf((*ExprValuer)(nil)).Elem(),
147+
reflect.TypeOf((*AnyValuer)(nil)).Elem(),
148148
reflect.TypeOf((*BoolValuer)(nil)).Elem(),
149149
reflect.TypeOf((*IntValuer)(nil)).Elem(),
150150
reflect.TypeOf((*Int8Valuer)(nil)).Elem(),
@@ -188,13 +188,13 @@ func (patcher) Visit(node *ast.Node) {
188188
}
189189

190190
func (patcher) ApplyOptions(c *conf.Config) {
191-
getExprValueFunc(c)
191+
getValueFunc(c)
192192
}
193193

194-
func getExprValue(params ...any) (any, error) {
194+
func getValue(params ...any) (any, error) {
195195
switch v := params[0].(type) {
196-
case ExprValuer:
197-
return v.ExprValue(), nil
196+
case AnyValuer:
197+
return v.AnyValue(), nil
198198
case BoolValuer:
199199
return v.BoolValue(), nil
200200
case IntValuer:
@@ -236,7 +236,7 @@ func getExprValue(params ...any) (any, error) {
236236
return params[0], nil
237237
}
238238

239-
var getExprValueFunc = expr.Function("$patcher_value_getter", getExprValue,
239+
var getValueFunc = expr.Function("$patcher_value_getter", getValue,
240240
new(func(BoolValuer) bool),
241241
new(func(IntValuer) int),
242242
new(func(Int8Valuer) int8),

patchers/value/value_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ func (v *customInt) IntValue() int {
1717
return v.Int
1818
}
1919

20-
func (v *customInt) ExprValue() any {
20+
func (v *customInt) AnyValue() any {
2121
return v.Int
2222
}
2323

@@ -33,7 +33,7 @@ type customUntypedInt struct {
3333
Int int
3434
}
3535

36-
func (v *customUntypedInt) ExprValue() any {
36+
func (v *customUntypedInt) AnyValue() any {
3737
return v.Int
3838
}
3939

@@ -45,7 +45,7 @@ func (v *customString) StringValue() string {
4545
return v.String
4646
}
4747

48-
func (v *customString) ExprValue() any {
48+
func (v *customString) AnyValue() any {
4949
return v.String
5050
}
5151

@@ -61,7 +61,7 @@ type customUntypedString struct {
6161
String string
6262
}
6363

64-
func (v *customUntypedString) ExprValue() any {
64+
func (v *customUntypedString) AnyValue() any {
6565
return v.String
6666
}
6767

0 commit comments

Comments
 (0)