Skip to content

Commit ac67e0a

Browse files
committed
Consistently reference PathQuery as q
1 parent deb33ef commit ac67e0a

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

spec/function_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -433,13 +433,13 @@ func TestFilterQuery(t *testing.T) {
433433
t.Parallel()
434434
a := assert.New(t)
435435

436-
fq := tc.query
437-
a.Equal(tc.typeKind, fq.ResultType())
438-
a.Equal(NodesType(tc.exp), fq.evaluate(tc.current, tc.root))
439-
a.Equal(tc.query.String(), bufString(fq))
440-
a.Equal(tc.typeKind == FuncValue, fq.ConvertsTo(FuncValue))
441-
a.True(fq.ConvertsTo(FuncNodes))
442-
a.False(fq.ConvertsTo(FuncLogical))
436+
q := tc.query
437+
a.Equal(tc.typeKind, q.ResultType())
438+
a.Equal(NodesType(tc.exp), q.evaluate(tc.current, tc.root))
439+
a.Equal(tc.query.String(), bufString(q))
440+
a.Equal(tc.typeKind == FuncValue, q.ConvertsTo(FuncValue))
441+
a.True(q.ConvertsTo(FuncNodes))
442+
a.False(q.ConvertsTo(FuncLogical))
443443
})
444444
}
445445
}

spec/query.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func (q *PathQuery) String() string {
3030
return buf.String()
3131
}
3232

33-
// writeTo writes a string representation of fq to buf. Defined by
33+
// writeTo writes a string representation of q to buf. Defined by
3434
// [stringWriter].
3535
func (q *PathQuery) writeTo(buf *strings.Builder) {
3636
if q.root {
@@ -117,13 +117,13 @@ func (q *PathQuery) Expression() FuncExprArg {
117117
return q
118118
}
119119

120-
// evaluate returns a [NodesType] containing the result of executing fq.
120+
// evaluate returns a [NodesType] containing the result of executing q.
121121
// Defined by the [FuncExprArg] interface.
122122
func (q *PathQuery) evaluate(current, root any) PathValue {
123123
return NodesType(q.Select(current, root))
124124
}
125125

126-
// ResultType returns [FuncValue] if fq is a singular query, and [FuncNodes]
126+
// ResultType returns [FuncValue] if q is a singular query, and [FuncNodes]
127127
// if it is not. Defined by the [FuncExprArg] interface.
128128
func (q *PathQuery) ResultType() FuncType {
129129
if q.isSingular() {
@@ -132,7 +132,7 @@ func (q *PathQuery) ResultType() FuncType {
132132
return FuncNodes
133133
}
134134

135-
// ConvertsTo returns true if fq's result can be converted to ft. A singular
135+
// ConvertsTo returns true if q's result can be converted to ft. A singular
136136
// query can be converted to either [FuncValue] or [FuncNodes]. All other
137137
// queries can only be converted to FuncNodes.
138138
func (q *PathQuery) ConvertsTo(ft FuncType) bool {

0 commit comments

Comments
 (0)