diff --git a/unified/extractor/tree-sitter-swift/grammar.js b/unified/extractor/tree-sitter-swift/grammar.js index 4c5e175f60a..5d544aca76b 100644 --- a/unified/extractor/tree-sitter-swift/grammar.js +++ b/unified/extractor/tree-sitter-swift/grammar.js @@ -1907,10 +1907,10 @@ module.exports = grammar({ _direct_or_indirect_binding: ($) => seq( choice( - $._binding_kind_and_pattern, - seq("case", $._binding_pattern_no_expr) + field("pattern", alias($._binding_kind_and_pattern, $.pattern)), + seq("case", field("pattern", alias($._binding_pattern_no_expr, $.pattern))) ), - optional($.type_annotation) + field("type", optional($.type_annotation)) ), value_binding_pattern: ($) => field("mutability", choice("var", "let")), _possibly_async_binding_pattern_kind: ($) => diff --git a/unified/extractor/tree-sitter-swift/node-types.yml b/unified/extractor/tree-sitter-swift/node-types.yml index ca80ea2c359..3eecf7efaee 100644 --- a/unified/extractor/tree-sitter-swift/node-types.yml +++ b/unified/extractor/tree-sitter-swift/node-types.yml @@ -314,8 +314,8 @@ named: if_condition: kind: [availability_condition, expression, if_let_binding] if_let_binding: - $children*: [pattern, simple_identifier, type, type_annotation, user_type, value_binding_pattern, wildcard_pattern] - bound_identifier?: simple_identifier + pattern: pattern + type?: type_annotation value?: expression where?: where_clause if_statement: