Skip to content

Commit 8751a57

Browse files
committed
Use ctx.isTokenNotFound
Signed-off-by: Charith Ellawala <charith@cerbos.dev>
1 parent b5fa18f commit 8751a57

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

parser/parser.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -1063,12 +1063,10 @@ func (p *parser) parseDirective(ctx *context, g *TokenGroup) (*ast.DirectiveNode
10631063

10641064
func (p *parser) parseComment(ctx *context) (ast.Node, error) {
10651065
cm := p.parseHeadComment(ctx)
1066-
tk := ctx.currentToken()
1067-
if tk == nil {
1066+
if ctx.isTokenNotFound() {
10681067
return cm, nil
10691068
}
1070-
1071-
node, err := p.parseToken(ctx, tk)
1069+
node, err := p.parseToken(ctx, ctx.currentToken())
10721070
if err != nil {
10731071
return nil, err
10741072
}

0 commit comments

Comments
 (0)