Skip to content

Commit 752b780

Browse files
committed
unified: Prevent field bleed-through from _if_let_binding
Same procedure as before -- we change the anonymous node to a named node, and the problem magically goes away.
1 parent d2a1d67 commit 752b780

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

unified/extractor/tree-sitter-swift/grammar.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,8 +1041,8 @@ module.exports = grammar({
10411041
)
10421042
),
10431043
if_condition: ($) =>
1044-
choice($._if_let_binding, $.expression, $.availability_condition),
1045-
_if_let_binding: ($) =>
1044+
choice($.if_let_binding, $.expression, $.availability_condition),
1045+
if_let_binding: ($) =>
10461046
seq(
10471047
$._direct_or_indirect_binding,
10481048
optional(seq($._equal_sign, $.expression)),

unified/extractor/tree-sitter-swift/node-types.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,9 @@ named:
235235
identifier:
236236
$children+: simple_identifier
237237
if_condition:
238-
$children*: [availability_condition, expression, pattern, type, type_annotation, user_type, value_binding_pattern, where_clause, wildcard_pattern]
238+
$children: [availability_condition, expression, if_let_binding]
239+
if_let_binding:
240+
$children*: [expression, pattern, type, type_annotation, user_type, value_binding_pattern, where_clause, wildcard_pattern]
239241
bound_identifier?: simple_identifier
240242
if_statement:
241243
$children*: [else, if_statement, statements]

0 commit comments

Comments
 (0)