Skip to content

Commit f4f85b5

Browse files
committed
unified: Remove some pointless fields
All of these fields have contents that are uniquely determined by the node they appear on, so they convey no information.
1 parent caef72b commit f4f85b5

2 files changed

Lines changed: 5 additions & 9 deletions

File tree

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,7 +1050,7 @@ module.exports = grammar({
10501050
"if",
10511051
sep1(field("condition", $.if_condition), ","),
10521052
field("body", $.block),
1053-
optional(seq(field("else_keyword", $["else"]), $._else_options))
1053+
optional(seq(alias($["else"], "else"), $._else_options))
10541054
)
10551055
),
10561056
if_condition: ($) =>
@@ -1067,7 +1067,7 @@ module.exports = grammar({
10671067
seq(
10681068
"guard",
10691069
sep1(field("condition", $.if_condition), ","),
1070-
field("else_keyword", $["else"]),
1070+
alias($["else"], "else"),
10711071
field("body", $.block)
10721072
)
10731073
),
@@ -1712,7 +1712,7 @@ module.exports = grammar({
17121712
prec.right(
17131713
seq(
17141714
field("modifiers", optional($.modifiers)),
1715-
field("declaration_kind", "protocol"),
1715+
"protocol",
17161716
field("name", alias($.simple_identifier, $.type_identifier)),
17171717
field("type_parameters", optional($.type_parameters)),
17181718
optional(seq(":", $._inheritance_specifiers)),
@@ -1744,7 +1744,7 @@ module.exports = grammar({
17441744
seq(
17451745
field("modifiers", optional($.modifiers)),
17461746
optional("class"),
1747-
field("name", "init"),
1747+
"init",
17481748
optional(choice($._quest, field("bang", $.bang))),
17491749
field("type_parameters", optional($.type_parameters)),
17501750
$._function_value_parameters,

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,6 @@ named:
270270
do_statement:
271271
body: block
272272
catch*: catch_block
273-
else:
274273
enum_case_entry:
275274
data_contents?: enum_type_parameters
276275
name: simple_identifier
@@ -333,7 +332,6 @@ named:
333332
guard_statement:
334333
body: block
335334
condition+: if_condition
336-
else_keyword: else
337335
hex_literal:
338336
identifier:
339337
part+: simple_identifier
@@ -348,7 +346,6 @@ named:
348346
body: block
349347
condition+: if_condition
350348
else_branch?: [block, if_statement]
351-
else_keyword?: else
352349
implicitly_unwrapped_type:
353350
name: type
354351
import_declaration:
@@ -370,7 +367,6 @@ named:
370367
bang?: bang
371368
body?: block
372369
modifiers?: modifiers
373-
name: "init"
374370
parameter*: function_parameter
375371
throws?: [throws, throws_clause]
376372
type_constraints?: type_constraints
@@ -526,7 +522,6 @@ named:
526522
protocol_declaration:
527523
attribute*: attribute
528524
body: protocol_body
529-
declaration_kind: "protocol"
530525
inherits*: inheritance_specifier
531526
modifiers?: modifiers
532527
name: type_identifier
@@ -794,6 +789,7 @@ unnamed:
794789
- "dsohandle"
795790
- "dynamic"
796791
- "each"
792+
- "else"
797793
- "enum"
798794
- "extension"
799795
- "externalMacro"

0 commit comments

Comments
 (0)