Skip to content

Commit caef72b

Browse files
committed
unified: Introduced named property_binding node
This groups together a bunch of related values that would otherwise be impossible to match up correctly.
1 parent 9787a8b commit caef72b

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,10 +1400,10 @@ module.exports = grammar({
14001400
prec.right(
14011401
seq(
14021402
$._possibly_async_binding_pattern_kind,
1403-
sep1($._single_modifierless_property_declaration, ",")
1403+
sep1(field("declarator", $.property_binding), ",")
14041404
)
14051405
),
1406-
_single_modifierless_property_declaration: ($) =>
1406+
property_binding: ($) =>
14071407
prec.left(
14081408
seq(
14091409
field("name", alias($._no_expr_pattern_already_bound, $.pattern)),

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -507,15 +507,17 @@ named:
507507
operation: ["&", "+", "++", "-", "--", ".", bang, custom_operator, "~"]
508508
target: expression
509509
property_behavior_modifier:
510+
property_binding:
511+
computed_value?: computed_property
512+
name: pattern
513+
observers?: willset_didset_block
514+
type?: type_annotation
515+
type_constraints?: type_constraints
516+
value?: expression
510517
property_declaration:
511518
binding: value_binding_pattern
512-
computed_value*: computed_property
519+
declarator+: property_binding
513520
modifiers*: [attribute, inheritance_modifier, modifiers, ownership_modifier, property_behavior_modifier]
514-
name+: pattern
515-
observers*: willset_didset_block
516-
type*: type_annotation
517-
type_constraints*: type_constraints
518-
value*: expression
519521
property_modifier:
520522
protocol_body:
521523
member*: protocol_member_declaration

0 commit comments

Comments
 (0)