Skip to content

Commit 33e89e8

Browse files
committed
Fix error when tool annotation is on same line as extends
1 parent 9de33a4 commit 33e89e8

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

grammar.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,10 @@ module.exports = grammar({
388388
),
389389

390390
extends_statement: ($) =>
391-
prec(PREC.type, seq("extends", choice($.string, $.type))),
391+
prec(
392+
PREC.type,
393+
seq(optional($.annotations), "extends", choice($.string, $.type)),
394+
),
392395

393396
_compound_statement: ($) =>
394397
choice(

test/corpus/issues.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,3 +434,20 @@ func _ready():
434434
(identifier)
435435
(arguments
436436
(string))))))))))
437+
438+
=========================================
439+
Extends with tool annotation on same line
440+
=========================================
441+
442+
@tool extends Node
443+
class_name Foo
444+
445+
---
446+
447+
(source
448+
(extends_statement
449+
(annotations
450+
(annotation (identifier)))
451+
(type (identifier)))
452+
(class_name_statement
453+
name: (name)))

0 commit comments

Comments
 (0)