Skip to content

Commit 46e0021

Browse files
committed
Add field documentation for ArrayPatternNode
1 parent 8db52df commit 46e0021

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
@@ -903,16 +903,65 @@ nodes:
903903
fields:
904904
- name: constant
905905
type: node?
906+
kind:
907+
- ConstantPathNode
908+
- ConstantReadNode
909+
comment: |
910+
Represents the optional constant preceding the Array
911+
912+
foo in Bar[]
913+
^^^
914+
915+
foo in Bar[1, 2, 3]
916+
^^^
917+
918+
foo in Bar::Baz[1, 2, 3]
919+
^^^^^^^^
906920
- name: requireds
907921
type: node[]
922+
comment: |
923+
This represents all the entries in case there is no wildcard, or the entries up to the wildcard in case there is a single wildcard.
924+
925+
foo in 1, 2, 3
926+
^^^^^^^
927+
928+
foo in 1, 2, *
929+
^^^^
908930
- name: rest
909931
type: node?
932+
kind: SplatNode
933+
comment: |
934+
This represents the wildcard, which can be unnamed.
935+
936+
foo in 1, 2, *
937+
^
938+
939+
foo in 1, 2, *a, 3
940+
^^
910941
- name: posts
911942
type: node[]
943+
comment: |
944+
This represents all the entries after the wildcard. This list will be empty if there is no wildcard, or the
945+
946+
foo in *, 1, 2, 3
947+
^^^^^^^
948+
949+
foo in 1, 2, *, 3, 4
950+
^^^^
912951
- name: opening_loc
913952
type: location?
953+
comment: |
954+
The location of the opening brace.
955+
956+
foo = [1, 2]
957+
^
914958
- name: closing_loc
915959
type: location?
960+
comment: |
961+
The location of the closing brace.
962+
963+
foo = [1, 2]
964+
^
916965
comment: |
917966
Represents an array pattern in pattern matching.
918967

0 commit comments

Comments
 (0)