()
| 49 | } |
| 50 | |
| 51 | func (p *parser) parseOperationDefinition() *OperationDefinition { |
| 52 | if p.peek().Kind == lexer.BraceL { |
| 53 | return &OperationDefinition{ |
| 54 | Position: p.peekPos(), |
| 55 | Comment: p.comment, |
| 56 | Operation: Query, |
| 57 | SelectionSet: p.parseRequiredSelectionSet(), |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | var od OperationDefinition |
| 62 | od.Position = p.peekPos() |
| 63 | od.Comment = p.comment |
| 64 | od.Operation = p.parseOperationType() |
| 65 | |
| 66 | if p.peek().Kind == lexer.Name { |
| 67 | od.Name = p.next().Value |
| 68 | } |
| 69 | |
| 70 | od.VariableDefinitions = p.parseVariableDefinitions() |
| 71 | od.Directives = p.parseDirectives(false) |
| 72 | od.SelectionSet = p.parseRequiredSelectionSet() |
| 73 | |
| 74 | return &od |
| 75 | } |
| 76 | |
| 77 | func (p *parser) parseOperationType() Operation { |
| 78 | tok := p.next() |
no test coverage detected