Skip to content

Commit 9b7dfcc

Browse files
herwinwkddnewton
authored andcommitted
Add field documentation for HashPatternNode
1 parent c80c4d9 commit 9b7dfcc

1 file changed

Lines changed: 47 additions & 1 deletion

File tree

config.yml

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2725,20 +2725,60 @@ nodes:
27252725
- name: constant
27262726
type: node?
27272727
kind:
2728-
- ConstantReadNode
27292728
- ConstantPathNode
2729+
- ConstantReadNode
2730+
comment: |
2731+
Represents the optional constant preceding the Hash.
2732+
2733+
foo => Bar[a: 1, b: 2]
2734+
^^^
2735+
2736+
foo => Bar::Baz[a: 1, b: 2]
2737+
^^^^^^^^
27302738
- name: elements
27312739
type: node[]
27322740
kind: AssocNode
2741+
comment: |
2742+
Represents the explicit named hash keys and values.
2743+
2744+
foo => { a: 1, b:, ** }
2745+
^^^^^^^^
27332746
- name: rest
27342747
type: node?
27352748
kind:
27362749
- AssocSplatNode
27372750
- NoKeywordsParameterNode
2751+
comment: |
2752+
Represents the rest of the Hash keys and values. This can be named, unnamed, or explicitly forbidden via `**nil`, this last one results in a `NoKeywordsParameterNode`.
2753+
2754+
foo => { a: 1, b:, **c }
2755+
^^^
2756+
2757+
foo => { a: 1, b:, ** }
2758+
^^
2759+
2760+
foo => { a: 1, b:, **nil }
2761+
^^^^^
27382762
- name: opening_loc
27392763
type: location?
2764+
comment: |
2765+
The location of the opening brace.
2766+
2767+
foo => { a: 1 }
2768+
^
2769+
2770+
foo => Bar[a: 1]
2771+
^
27402772
- name: closing_loc
27412773
type: location?
2774+
comment: |
2775+
The location of the closing brace.
2776+
2777+
foo => { a: 1 }
2778+
^
2779+
2780+
foo => Bar[a: 1]
2781+
^
27422782
comment: |
27432783
Represents a hash pattern in pattern matching.
27442784
@@ -2747,6 +2787,12 @@ nodes:
27472787
27482788
foo => { a: 1, b: 2, **c }
27492789
^^^^^^^^^^^^^^^^^^^
2790+
2791+
foo => Bar[a: 1, b: 2]
2792+
^^^^^^^^^^^^^^^
2793+
2794+
foo in { a: 1, b: 2 }
2795+
^^^^^^^^^^^^^^
27502796
- name: IfNode
27512797
fields:
27522798
- name: if_keyword_loc

0 commit comments

Comments
 (0)