Skip to content

Commit 56c7c78

Browse files
committed
Add field documentation for HashPatternNode
1 parent 46e0021 commit 56c7c78

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
@@ -2161,18 +2161,61 @@ nodes:
21612161
fields:
21622162
- name: constant
21632163
type: node?
2164+
kind:
2165+
- ConstantPathNode
2166+
- ConstantReadNode
2167+
comment: |
2168+
Represents the optional constant preceding the Hash.
2169+
2170+
foo => Bar[a: 1, b: 2]
2171+
^^^
2172+
2173+
foo => Bar::Baz[a: 1, b: 2]
2174+
^^^^^^^^
21642175
- name: elements
21652176
type: node[]
21662177
kind: AssocNode
2178+
comment: |
2179+
Represents the explicit named hash keys and values.
2180+
2181+
foo => { a: 1, b:, ** }
2182+
^^^^^^^^
21672183
- name: rest
21682184
type: node?
21692185
kind:
21702186
- AssocSplatNode
21712187
- NoKeywordsParameterNode
2188+
comment: |
2189+
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`.
2190+
2191+
foo => { a: 1, b:, **c }
2192+
^^^
2193+
2194+
foo => { a: 1, b:, ** }
2195+
^^
2196+
2197+
foo => { a: 1, b:, **nil }
2198+
^^^^^
21722199
- name: opening_loc
21732200
type: location?
2201+
comment: |
2202+
The location of the opening brace.
2203+
2204+
foo => { a: 1 }
2205+
^
2206+
2207+
foo => Bar[a: 1]
2208+
^
21742209
- name: closing_loc
21752210
type: location?
2211+
comment: |
2212+
The location of the closing brace.
2213+
2214+
foo => { a: 1 }
2215+
^
2216+
2217+
foo => Bar[a: 1]
2218+
^
21762219
comment: |
21772220
Represents a hash pattern in pattern matching.
21782221
@@ -2181,6 +2224,12 @@ nodes:
21812224
21822225
foo => { a: 1, b: 2, **c }
21832226
^^^^^^^^^^^^^^^^^^^
2227+
2228+
foo => Bar[a: 1, b: 2]
2229+
^^^^^^^^^^^^^^^
2230+
2231+
foo in { a: 1, b: 2 }
2232+
^^^^^^^^^^^^^^
21842233
- name: IfNode
21852234
fields:
21862235
- name: if_keyword_loc

0 commit comments

Comments
 (0)