Skip to content
This repository was archived by the owner on Sep 9, 2025. It is now read-only.

Commit ed5af14

Browse files
committed
Support enum constants.
1 parent 2122e6f commit ed5af14

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

languages/tree-sitter-stack-graphs-java/src/stack-graphs.tsg

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -762,11 +762,11 @@ attribute node_symbol = node => symbol = (source-text node), source_n
762762
attr (implicit_this__typeof) push_symbol = ":"
763763
edge implicit_this -> @ident.lexical_scope
764764

765-
node ref
766-
attr (ref) node_reference = @ident
767-
edge ref -> @ident.lexical_scope
768-
attr (ref -> @ident.lexical_scope) precedence = 1
769-
edge ref -> member
765+
node @ident.ref
766+
attr (@ident.ref) node_reference = @ident
767+
edge @ident.ref -> @ident.lexical_scope
768+
attr (@ident.ref -> @ident.lexical_scope) precedence = 1
769+
edge @ident.ref -> member
770770

771771
attr (member) push_symbol = "."
772772

@@ -777,22 +777,22 @@ attribute node_symbol = node => symbol = (source-text node), source_n
777777
edge @ident.type -> ref__typeof
778778

779779
attr (ref__typeof) push_symbol = ":"
780-
edge ref__typeof -> ref
780+
edge ref__typeof -> @ident.ref
781781
}
782782

783783
(field_access
784784
object: (_) @object
785785
field: (identifier) @identifier) @field_access {
786-
node member
786+
node @field_access.member
787787

788788
edge @object.lexical_scope -> @field_access.lexical_scope
789789

790790
node ref
791791
attr (ref) node_reference = @identifier
792-
edge ref -> member
792+
edge ref -> @field_access.member
793793

794-
attr (member) push_symbol = "."
795-
edge member -> @object.type
794+
attr (@field_access.member) push_symbol = "."
795+
edge @field_access.member -> @object.type
796796

797797
node ref__typeof
798798
edge @field_access.type -> ref__typeof
@@ -801,6 +801,13 @@ attribute node_symbol = node => symbol = (source-text node), source_n
801801
edge ref__typeof -> ref
802802
}
803803

804+
(field_access
805+
object: (identifier) @type ; this might represent a type identifier in the case of static member access
806+
field: (identifier) @identifier) @this {
807+
; allow resolution of A.X to static members of lexically-scoped A
808+
edge @this.member -> @type.ref
809+
}
810+
804811
(method_invocation) @method_invocation
805812
{
806813
node @method_invocation.before_scope

0 commit comments

Comments
 (0)