unified: Add fields to property_declaration

Not entirely sure about the `binding?` field on `pattern`, but it looks
like that might actually be useful.
This commit is contained in:
Taus
2026-05-12 15:14:35 +00:00
parent 406a02fa49
commit 2010844b1e
2 changed files with 10 additions and 6 deletions

View File

@@ -1405,13 +1405,13 @@ module.exports = grammar({
prec.left(
seq(
field("name", alias($._no_expr_pattern_already_bound, $.pattern)),
optional($.type_annotation),
optional($.type_constraints),
field("type", optional($.type_annotation)),
field("type_constraints", optional($.type_constraints)),
optional(
choice(
$._expression_with_willset_didset,
$._expression_without_willset_didset,
$.willset_didset_block,
field("observers", $.willset_didset_block),
field("computed_value", $.computed_property)
)
)
@@ -1423,7 +1423,7 @@ module.exports = grammar({
seq(
$._equal_sign,
field("value", $.expression),
$.willset_didset_block
field("observers", $.willset_didset_block)
)
),
_expression_without_willset_didset: ($) =>
@@ -1909,7 +1909,7 @@ module.exports = grammar({
),
value_binding_pattern: ($) => field("mutability", choice("var", "let")),
_possibly_async_binding_pattern_kind: ($) =>
seq(optional($._async_modifier), $.value_binding_pattern),
seq(optional($._async_modifier), field("binding", $.value_binding_pattern)),
_binding_kind_and_pattern: ($) =>
seq(
$._possibly_async_binding_pattern_kind,

View File

@@ -474,6 +474,7 @@ named:
modifier+: parameter_modifier
pattern:
$children*: [expression, pattern, type, user_type, value_binding_pattern, wildcard_pattern]
binding?: value_binding_pattern
bound_identifier?: simple_identifier
playground_literal:
name+: simple_identifier
@@ -494,10 +495,13 @@ named:
target: expression
property_behavior_modifier:
property_declaration:
$children*: [type_annotation, type_constraints, value_binding_pattern, willset_didset_block]
binding: value_binding_pattern
computed_value*: computed_property
modifiers*: [attribute, inheritance_modifier, modifiers, ownership_modifier, property_behavior_modifier]
name+: pattern
observers*: willset_didset_block
type*: type_annotation
type_constraints*: type_constraints
value*: expression
property_modifier:
protocol_body: