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

Commit 63ecc75

Browse files
committed
Deal with optional nodes.
1 parent 7c8d4ce commit 63ecc75

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,11 @@ attribute node_symbol = node => symbol = (source-text node), source_n
541541
edge @stmt.after_scope -> @stmt.before_scope
542542
}
543543

544+
(for_statement !init !condition !update body: (_) @body) @this {
545+
edge @body.before_scope -> @this.before_scope
546+
edge @this.after_scope -> @this.before_scope
547+
}
548+
544549
(for_statement init: (expression) @init condition: (_) @condition update: (_) @update body: (_) @body) @stmt {
545550
edge @init.lexical_scope -> @stmt.before_scope
546551
edge @condition.lexical_scope -> @stmt.before_scope

0 commit comments

Comments
 (0)