Skip to content

Commit

Permalink
Add a field name for bound identifiers
Browse files Browse the repository at this point in the history
This makes obsolete the overly-broad `@variable` rule on
`simple_identifier`, while still marking bound variable names as
variables.
  • Loading branch information
alex-pinkus committed Mar 26, 2022
1 parent 8f559f0 commit f513c81
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -1801,7 +1801,7 @@ function generate_pattern_matching_rule(
: generate_case_pattern($, allows_binding);
var expression_pattern = allows_expressions
? $._expression
: $.simple_identifier;
: field("bound_identifier", $.simple_identifier);
var all_patterns = always_allowed_patterns
.concat(binding_pattern_if_allowed)
.concat(case_pattern)
Expand Down
1 change: 1 addition & 0 deletions queries/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
(type_parameter (type_identifier) @parameter)
(inheritance_constraint (identifier (simple_identifier) @parameter))
(equality_constraint (identifier (simple_identifier) @parameter))
(non_binding_pattern bound_identifier: (simple_identifier)) @variable

[
"typealias"
Expand Down

0 comments on commit f513c81

Please sign in to comment.