Skip to content

Commit 5c1c72d

Browse files
Better handling off parameterized expression condition
1 parent 424fd0c commit 5c1c72d

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

queries/go.scm

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@
268268
) @condition.domain
269269
(#not-parent-type? @condition.domain if_statement)
270270
(#insertion-delimiter! @branch.start " ")
271+
(#shrink-to-match! @condition "^\\(?(?<keep>[^)]*)\\)?$")
271272
)
272273

273274
;;!! else if true {}
@@ -278,6 +279,7 @@
278279
consequence: (_) @branch.end @condition.domain.end
279280
)
280281
(#insertion-delimiter! @branch.start " ")
282+
(#shrink-to-match! @condition "^\\(?(?<keep>[^)]*)\\)?$")
281283
)
282284

283285
;;!! else {}
@@ -360,14 +362,6 @@
360362
result: (_) @type
361363
) @_.domain
362364

363-
;;!! if (true) {}
364-
(
365-
(_
366-
condition: (parenthesized_expression) @condition
367-
) @_.domain
368-
(#child-range! @condition 0 -1 true true)
369-
)
370-
371365
;;!! for i := 0; i < size; i++ {}
372366
;;! ^^^^^^^^
373367
(for_statement

0 commit comments

Comments
 (0)