Skip to content

Commit 31fbb90

Browse files
committed
rename to match types
1 parent d0dc5cd commit 31fbb90

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

internal/query/query.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,23 @@ const (
1818
func Parse(queryString string) (*types.ExecutableDefinition, *errors.QueryError) {
1919
l := common.NewLexer(queryString, false)
2020

21-
var doc *types.ExecutableDefinition
22-
err := l.CatchSyntaxError(func() { doc = parseDocument(l) })
21+
var execDef *types.ExecutableDefinition
22+
err := l.CatchSyntaxError(func() { execDef = parseExecutableDefinition(l) })
2323
if err != nil {
2424
return nil, err
2525
}
2626

27-
return doc, nil
27+
return execDef, nil
2828
}
2929

30-
func parseDocument(l *common.Lexer) *types.ExecutableDefinition {
31-
d := &types.ExecutableDefinition{}
30+
func parseExecutableDefinition(l *common.Lexer) *types.ExecutableDefinition {
31+
ed := &types.ExecutableDefinition{}
3232
l.ConsumeWhitespace()
3333
for l.Peek() != scanner.EOF {
3434
if l.Peek() == '{' {
3535
op := &types.OperationDefinition{Type: Query, Loc: l.Location()}
3636
op.Selections = parseSelectionSet(l)
37-
d.Operations = append(d.Operations, op)
37+
ed.Operations = append(ed.Operations, op)
3838
continue
3939
}
4040

@@ -43,24 +43,24 @@ func parseDocument(l *common.Lexer) *types.ExecutableDefinition {
4343
case "query":
4444
op := parseOperation(l, Query)
4545
op.Loc = loc
46-
d.Operations = append(d.Operations, op)
46+
ed.Operations = append(ed.Operations, op)
4747

4848
case "mutation":
49-
d.Operations = append(d.Operations, parseOperation(l, Mutation))
49+
ed.Operations = append(ed.Operations, parseOperation(l, Mutation))
5050

5151
case "subscription":
52-
d.Operations = append(d.Operations, parseOperation(l, Subscription))
52+
ed.Operations = append(ed.Operations, parseOperation(l, Subscription))
5353

5454
case "fragment":
5555
frag := parseFragment(l)
5656
frag.Loc = loc
57-
d.Fragments = append(d.Fragments, frag)
57+
ed.Fragments = append(ed.Fragments, frag)
5858

5959
default:
6060
l.SyntaxError(fmt.Sprintf(`unexpected %q, expecting "fragment"`, x))
6161
}
6262
}
63-
return d
63+
return ed
6464
}
6565

6666
func parseOperation(l *common.Lexer, opType types.OperationType) *types.OperationDefinition {

0 commit comments

Comments
 (0)