diff --git a/unified/extractor/tree-sitter-swift/grammar.js b/unified/extractor/tree-sitter-swift/grammar.js index 5ee1d8460aa..7413ab5a3b2 100644 --- a/unified/extractor/tree-sitter-swift/grammar.js +++ b/unified/extractor/tree-sitter-swift/grammar.js @@ -452,7 +452,7 @@ module.exports = grammar({ optional(sep1Opt(field("element", $.tuple_type_item), ",")), ")" ), - alias($._parenthesized_type, $.tuple_type_item) + field("element", alias($._parenthesized_type, $.tuple_type_item)) ), tuple_type_item: ($) => prec( @@ -791,13 +791,13 @@ module.exports = grammar({ ), value_argument_label: ($) => prec.left( - choice( + field("name", choice( $.simple_identifier, // We don't rely on $._contextual_simple_identifier here because // these don't usually fall into that category. alias("if", $.simple_identifier), alias("switch", $.simple_identifier) - ) + )) ), value_argument: ($) => prec.left( @@ -1094,7 +1094,7 @@ module.exports = grammar({ $.statements, optional("fallthrough") ), - switch_pattern: ($) => alias($._binding_pattern_with_expr, $.pattern), + switch_pattern: ($) => field("pattern", alias($._binding_pattern_with_expr, $.pattern)), do_statement: ($) => prec.right(PRECS["do"], seq("do", $._block, repeat(field("catch", $.catch_block)))), catch_block: ($) => diff --git a/unified/extractor/tree-sitter-swift/node-types.yml b/unified/extractor/tree-sitter-swift/node-types.yml index 7877106ad52..276bcef03ea 100644 --- a/unified/extractor/tree-sitter-swift/node-types.yml +++ b/unified/extractor/tree-sitter-swift/node-types.yml @@ -559,7 +559,7 @@ named: switch_entry: $children+: [default_keyword, expression, modifiers, statements, switch_pattern, where_keyword] switch_pattern: - $children: pattern + pattern: pattern switch_statement: entry*: switch_entry expr: expression @@ -579,7 +579,6 @@ named: name*: simple_identifier value+: expression tuple_type: - $children?: tuple_type_item element*: tuple_type_item tuple_type_item: $children?: [dictionary_type, existential_type, opaque_type, wildcard_pattern] @@ -627,7 +626,7 @@ named: type_modifiers?: type_modifiers value?: expression value_argument_label: - $children: simple_identifier + name: simple_identifier value_arguments: argument*: value_argument value_binding_pattern: