diff options
author | Kevin Newton <kddnewton@gmail.com> | 2023-11-30 20:47:08 -0500 |
---|---|---|
committer | Kevin Newton <kddnewton@gmail.com> | 2023-12-01 12:03:09 -0500 |
commit | cdb74d74afb87a0d7048a53aaf12d32516033a3c (patch) | |
tree | b90ab9a755b94de8e55f5f72a6552f3ea4aed3b5 /test/prism/snapshots/unparser/corpus/semantic/block.txt | |
parent | 90d9c20a0c0df5565d5f95d5e14c58331fa5922f (diff) |
[ruby/prism] Change numbered parameters
Previously numbered parameters were a field on blocks and lambdas
that indicated the maximum number of numbered parameters in either
the block or lambda, respectively. However they also had a
parameters field that would always be nil in these cases.
This changes it so that we introduce a NumberedParametersNode that
goes in place of parameters, which has a single uint8_t maximum
field on it. That field contains the maximum numbered parameter in
either the block or lambda.
As a part of the PR, I'm introducing a new UInt8Field type that
can be used on nodes, which is just to make it a little more
explicit what the maximum values can be (the maximum is actually 9,
since it only goes up to _9). Plus we can do a couple of nice
things in serialization like just read a single byte.
https://github.com/ruby/prism/commit/2d87303903
Diffstat (limited to 'test/prism/snapshots/unparser/corpus/semantic/block.txt')
-rw-r--r-- | test/prism/snapshots/unparser/corpus/semantic/block.txt | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/test/prism/snapshots/unparser/corpus/semantic/block.txt b/test/prism/snapshots/unparser/corpus/semantic/block.txt index c3ac1f85c6..f3d5440a59 100644 --- a/test/prism/snapshots/unparser/corpus/semantic/block.txt +++ b/test/prism/snapshots/unparser/corpus/semantic/block.txt @@ -17,8 +17,7 @@ │ │ ├── parameters: ∅ │ │ ├── body: ∅ │ │ ├── opening_loc: (1,4)-(1,6) = "do" - │ │ ├── closing_loc: (2,0)-(2,3) = "end" - │ │ └── numbered_parameters: 0 + │ │ └── closing_loc: (2,0)-(2,3) = "end" │ └── flags: ∅ ├── @ CallNode (location: (4,0)-(6,3)) │ ├── receiver: ∅ @@ -48,8 +47,7 @@ │ │ │ ├── ensure_clause: ∅ │ │ │ └── end_keyword_loc: (6,0)-(6,3) = "end" │ │ ├── opening_loc: (4,4)-(4,6) = "do" - │ │ ├── closing_loc: (6,0)-(6,3) = "end" - │ │ └── numbered_parameters: 0 + │ │ └── closing_loc: (6,0)-(6,3) = "end" │ └── flags: ∅ ├── @ CallNode (location: (8,0)-(11,3)) │ ├── receiver: ∅ @@ -74,8 +72,7 @@ │ │ │ │ @ NilNode (location: (9,13)-(9,16)) │ │ │ └── @ NilNode (location: (10,2)-(10,5)) │ │ ├── opening_loc: (8,4)-(8,6) = "do" - │ │ ├── closing_loc: (11,0)-(11,3) = "end" - │ │ └── numbered_parameters: 0 + │ │ └── closing_loc: (11,0)-(11,3) = "end" │ └── flags: ∅ ├── @ CallNode (location: (13,0)-(14,3)) │ ├── receiver: ∅ @@ -106,8 +103,7 @@ │ │ │ └── closing_loc: (13,9)-(13,10) = "|" │ │ ├── body: ∅ │ │ ├── opening_loc: (13,4)-(13,6) = "do" - │ │ ├── closing_loc: (14,0)-(14,3) = "end" - │ │ └── numbered_parameters: 0 + │ │ └── closing_loc: (14,0)-(14,3) = "end" │ └── flags: ∅ ├── @ CallNode (location: (16,0)-(20,3)) │ ├── receiver: ∅ @@ -152,8 +148,7 @@ │ │ │ ├── name: :a │ │ │ └── depth: 0 │ │ ├── opening_loc: (16,12)-(16,14) = "do" - │ │ ├── closing_loc: (20,0)-(20,3) = "end" - │ │ └── numbered_parameters: 0 + │ │ └── closing_loc: (20,0)-(20,3) = "end" │ └── flags: ∅ └── @ CallNode (location: (22,0)-(26,3)) ├── receiver: ∅ @@ -190,6 +185,5 @@ │ │ ├── block: ∅ │ │ └── flags: variable_call │ ├── opening_loc: (22,12)-(22,14) = "do" - │ ├── closing_loc: (26,0)-(26,3) = "end" - │ └── numbered_parameters: 0 + │ └── closing_loc: (26,0)-(26,3) = "end" └── flags: ∅ |