Skip to content

Commit f5c91f4

Browse files
committed
Add field documentation for HashPatternNode
1 parent 3011525 commit f5c91f4

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

config.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2160,18 +2160,61 @@ nodes:
21602160
fields:
21612161
- name: constant
21622162
type: node?
2163+
kind:
2164+
- ConstantPathNode
2165+
- ConstantReadNode
2166+
comment: |
2167+
Represents the optional constant preceding the Hash.
2168+
2169+
foo => Bar[a: 1, b: 2]
2170+
^^^
2171+
2172+
foo => Bar::Baz[a: 1, b: 2]
2173+
^^^^^^^^
21632174
- name: elements
21642175
type: node[]
21652176
kind: AssocNode
2177+
comment: |
2178+
Represents the explicit named hash keys and values.
2179+
2180+
foo => { a: 1, b:, ** }
2181+
^^^^^^^^
21662182
- name: rest
21672183
type: node?
21682184
kind:
21692185
- AssocSplatNode
21702186
- NoKeywordsParameterNode
2187+
comment: |
2188+
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`.
2189+
2190+
foo => { a: 1, b:, **c }
2191+
^^^
2192+
2193+
foo => { a: 1, b:, ** }
2194+
^^
2195+
2196+
foo => { a: 1, b:, **nil }
2197+
^^^^^
21712198
- name: opening_loc
21722199
type: location?
2200+
comment: |
2201+
The location of the opening brace.
2202+
2203+
foo => { a: 1 }
2204+
^
2205+
2206+
foo => Bar[a: 1]
2207+
^
21732208
- name: closing_loc
21742209
type: location?
2210+
comment: |
2211+
The location of the closing brace.
2212+
2213+
foo => { a: 1 }
2214+
^
2215+
2216+
foo => Bar[a: 1]
2217+
^
21752218
comment: |
21762219
Represents a hash pattern in pattern matching.
21772220
@@ -2180,6 +2223,12 @@ nodes:
21802223
21812224
foo => { a: 1, b: 2, **c }
21822225
^^^^^^^^^^^^^^^^^^^
2226+
2227+
foo => Bar[a: 1, b: 2]
2228+
^^^^^^^^^^^^^^^
2229+
2230+
foo in { a: 1, b: 2 }
2231+
^^^^^^^^^^^^^^
21832232
- name: IfNode
21842233
fields:
21852234
- name: if_keyword_loc

0 commit comments

Comments
 (0)