@@ -11,16 +11,16 @@ import (
1111)
1212
1313// checkLengthArgs checks the argument expressions to length() and returns an
14- // error if there is not exactly one expression that results in a
15- // [spec.FuncValue]-compatible value.
14+ // error if there is not exactly one expression that results in a compatible
15+ // [spec.FuncValue] value.
1616func checkLengthArgs (fea []spec.FuncExprArg ) error {
1717 if len (fea ) != 1 {
1818 return fmt .Errorf ("expected 1 argument but found %v" , len (fea ))
1919 }
2020
2121 kind := fea [0 ].ResultType ()
22- if ! kind .ConvertsTo ( spec . FuncValue ) {
23- return errors .New ("cannot convert argument to ValueType " )
22+ if ! kind .ConvertsToValue ( ) {
23+ return errors .New ("cannot convert argument to Value " )
2424 }
2525
2626 return nil
@@ -64,8 +64,8 @@ func checkCountArgs(fea []spec.FuncExprArg) error {
6464 }
6565
6666 kind := fea [0 ].ResultType ()
67- if ! kind .ConvertsTo ( spec . FuncNodes ) {
68- return errors .New ("cannot convert argument to PathNodes " )
67+ if ! kind .ConvertsToNodes ( ) {
68+ return errors .New ("cannot convert argument to Nodes " )
6969 }
7070
7171 return nil
@@ -88,8 +88,8 @@ func checkValueArgs(fea []spec.FuncExprArg) error {
8888 }
8989
9090 kind := fea [0 ].ResultType ()
91- if ! kind .ConvertsTo ( spec . FuncNodes ) {
92- return errors .New ("cannot convert argument to PathNodes " )
91+ if ! kind .ConvertsToNodes ( ) {
92+ return errors .New ("cannot convert argument to Nodes " )
9393 }
9494
9595 return nil
@@ -109,8 +109,8 @@ func valueFunc(jv []spec.JSONPathValue) spec.JSONPathValue {
109109}
110110
111111// checkMatchArgs checks the argument expressions to match() and returns an
112- // error if there are not exactly two expressions that result in
113- // [spec.FuncValue]-compatible values.
112+ // error if there are not exactly two expressions that result in compatible
113+ // [spec.FuncValue] values.
114114func checkMatchArgs (fea []spec.FuncExprArg ) error {
115115 const matchArgLen = 2
116116 if len (fea ) != matchArgLen {
@@ -119,8 +119,8 @@ func checkMatchArgs(fea []spec.FuncExprArg) error {
119119
120120 for i , arg := range fea {
121121 kind := arg .ResultType ()
122- if ! kind .ConvertsTo ( spec . FuncValue ) {
123- return fmt .Errorf ("cannot convert argument %v to PathNodes " , i + 1 )
122+ if ! kind .ConvertsToValue ( ) {
123+ return fmt .Errorf ("cannot convert argument %v to Value " , i + 1 )
124124 }
125125 }
126126
@@ -144,8 +144,8 @@ func matchFunc(jv []spec.JSONPathValue) spec.JSONPathValue {
144144}
145145
146146// checkSearchArgs checks the argument expressions to search() and returns an
147- // error if there are not exactly two expressions that result in
148- // [spec.FuncValue]-compatible values.
147+ // error if there are not exactly two expressions that result in compatible
148+ // [spec.FuncValue] values.
149149func checkSearchArgs (fea []spec.FuncExprArg ) error {
150150 const searchArgLen = 2
151151 if len (fea ) != searchArgLen {
@@ -154,8 +154,8 @@ func checkSearchArgs(fea []spec.FuncExprArg) error {
154154
155155 for i , arg := range fea {
156156 kind := arg .ResultType ()
157- if ! kind .ConvertsTo ( spec . FuncValue ) {
158- return fmt .Errorf ("cannot convert argument %v to PathNodes " , i + 1 )
157+ if ! kind .ConvertsToValue ( ) {
158+ return fmt .Errorf ("cannot convert argument %v to Value " , i + 1 )
159159 }
160160 }
161161
0 commit comments