summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Newton <kddnewton@gmail.com>2023-09-14 13:08:10 -0400
committergit <svn-admin@ruby-lang.org>2023-09-19 16:13:08 +0000
commit2531ba4ba01b1303ae0c5a294d82a045b664da35 (patch)
tree9c26a145729cba5cf9e3a5e151c7d1ad9c22d9b3
parentc7875340be63201adde698405d0c8a81a313d5bf (diff)
[ruby/yarp] Consistently place block arguments on block slot for call
https://github.com/ruby/yarp/commit/fe208302e5
-rw-r--r--test/yarp/errors_test.rb7
-rw-r--r--test/yarp/location_test.rb2
-rw-r--r--test/yarp/snapshots/constants.txt64
-rw-r--r--test/yarp/snapshots/method_calls.txt296
-rw-r--r--test/yarp/snapshots/seattlerb/call_block_arg_named.txt38
-rw-r--r--test/yarp/snapshots/unparser/corpus/literal/send.txt306
-rw-r--r--test/yarp/snapshots/unparser/corpus/literal/since/31.txt32
-rw-r--r--test/yarp/snapshots/unparser/corpus/literal/super.txt88
-rw-r--r--test/yarp/snapshots/whitequark/anonymous_blockarg.txt16
-rw-r--r--test/yarp/snapshots/whitequark/args_args_assocs.txt64
-rw-r--r--test/yarp/snapshots/whitequark/args_args_star.txt64
-rw-r--r--test/yarp/snapshots/whitequark/args_assocs.txt60
-rw-r--r--test/yarp/snapshots/whitequark/args_assocs_legacy.txt60
-rw-r--r--test/yarp/snapshots/whitequark/args_block_pass.txt38
-rw-r--r--test/yarp/snapshots/whitequark/args_star.txt64
-rw-r--r--yarp/config.yml2
-rw-r--r--yarp/yarp.c147
17 files changed, 676 insertions, 672 deletions
diff --git a/test/yarp/errors_test.rb b/test/yarp/errors_test.rb
index 9664c47148..5a4d469c26 100644
--- a/test/yarp/errors_test.rb
+++ b/test/yarp/errors_test.rb
@@ -364,12 +364,9 @@ module YARP
nil,
Location(),
Location(),
- ArgumentsNode([
- BlockArgumentNode(expression("block"), Location()),
- expression("foo")
- ]),
+ ArgumentsNode([expression("foo")]),
Location(),
- nil,
+ BlockArgumentNode(expression("block"), Location()),
0,
"a"
)
diff --git a/test/yarp/location_test.rb b/test/yarp/location_test.rb
index 1c9aa104a5..a8e9b345a1 100644
--- a/test/yarp/location_test.rb
+++ b/test/yarp/location_test.rb
@@ -68,7 +68,7 @@ module YARP
end
def test_BlockArgumentNode
- assert_location(BlockArgumentNode, "foo(&bar)", 4...8) { |node| node.arguments.arguments.last }
+ assert_location(BlockArgumentNode, "foo(&bar)", 4...8, &:block)
end
def test_BlockLocalVariableNode
diff --git a/test/yarp/snapshots/constants.txt b/test/yarp/snapshots/constants.txt
index 0e6500500a..3238f9e93e 100644
--- a/test/yarp/snapshots/constants.txt
+++ b/test/yarp/snapshots/constants.txt
@@ -135,24 +135,22 @@
│ ├── call_operator_loc: ∅
│ ├── message_loc: (71...74) = "Foo"
│ ├── opening_loc: ∅
- │ ├── arguments:
- │ │ @ ArgumentsNode (location: (75...79))
- │ │ └── arguments: (length: 1)
- │ │ └── @ BlockArgumentNode (location: (75...79))
- │ │ ├── expression:
- │ │ │ @ CallNode (location: (76...79))
- │ │ │ ├── receiver: ∅
- │ │ │ ├── call_operator_loc: ∅
- │ │ │ ├── message_loc: (76...79) = "bar"
- │ │ │ ├── opening_loc: ∅
- │ │ │ ├── arguments: ∅
- │ │ │ ├── closing_loc: ∅
- │ │ │ ├── block: ∅
- │ │ │ ├── flags: variable_call
- │ │ │ └── name: "bar"
- │ │ └── operator_loc: (75...76) = "&"
+ │ ├── arguments: ∅
│ ├── closing_loc: ∅
- │ ├── block: ∅
+ │ ├── block:
+ │ │ @ BlockArgumentNode (location: (75...79))
+ │ │ ├── expression:
+ │ │ │ @ CallNode (location: (76...79))
+ │ │ │ ├── receiver: ∅
+ │ │ │ ├── call_operator_loc: ∅
+ │ │ │ ├── message_loc: (76...79) = "bar"
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── arguments: ∅
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ ├── block: ∅
+ │ │ │ ├── flags: variable_call
+ │ │ │ └── name: "bar"
+ │ │ └── operator_loc: (75...76) = "&"
│ ├── flags: ∅
│ └── name: "Foo"
├── @ CallNode (location: (81...94))
@@ -218,24 +216,22 @@
│ ├── call_operator_loc: (115...117) = "::"
│ ├── message_loc: (117...120) = "Bar"
│ ├── opening_loc: ∅
- │ ├── arguments:
- │ │ @ ArgumentsNode (location: (121...125))
- │ │ └── arguments: (length: 1)
- │ │ └── @ BlockArgumentNode (location: (121...125))
- │ │ ├── expression:
- │ │ │ @ CallNode (location: (122...125))
- │ │ │ ├── receiver: ∅
- │ │ │ ├── call_operator_loc: ∅
- │ │ │ ├── message_loc: (122...125) = "baz"
- │ │ │ ├── opening_loc: ∅
- │ │ │ ├── arguments: ∅
- │ │ │ ├── closing_loc: ∅
- │ │ │ ├── block: ∅
- │ │ │ ├── flags: variable_call
- │ │ │ └── name: "baz"
- │ │ └── operator_loc: (121...122) = "&"
+ │ ├── arguments: ∅
│ ├── closing_loc: ∅
- │ ├── block: ∅
+ │ ├── block:
+ │ │ @ BlockArgumentNode (location: (121...125))
+ │ │ ├── expression:
+ │ │ │ @ CallNode (location: (122...125))
+ │ │ │ ├── receiver: ∅
+ │ │ │ ├── call_operator_loc: ∅
+ │ │ │ ├── message_loc: (122...125) = "baz"
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── arguments: ∅
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ ├── block: ∅
+ │ │ │ ├── flags: variable_call
+ │ │ │ └── name: "baz"
+ │ │ └── operator_loc: (121...122) = "&"
│ ├── flags: ∅
│ └── name: "Bar"
├── @ CallNode (location: (127...135))
diff --git a/test/yarp/snapshots/method_calls.txt b/test/yarp/snapshots/method_calls.txt
index 55dd0cdf69..0225e1d182 100644
--- a/test/yarp/snapshots/method_calls.txt
+++ b/test/yarp/snapshots/method_calls.txt
@@ -267,29 +267,27 @@
│ ├── block: ∅
│ ├── flags: ∅
│ └── name: "a?"
- ├── @ CallNode (location: (108...117))
+ ├── @ CallNode (location: (108...116))
│ ├── receiver: ∅
│ ├── call_operator_loc: ∅
│ ├── message_loc: (108...109) = "a"
│ ├── opening_loc: (109...110) = "("
- │ ├── arguments:
- │ │ @ ArgumentsNode (location: (110...116))
- │ │ └── arguments: (length: 1)
- │ │ └── @ BlockArgumentNode (location: (110...116))
- │ │ ├── expression:
- │ │ │ @ CallNode (location: (111...116))
- │ │ │ ├── receiver: ∅
- │ │ │ ├── call_operator_loc: ∅
- │ │ │ ├── message_loc: (111...116) = "block"
- │ │ │ ├── opening_loc: ∅
- │ │ │ ├── arguments: ∅
- │ │ │ ├── closing_loc: ∅
- │ │ │ ├── block: ∅
- │ │ │ ├── flags: variable_call
- │ │ │ └── name: "block"
- │ │ └── operator_loc: (110...111) = "&"
+ │ ├── arguments: ∅
│ ├── closing_loc: (116...117) = ")"
- │ ├── block: ∅
+ │ ├── block:
+ │ │ @ BlockArgumentNode (location: (110...116))
+ │ │ ├── expression:
+ │ │ │ @ CallNode (location: (111...116))
+ │ │ │ ├── receiver: ∅
+ │ │ │ ├── call_operator_loc: ∅
+ │ │ │ ├── message_loc: (111...116) = "block"
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── arguments: ∅
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ ├── block: ∅
+ │ │ │ ├── flags: variable_call
+ │ │ │ └── name: "block"
+ │ │ └── operator_loc: (110...111) = "&"
│ ├── flags: ∅
│ └── name: "a"
├── @ CallNode (location: (119...130))
@@ -751,68 +749,68 @@
│ ├── block: ∅
│ ├── flags: ∅
│ └── name: "foo"
- ├── @ CallNode (location: (300...340))
+ ├── @ CallNode (location: (300...339))
│ ├── receiver: ∅
│ ├── call_operator_loc: ∅
│ ├── message_loc: (300...303) = "foo"
│ ├── opening_loc: (303...304) = "("
│ ├── arguments:
- │ │ @ ArgumentsNode (location: (304...339))
- │ │ └── arguments: (length: 3)
+ │ │ @ ArgumentsNode (location: (304...332))
+ │ │ └── arguments: (length: 2)
│ │ ├── @ SymbolNode (location: (304...306))
│ │ │ ├── opening_loc: (304...305) = ":"
│ │ │ ├── value_loc: (305...306) = "a"
│ │ │ ├── closing_loc: ∅
│ │ │ └── unescaped: "a"
- │ │ ├── @ KeywordHashNode (location: (308...332))
- │ │ │ └── elements: (length: 2)
- │ │ │ ├── @ AssocNode (location: (308...322))
- │ │ │ │ ├── key:
- │ │ │ │ │ @ SymbolNode (location: (308...310))
- │ │ │ │ │ ├── opening_loc: (308...309) = ":"
- │ │ │ │ │ ├── value_loc: (309...310) = "h"
- │ │ │ │ │ ├── closing_loc: ∅
- │ │ │ │ │ └── unescaped: "h"
- │ │ │ │ ├── value:
- │ │ │ │ │ @ ArrayNode (location: (314...322))
- │ │ │ │ │ ├── elements: (length: 2)
- │ │ │ │ │ │ ├── @ SymbolNode (location: (315...317))
- │ │ │ │ │ │ │ ├── opening_loc: (315...316) = ":"
- │ │ │ │ │ │ │ ├── value_loc: (316...317) = "x"
- │ │ │ │ │ │ │ ├── closing_loc: ∅
- │ │ │ │ │ │ │ └── unescaped: "x"
- │ │ │ │ │ │ └── @ SymbolNode (location: (319...321))
- │ │ │ │ │ │ ├── opening_loc: (319...320) = ":"
- │ │ │ │ │ │ ├── value_loc: (320...321) = "y"
- │ │ │ │ │ │ ├── closing_loc: ∅
- │ │ │ │ │ │ └── unescaped: "y"
- │ │ │ │ │ ├── opening_loc: (314...315) = "["
- │ │ │ │ │ └── closing_loc: (321...322) = "]"
- │ │ │ │ └── operator_loc: (311...313) = "=>"
- │ │ │ └── @ AssocNode (location: (324...332))
- │ │ │ ├── key:
- │ │ │ │ @ SymbolNode (location: (324...326))
- │ │ │ │ ├── opening_loc: (324...325) = ":"
- │ │ │ │ ├── value_loc: (325...326) = "a"
- │ │ │ │ ├── closing_loc: ∅
- │ │ │ │ └── unescaped: "a"
- │ │ │ ├── value:
- │ │ │ │ @ SymbolNode (location: (330...332))
- │ │ │ │ ├── opening_loc: (330...331) = ":"
- │ │ │ │ ├── value_loc: (331...332) = "b"
- │ │ │ │ ├── closing_loc: ∅
- │ │ │ │ └── unescaped: "b"
- │ │ │ └── operator_loc: (327...329) = "=>"
- │ │ └── @ BlockArgumentNode (location: (334...339))
- │ │ ├── expression:
- │ │ │ @ SymbolNode (location: (335...339))
- │ │ │ ├── opening_loc: (335...336) = ":"
- │ │ │ ├── value_loc: (336...339) = "bar"
- │ │ │ ├── closing_loc: ∅
- │ │ │ └── unescaped: "bar"
- │ │ └── operator_loc: (334...335) = "&"
+ │ │ └── @ KeywordHashNode (location: (308...332))
+ │ │ └── elements: (length: 2)
+ │ │ ├── @ AssocNode (location: (308...322))
+ │ │ │ ├── key:
+ │ │ │ │ @ SymbolNode (location: (308...310))
+ │ │ │ │ ├── opening_loc: (308...309) = ":"
+ │ │ │ │ ├── value_loc: (309...310) = "h"
+ │ │ │ │ ├── closing_loc: ∅
+ │ │ │ │ └── unescaped: "h"
+ │ │ │ ├── value:
+ │ │ │ │ @ ArrayNode (location: (314...322))
+ │ │ │ │ ├── elements: (length: 2)
+ │ │ │ │ │ ├── @ SymbolNode (location: (315...317))
+ │ │ │ │ │ │ ├── opening_loc: (315...316) = ":"
+ │ │ │ │ │ │ ├── value_loc: (316...317) = "x"
+ │ │ │ │ │ │ ├── closing_loc: ∅
+ │ │ │ │ │ │ └── unescaped: "x"
+ │ │ │ │ │ └── @ SymbolNode (location: (319...321))
+ │ │ │ │ │ ├── opening_loc: (319...320) = ":"
+ │ │ │ │ │ ├── value_loc: (320...321) = "y"
+ │ │ │ │ │ ├── closing_loc: ∅
+ │ │ │ │ │ └── unescaped: "y"
+ │ │ │ │ ├── opening_loc: (314...315) = "["
+ │ │ │ │ └── closing_loc: (321...322) = "]"
+ │ │ │ └── operator_loc: (311...313) = "=>"
+ │ │ └── @ AssocNode (location: (324...332))
+ │ │ ├── key:
+ │ │ │ @ SymbolNode (location: (324...326))
+ │ │ │ ├── opening_loc: (324...325) = ":"
+ │ │ │ ├── value_loc: (325...326) = "a"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "a"
+ │ │ ├── value:
+ │ │ │ @ SymbolNode (location: (330...332))
+ │ │ │ ├── opening_loc: (330...331) = ":"
+ │ │ │ ├── value_loc: (331...332) = "b"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "b"
+ │ │ └── operator_loc: (327...329) = "=>"
│ ├── closing_loc: (339...340) = ")"
- │ ├── block: ∅
+ │ ├── block:
+ │ │ @ BlockArgumentNode (location: (334...339))
+ │ │ ├── expression:
+ │ │ │ @ SymbolNode (location: (335...339))
+ │ │ │ ├── opening_loc: (335...336) = ":"
+ │ │ │ ├── value_loc: (336...339) = "bar"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "bar"
+ │ │ └── operator_loc: (334...335) = "&"
│ ├── flags: ∅
│ └── name: "foo"
├── @ CallNode (location: (342...391))
@@ -1063,48 +1061,48 @@
│ ├── block: ∅
│ ├── flags: ∅
│ └── name: "hi"
- ├── @ CallNode (location: (535...571))
+ ├── @ CallNode (location: (535...570))
│ ├── receiver: ∅
│ ├── call_operator_loc: ∅
│ ├── message_loc: (535...538) = "foo"
│ ├── opening_loc: (538...539) = "("
│ ├── arguments:
- │ │ @ ArgumentsNode (location: (539...570))
- │ │ └── arguments: (length: 2)
- │ │ ├── @ HashNode (location: (539...561))
- │ │ │ ├── opening_loc: (539...540) = "{"
- │ │ │ ├── elements: (length: 2)
- │ │ │ │ ├── @ AssocNode (location: (541...548))
- │ │ │ │ │ ├── key:
- │ │ │ │ │ │ @ SymbolNode (location: (541...543))
- │ │ │ │ │ │ ├── opening_loc: ∅
- │ │ │ │ │ │ ├── value_loc: (541...542) = "a"
- │ │ │ │ │ │ ├── closing_loc: (542...543) = ":"
- │ │ │ │ │ │ └── unescaped: "a"
- │ │ │ │ │ ├── value:
- │ │ │ │ │ │ @ TrueNode (location: (544...548))
- │ │ │ │ │ └── operator_loc: ∅
- │ │ │ │ └── @ AssocNode (location: (550...558))
- │ │ │ │ ├── key:
- │ │ │ │ │ @ SymbolNode (location: (550...552))
- │ │ │ │ │ ├── opening_loc: ∅
- │ │ │ │ │ ├── value_loc: (550...551) = "b"
- │ │ │ │ │ ├── closing_loc: (551...552) = ":"
- │ │ │ │ │ └── unescaped: "b"
- │ │ │ │ ├── value:
- │ │ │ │ │ @ FalseNode (location: (553...558))
- │ │ │ │ └── operator_loc: ∅
- │ │ │ └── closing_loc: (560...561) = "}"
- │ │ └── @ BlockArgumentNode (location: (563...570))
- │ │ ├── expression:
- │ │ │ @ SymbolNode (location: (564...570))
- │ │ │ ├── opening_loc: (564...565) = ":"
- │ │ │ ├── value_loc: (565...570) = "block"
- │ │ │ ├── closing_loc: ∅
- │ │ │ └── unescaped: "block"
- │ │ └── operator_loc: (563...564) = "&"
+ │ │ @ ArgumentsNode (location: (539...561))
+ │ │ └── arguments: (length: 1)
+ │ │ └── @ HashNode (location: (539...561))
+ │ │ ├── opening_loc: (539...540) = "{"
+ │ │ ├── elements: (length: 2)
+ │ │ │ ├── @ AssocNode (location: (541...548))
+ │ │ │ │ ├── key:
+ │ │ │ │ │ @ SymbolNode (location: (541...543))
+ │ │ │ │ │ ├── opening_loc: ∅
+ │ │ │ │ │ ├── value_loc: (541...542) = "a"
+ │ │ │ │ │ ├── closing_loc: (542...543) = ":"
+ │ │ │ │ │ └── unescaped: "a"
+ │ │ │ │ ├── value:
+ │ │ │ │ │ @ TrueNode (location: (544...548))
+ │ │ │ │ └── operator_loc: ∅
+ │ │ │ └── @ AssocNode (location: (550...558))
+ │ │ │ ├── key:
+ │ │ │ │ @ SymbolNode (location: (550...552))
+ │ │ │ │ ├── opening_loc: ∅
+ │ │ │ │ ├── value_loc: (550...551) = "b"
+ │ │ │ │ ├── closing_loc: (551...552) = ":"
+ │ │ │ │ └── unescaped: "b"
+ │ │ │ ├── value:
+ │ │ │ │ @ FalseNode (location: (553...558))
+ │ │ │ └── operator_loc: ∅
+ │ │ └── closing_loc: (560...561) = "}"
│ ├── closing_loc: (570...571) = ")"
- │ ├── block: ∅
+ │ ├── block:
+ │ │ @ BlockArgumentNode (location: (563...570))
+ │ │ ├── expression:
+ │ │ │ @ SymbolNode (location: (564...570))
+ │ │ │ ├── opening_loc: (564...565) = ":"
+ │ │ │ ├── value_loc: (565...570) = "block"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "block"
+ │ │ └── operator_loc: (563...564) = "&"
│ ├── flags: ∅
│ └── name: "foo"
├── @ CallNode (location: (573...593))
@@ -1195,19 +1193,17 @@
│ ├── call_operator_loc: ∅
│ ├── message_loc: (629...632) = "foo"
│ ├── opening_loc: ∅
- │ ├── arguments:
- │ │ @ ArgumentsNode (location: (633...640))
- │ │ └── arguments: (length: 1)
- │ │ └── @ BlockArgumentNode (location: (633...640))
- │ │ ├── expression:
- │ │ │ @ SymbolNode (location: (634...640))
- │ │ │ ├── opening_loc: (634...635) = ":"
- │ │ │ ├── value_loc: (635...640) = "block"
- │ │ │ ├── closing_loc: ∅
- │ │ │ └── unescaped: "block"
- │ │ └── operator_loc: (633...634) = "&"
+ │ ├── arguments: ∅
│ ├── closing_loc: ∅
- │ ├── block: ∅
+ │ ├── block:
+ │ │ @ BlockArgumentNode (location: (633...640))
+ │ │ ├── expression:
+ │ │ │ @ SymbolNode (location: (634...640))
+ │ │ │ ├── opening_loc: (634...635) = ":"
+ │ │ │ ├── value_loc: (635...640) = "block"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "block"
+ │ │ └── operator_loc: (633...634) = "&"
│ ├── flags: ∅
│ └── name: "foo"
├── @ CallNode (location: (642...672))
@@ -1216,40 +1212,40 @@
│ ├── message_loc: (642...645) = "foo"
│ ├── opening_loc: ∅
│ ├── arguments:
- │ │ @ ArgumentsNode (location: (646...672))
- │ │ └── arguments: (length: 2)
- │ │ ├── @ KeywordHashNode (location: (646...663))
- │ │ │ └── elements: (length: 2)
- │ │ │ ├── @ AssocNode (location: (646...653))
- │ │ │ │ ├── key:
- │ │ │ │ │ @ SymbolNode (location: (646...648))
- │ │ │ │ │ ├── opening_loc: ∅
- │ │ │ │ │ ├── value_loc: (646...647) = "a"
- │ │ │ │ │ ├── closing_loc: (647...648) = ":"
- │ │ │ │ │ └── unescaped: "a"
- │ │ │ │ ├── value:
- │ │ │ │ │ @ TrueNode (location: (649...653))
- │ │ │ │ └── operator_loc: ∅
- │ │ │ └── @ AssocNode (location: (655...663))
- │ │ │ ├── key:
- │ │ │ │ @ SymbolNode (location: (655...657))
- │ │ │ │ ├── opening_loc: ∅
- │ │ │ │ ├── value_loc: (655...656) = "b"
- │ │ │ │ ├── closing_loc: (656...657) = ":"
- │ │ │ │ └── unescaped: "b"
- │ │ │ ├── value:
- │ │ │ │ @ FalseNode (location: (658...663))
- │ │ │ └── operator_loc: ∅
- │ │ └── @ BlockArgumentNode (location: (665...672))
- │ │ ├── expression:
- │ │ │ @ SymbolNode (location: (666...672))
- │ │ │ ├── opening_loc: (666...667) = ":"
- │ │ │ ├── value_loc: (667...672) = "block"
- │ │ │ ├── closing_loc: ∅
- │ │ │ └── unescaped: "block"
- │ │ └── operator_loc: (665...666) = "&"
+ │ │ @ ArgumentsNode (location: (646...663))
+ │ │ └── arguments: (length: 1)
+ │ │ └── @ KeywordHashNode (location: (646...663))
+ │ │ └── elements: (length: 2)
+ │ │ ├── @ AssocNode (location: (646...653))
+ │ │ │ ├── key:
+ │ │ │ │ @ SymbolNode (location: (646...648))
+ │ │ │ │ ├── opening_loc: ∅
+ │ │ │ │ ├── value_loc: (646...647) = "a"
+ │ │ │ │ ├── closing_loc: (647...648) = ":"
+ │ │ │ │ └── unescaped: "a"
+ │ │ │ ├── value:
+ │ │ │ │ @ TrueNode (location: (649...653))
+ │ │ │ └── operator_loc: ∅
+ │ │ └── @ AssocNode (location: (655...663))
+ │ │ ├── key:
+ │ │ │ @ SymbolNode (location: (655...657))
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── value_loc: (655...656) = "b"
+ │ │ │ ├── closing_loc: (656...657) = ":"
+ │ │ │ └── unescaped: "b"
+ │ │ ├── value:
+ │ │ │ @ FalseNode (location: (658...663))
+ │ │ └── operator_loc: ∅
│ ├── closing_loc: ∅
- │ ├── block: ∅
+ │ ├── block:
+ │ │ @ BlockArgumentNode (location: (665...672))
+ │ │ ├── expression:
+ │ │ │ @ SymbolNode (location: (666...672))
+ │ │ │ ├── opening_loc: (666...667) = ":"
+ │ │ │ ├── value_loc: (667...672) = "block"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "block"
+ │ │ └── operator_loc: (665...666) = "&"
│ ├── flags: ∅
│ └── name: "foo"
├── @ CallNode (location: (674...695))
diff --git a/test/yarp/snapshots/seattlerb/call_block_arg_named.txt b/test/yarp/snapshots/seattlerb/call_block_arg_named.txt
index 70ef65f9e8..6ab3184974 100644
--- a/test/yarp/snapshots/seattlerb/call_block_arg_named.txt
+++ b/test/yarp/snapshots/seattlerb/call_block_arg_named.txt
@@ -1,30 +1,28 @@
-@ ProgramNode (location: (0...7))
+@ ProgramNode (location: (0...6))
├── locals: []
└── statements:
- @ StatementsNode (location: (0...7))
+ @ StatementsNode (location: (0...6))
└── body: (length: 1)
- └── @ CallNode (location: (0...7))
+ └── @ CallNode (location: (0...6))
├── receiver: ∅
├── call_operator_loc: ∅
├── message_loc: (0...1) = "x"
├── opening_loc: (1...2) = "("
- ├── arguments:
- │ @ ArgumentsNode (location: (2...6))
- │ └── arguments: (length: 1)
- │ └── @ BlockArgumentNode (location: (2...6))
- │ ├── expression:
- │ │ @ CallNode (location: (3...6))
- │ │ ├── receiver: ∅
- │ │ ├── call_operator_loc: ∅
- │ │ ├── message_loc: (3...6) = "blk"
- │ │ ├── opening_loc: ∅
- │ │ ├── arguments: ∅
- │ │ ├── closing_loc: ∅
- │ │ ├── block: ∅
- │ │ ├── flags: variable_call
- │ │ └── name: "blk"
- │ └── operator_loc: (2...3) = "&"
+ ├── arguments: ∅
├── closing_loc: (6...7) = ")"
- ├── block: ∅
+ ├── block:
+ │ @ BlockArgumentNode (location: (2...6))
+ │ ├── expression:
+ │ │ @ CallNode (location: (3...6))
+ │ │ ├── receiver: ∅
+ │ │ ├── call_operator_loc: ∅
+ │ │ ├── message_loc: (3...6) = "blk"
+ │ │ ├── opening_loc: ∅
+ │ │ ├── arguments: ∅
+ │ │ ├── closing_loc: ∅
+ │ │ ├── block: ∅
+ │ │ ├── flags: variable_call
+ │ │ └── name: "blk"
+ │ └── operator_loc: (2...3) = "&"
├── flags: ∅
└── name: "x"
diff --git a/test/yarp/snapshots/unparser/corpus/literal/send.txt b/test/yarp/snapshots/unparser/corpus/literal/send.txt
index 035287f96c..25202c1fe7 100644
--- a/test/yarp/snapshots/unparser/corpus/literal/send.txt
+++ b/test/yarp/snapshots/unparser/corpus/literal/send.txt
@@ -745,112 +745,108 @@
│ ├── block: ∅
│ ├── flags: ∅
│ └── name: "=~"
- ├── @ CallNode (location: (464...482))
+ ├── @ CallNode (location: (464...481))
│ ├── receiver: ∅
│ ├── call_operator_loc: ∅
│ ├── message_loc: (464...467) = "foo"
│ ├── opening_loc: (467...468) = "("
- │ ├── arguments:
- │ │ @ ArgumentsNode (location: (468...481))
- │ │ └── arguments: (length: 1)
- │ │ └── @ BlockArgumentNode (location: (468...481))
- │ │ ├── expression:
- │ │ │ @ ParenthesesNode (location: (469...481))
- │ │ │ ├── body:
- │ │ │ │ @ StatementsNode (location: (470...480))
- │ │ │ │ └── body: (length: 1)
- │ │ │ │ └── @ OrNode (location: (470...480))
- │ │ │ │ ├── left:
- │ │ │ │ │ @ CallNode (location: (470...473))
- │ │ │ │ │ ├── receiver: ∅
- │ │ │ │ │ ├── call_operator_loc: ∅
- │ │ │ │ │ ├── message_loc: (470...473) = "foo"
- │ │ │ │ │ ├── opening_loc: ∅
- │ │ │ │ │ ├── arguments: ∅
- │ │ │ │ │ ├── closing_loc: ∅
- │ │ │ │ │ ├── block: ∅
- │ │ │ │ │ ├── flags: variable_call
- │ │ │ │ │ └── name: "foo"
- │ │ │ │ ├── right:
- │ │ │ │ │ @ CallNode (location: (477...480))
- │ │ │ │ │ ├── receiver: ∅
- │ │ │ │ │ ├── call_operator_loc: ∅
- │ │ │ │ │ ├── message_loc: (477...480) = "bar"
- │ │ │ │ │ ├── opening_loc: ∅
- │ │ │ │ │ ├── arguments: ∅
- │ │ │ │ │ ├── closing_loc: ∅
- │ │ │ │ │ ├── block: ∅
- │ │ │ │ │ ├── flags: variable_call
- │ │ │ │ │ └── name: "bar"
- │ │ │ │ └── operator_loc: (474...476) = "||"
- │ │ │ ├── opening_loc: (469...470) = "("
- │ │ │ └── closing_loc: (480...481) = ")"
- │ │ └── operator_loc: (468...469) = "&"
+ │ ├── arguments: ∅
│ ├── closing_loc: (481...482) = ")"
- │ ├── block: ∅
+ │ ├── block:
+ │ │ @ BlockArgumentNode (location: (468...481))
+ │ │ ├── expression:
+ │ │ │ @ ParenthesesNode (location: (469...481))
+ │ │ │ ├── body:
+ │ │ │ │ @ StatementsNode (location: (470...480))
+ │ │ │ │ └── body: (length: 1)
+ │ │ │ │ └── @ OrNode (location: (470...480))
+ │ │ │ │ ├── left:
+ │ │ │ │ │ @ CallNode (location: (470...473))
+ │ │ │ │ │ ├── receiver: ∅
+ │ │ │ │ │ ├── call_operator_loc: ∅
+ │ │ │ │ │ ├── message_loc: (470...473) = "foo"
+ │ │ │ │ │ ├── opening_loc: ∅
+ │ │ │ │ │ ├── arguments: ∅
+ │ │ │ │ │ ├── closing_loc: ∅
+ │ │ │ │ │ ├── block: ∅
+ │ │ │ │ │ ├── flags: variable_call
+ │ │ │ │ │ └── name: "foo"
+ │ │ │ │ ├── right:
+ │ │ │ │ │ @ CallNode (location: (477...480))
+ │ │ │ │ │ ├── receiver: ∅
+ │ │ │ │ │ ├── call_operator_loc: ∅
+ │ │ │ │ │ ├── message_loc: (477...480) = "bar"
+ │ │ │ │ │ ├── opening_loc: ∅
+ │ │ │ │ │ ├── arguments: ∅
+ │ │ │ │ │ ├── closing_loc: ∅
+ │ │ │ │ │ ├── block: ∅
+ │ │ │ │ │ ├── flags: variable_call
+ │ │ │ │ │ └── name: "bar"
+ │ │ │ │ └── operator_loc: (474...476) = "||"
+ │ │ │ ├── opening_loc: (469...470) = "("
+ │ │ │ └── closing_loc: (480...481) = ")"
+ │ │ └── operator_loc: (468...469) = "&"
│ ├── flags: ∅
│ └── name: "foo"
- ├── @ CallNode (location: (483...494))
+ ├── @ CallNode (location: (483...493))
│ ├── receiver: ∅
│ ├── call_operator_loc: ∅
│ ├── message_loc: (483...486) = "foo"
│ ├── opening_loc: (486...487) = "("
- │ ├── arguments:
- │ │ @ ArgumentsNode (location: (487...493))
- │ │ └── arguments: (length: 1)
- │ │ └── @ BlockArgumentNode (location: (487...493))
- │ │ ├── expression:
- │ │ │ @ CallNode (location: (488...493))
- │ │ │ ├── receiver: ∅
- │ │ │ ├── call_operator_loc: ∅
- │ │ │ ├── message_loc: (488...493) = "block"
- │ │ │ ├── opening_loc: ∅
- │ │ │ ├── arguments: ∅
- │ │ │ ├── closing_loc: ∅
- │ │ │ ├── block: ∅
- │ │ │ ├── flags: variable_call
- │ │ │ └── name: "block"
- │ │ └── operator_loc: (487...488) = "&"
+ │ ├── arguments: ∅
│ ├── closing_loc: (493...494) = ")"
- │ ├── block: ∅
+ │ ├── block:
+ │ │ @ BlockArgumentNode (location: (487...493))
+ │ │ ├── expression:
+ │ │ │ @ CallNode (location: (488...493))
+ │ │ │ ├── receiver: ∅
+ │ │ │ ├── call_operator_loc: ∅
+ │ │ │ ├── message_loc: (488...493) = "block"
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── arguments: ∅
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ ├── block: ∅
+ │ │ │ ├── flags: variable_call
+ │ │ │ └── name: "block"
+ │ │ └── operator_loc: (487...488) = "&"
│ ├── flags: ∅
│ └── name: "foo"
- ├── @ CallNode (location: (495...513))
+ ├── @ CallNode (location: (495...512))
│ ├── receiver: ∅
│ ├── call_operator_loc: ∅
│ ├── message_loc: (495...498) = "foo"
│ ├── opening_loc: (498...499) = "("
│ ├── arguments:
- │ │ @ ArgumentsNode (location: (499...512))
- │ │ └── arguments: (length: 2)
- │ │ ├── @ SplatNode (location: (499...504))
- │ │ │ ├── operator_loc: (499...500) = "*"
- │ │ │ └── expression:
- │ │ │ @ CallNode (location: (500...504))
- │ │ │ ├── receiver: ∅
- │ │ │ ├── call_operator_loc: ∅
- │ │ │ ├── message_loc: (500...504) = "args"
- │ │ │ ├── opening_loc: ∅
- │ │ │ ├── arguments: ∅
- │ │ │ ├── closing_loc: ∅
- │ │ │ ├── block: ∅
- │ │ │ ├── flags: variable_call
- │ │ │ └── name: "args"
- │ │ └── @ BlockArgumentNode (location: (506...512))
- │ │ ├── expression:
- │ │ │ @ CallNode (location: (507...512))
- │ │ │ ├── receiver: ∅
- │ │ │ ├── call_operator_loc: ∅
- │ │ │ ├── message_loc: (507...512) = "block"
- │ │ │ ├── opening_loc: ∅
- │ │ │ ├── arguments: ∅
- │ │ │ ├── closing_loc: ∅
- │ │ │ ├── block: ∅
- │ │ │ ├── flags: variable_call
- │ │ │ └── name: "block"
- │ │ └── operator_loc: (506...507) = "&"
+ │ │ @ ArgumentsNode (location: (499...504))
+ │ │ └── arguments: (length: 1)
+ │ │ └── @ SplatNode (location: (499...504))
+ │ │ ├── operator_loc: (499...500) = "*"
+ │ │ └── expression:
+ │ │ @ CallNode (location: (500...504))
+ │ │ ├── receiver: ∅
+ │ │ ├── call_operator_loc: ∅
+ │ │ ├── message_loc: (500...504) = "args"
+ │ │ ├── opening_loc: ∅
+ │ │ ├── arguments: ∅
+ │ │ ├── closing_loc: ∅
+ │ │ ├── block: ∅
+ │ │ ├── flags: variable_call
+ │ │ └── name: "args"
│ ├── closing_loc: (512...513) = ")"
- │ ├── block: ∅
+ │ ├── block:
+ │ │ @ BlockArgumentNode (location: (506...512))
+ │ │ ├── expression:
+ │ │ │ @ CallNode (location: (507...512))
+ │ │ │ ├── receiver: ∅
+ │ │ │ ├── call_operator_loc: ∅
+ │ │ │ ├── message_loc: (507...512) = "block"
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── arguments: ∅
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ ├── block: ∅
+ │ │ │ ├── flags: variable_call
+ │ │ │ └── name: "block"
+ │ │ └── operator_loc: (506...507) = "&"
│ ├── flags: ∅
│ └── name: "foo"
├── @ CallNode (location: (514...529))
@@ -991,7 +987,7 @@
│ ├── block: ∅
│ ├── flags: ∅
│ └── name: "foo"
- ├── @ CallNode (location: (583...596))
+ ├── @ CallNode (location: (583...595))
│ ├── receiver:
│ │ @ CallNode (location: (583...586))
│ │ ├── receiver: ∅
@@ -1006,24 +1002,22 @@
│ ├── call_operator_loc: (586...587) = "."
│ ├── message_loc: (587...590) = "bar"
│ ├── opening_loc: (590...591) = "("
- │ ├── arguments:
- │ │ @ ArgumentsNode (location: (591...595))
- │ │ └── arguments: (length: 1)
- │ │ └── @ BlockArgumentNode (location: (591...595))
- │ │ ├── expression:
- │ │ │ @ CallNode (location: (592...595))
- │ │ │ ├── receiver: ∅
- │ │ │ ├── call_operator_loc: ∅
- │ │ │ ├── message_loc: (592...595) = "baz"
- │ │ │ ├── opening_loc: ∅
- │ │ │ ├── arguments: ∅
- │ │ │ ├── closing_loc: ∅
- │ │ │ ├── block: ∅
- │ │ │ ├── flags: variable_call
- │ │ │ └── name: "baz"
- │ │ └── operator_loc: (591...592) = "&"
+ │ ├── arguments: ∅
│ ├── closing_loc: (595...596) = ")"
- │ ├── block: ∅
+ │ ├── block:
+ │ │ @ BlockArgumentNode (location: (591...595))
+ │ │ ├── expression:
+ │ │ │ @ CallNode (location: (592...595))
+ │ │ │ ├── receiver: ∅
+ │ │ │ ├── call_operator_loc: ∅
+ │ │ │ ├── message_loc: (592...595) = "baz"
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── arguments: ∅
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ ├── block: ∅
+ │ │ │ ├── flags: variable_call
+ │ │ │ └── name: "baz"
+ │ │ └── operator_loc: (591...592) = "&"
│ ├── flags: ∅
│ └── name: "bar"
├── @ CallNode (location: (597...623))
@@ -1164,7 +1158,7 @@
│ ├── block: ∅
│ ├── flags: ∅
│ └── name: "bar"
- ├── @ CallNode (location: (659...678))
+ ├── @ CallNode (location: (659...677))
│ ├── receiver:
│ │ @ CallNode (location: (659...662))
│ │ ├── receiver: ∅
@@ -1180,28 +1174,28 @@
│ ├── message_loc: (663...666) = "bar"
│ ├── opening_loc: (666...667) = "("
│ ├── arguments:
- │ │ @ ArgumentsNode (location: (667...677))
- │ │ └── arguments: (length: 2)
- │ │ ├── @ SymbolNode (location: (667...671))
- │ │ │ ├── opening_loc: (667...668) = ":"
- │ │ │ ├── value_loc: (668...671) = "baz"
- │ │ │ ├── closing_loc: ∅
- │ │ │ └── unescaped: "baz"
- │ │ └── @ BlockArgumentNode (location: (673...677))
- │ │ ├── expression:
- │ │ │ @ CallNode (location: (674...677))
- │ │ │ ├── receiver: ∅
- │ │ │ ├── call_operator_loc: ∅
- │ │ │ ├── message_loc: (674...677) = "baz"
- │ │ │ ├── opening_loc: ∅
- │ │ │ ├── arguments: ∅
- │ │ │ ├── closing_loc: ∅
- │ │ │ ├── block: ∅
- │ │ │ ├── flags: variable_call
- │ │ │ └── name: "baz"
- │ │ └── operator_loc: (673...674) = "&"
+ │ │ @ ArgumentsNode (location: (667...671))
+ │ │ └── arguments: (length: 1)
+ │ │ └── @ SymbolNode (location: (667...671))
+ │ │ ├── opening_loc: (667...668) = ":"
+ │ │ ├── value_loc: (668...671) = "baz"
+ │ │ ├── closing_loc: ∅
+ │ │ └── unescaped: "baz"
│ ├── closing_loc: (677...678) = ")"
- │ ├── block: ∅
+ │ ├── block:
+ │ │ @ BlockArgumentNode (location: (673...677))
+ │ │ ├── expression:
+ │ │ │ @ CallNode (location: (674...677))
+ │ │ │ ├── receiver: ∅
+ │ │ │ ├── call_operator_loc: ∅
+ │ │ │ ├── message_loc: (674...677) = "baz"
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── arguments: ∅
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ ├── block: ∅
+ │ │ │ ├── flags: variable_call
+ │ │ │ └── name: "baz"
+ │ │ └── operator_loc: (673...674) = "&"
│ ├── flags: ∅
│ └── name: "bar"
├── @ CallNode (location: (679...696))
@@ -1346,7 +1340,7 @@
│ ├── block: ∅
│ ├── flags: ∅
│ └── name: "bar"
- ├── @ CallNode (location: (744...771))
+ ├── @ CallNode (location: (744...770))
│ ├── receiver:
│ │ @ CallNode (location: (744...747))
│ │ ├── receiver: ∅
@@ -1362,8 +1356,8 @@
│ ├── message_loc: (748...751) = "bar"
│ ├── opening_loc: (751...752) = "("
│ ├── arguments:
- │ │ @ ArgumentsNode (location: (752...770))
- │ │ └── arguments: (length: 3)
+ │ │ @ ArgumentsNode (location: (752...762))
+ │ │ └── arguments: (length: 2)
│ │ ├── @ CallNode (location: (752...755))
│ │ │ ├── receiver: ∅
│ │ │ ├── call_operator_loc: ∅
@@ -1374,34 +1368,34 @@
│ │ │ ├── block: ∅
│ │ │ ├── flags: variable_call
│ │ │ └── name: "foo"
- │ │ ├── @ SplatNode (location: (757...762))
- │ │ │ ├── operator_loc: (757...758) = "*"
- │ │ │ └── expression:
- │ │ │ @ CallNode (location: (758...762))
- │ │ │ ├── receiver: ∅
- │ │ │ ├── call_operator_loc: ∅
- │ │ │ ├── message_loc: (758...762) = "args"
- │ │ │ ├── opening_loc: ∅
- │ │ │ ├── arguments: ∅
- │ │ │ ├── closing_loc: ∅
- │ │ │ ├── block: ∅
- │ │ │ ├── flags: variable_call
- │ │ │ └── name: "args"
- │ │ └── @ BlockArgumentNode (location: (764...770))
- │ │ ├── expression:
- │ │ │ @ CallNode (location: (765...770))
- │ │ │ ├── receiver: ∅
- │ │ │ ├── call_operator_loc: ∅
- │ │ │ ├── message_loc: (765...770) = "block"
- │ │ │ ├── opening_loc: ∅
- │ │ │ ├── arguments: ∅
- │ │ │ ├── closing_loc: ∅
- │ │ │ ├── block: ∅
- │ │ │ ├── flags: variable_call
- │ │ │ └── name: "block"
- │ │ └── operator_loc: (764...765) = "&"
+ │ │ └── @ SplatNode (location: (757...762))
+ │ │ ├── operator_loc: (757...758) = "*"
+ │ │ └── expression:
+ │ │ @ CallNode (location: (758...762))
+ │ │ ├── receiver: ∅
+ │ │ ├── call_operator_loc: ∅
+ │ │ ├── message_loc: (758...762) = "args"
+ │ │ ├── opening_loc: ∅
+ │ │ ├── arguments: ∅
+ │ │ ├── closing_loc: ∅
+ │ │ ├── block: ∅
+ │ │ ├── flags: variable_call
+ │ │ └── name: "args"
│ ├── closing_loc: (770...771) = ")"
- │ ├── block: ∅
+ │ ├── block:
+ │ │ @ BlockArgumentNode (location: (764...770))
+ │ │ ├── expression:
+ │ │ │ @ CallNode (location: (765...770))
+ │ │ │ ├── receiver: ∅
+ │ │ │ ├── call_operator_loc: ∅
+ │ │ │ ├── message_loc: (765...770) = "block"
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── arguments: ∅
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ ├── block: ∅
+ │ │ │ ├── flags: variable_call
+ │ │ │ └── name: "block"
+ │ │ └── operator_loc: (764...765) = "&"
│ ├── flags: ∅
│ └── name: "bar"
├── @ CallNode (location: (772...788))
diff --git a/test/yarp/snapshots/unparser/corpus/literal/since/31.txt b/test/yarp/snapshots/unparser/corpus/literal/since/31.txt
index 2932955b49..c8a07a5d28 100644
--- a/test/yarp/snapshots/unparser/corpus/literal/since/31.txt
+++ b/test/yarp/snapshots/unparser/corpus/literal/since/31.txt
@@ -21,21 +21,19 @@
│ │ ├── name_loc: ∅
│ │ └── operator_loc: (8...9) = "&"
│ ├── body:
- │ │ @ StatementsNode (location: (13...19))
+ │ │ @ StatementsNode (location: (13...18))
│ │ └── body: (length: 1)
- │ │ └── @ CallNode (location: (13...19))
+ │ │ └── @ CallNode (location: (13...18))
│ │ ├── receiver: ∅
│ │ ├── call_operator_loc: ∅
│ │ ├── message_loc: (13...16) = "bar"
│ │ ├── opening_loc: (16...17) = "("
- │ │ ├── arguments:
- │ │ │ @ ArgumentsNode (location: (17...18))
- │ │ │ └── arguments: (length: 1)
- │ │ │ └── @ BlockArgumentNode (location: (17...18))
- │ │ │ ├── expression: ∅
- │ │ │ └── operator_loc: (17...18) = "&"
+ │ │ ├── arguments: ∅
│ │ ├── closing_loc: (18...19) = ")"
- │ │ ├── block: ∅
+ │ │ ├── block:
+ │ │ │ @ BlockArgumentNode (location: (17...18))
+ │ │ │ ├── expression: ∅
+ │ │ │ └── operator_loc: (17...18) = "&"
│ │ ├── flags: ∅
│ │ └── name: "bar"
│ ├── locals: [:&]
@@ -65,21 +63,19 @@
│ ├── name_loc: ∅
│ └── operator_loc: (36...37) = "&"
├── body:
- │ @ StatementsNode (location: (41...47))
+ │ @ StatementsNode (location: (41...46))
│ └── body: (length: 1)
- │ └── @ CallNode (location: (41...47))
+ │ └── @ CallNode (location: (41...46))
│ ├── receiver: ∅
│ ├── call_operator_loc: ∅
│ ├── message_loc: (41...44) = "bar"
│ ├── opening_loc: (44...45) = "("
- │ ├── arguments:
- │ │ @ ArgumentsNode (location: (45...46))
- │ │ └── arguments: (length: 1)
- │ │ └── @ BlockArgumentNode (location: (45...46))
- │ │ ├── expression: ∅
- │ │ └── operator_loc: (45...46) = "&"
+ │ ├── arguments: ∅
│ ├── closing_loc: (46...47) = ")"
- │ ├── block: ∅
+ │ ├── block:
+ │ │ @ BlockArgumentNode (location: (45...46))
+ │ │ ├── expression: ∅
+ │ │ └── operator_loc: (45...46) = "&"
│ ├── flags: ∅
│ └── name: "bar"
├── locals: [:a, :&]
diff --git a/test/yarp/snapshots/unparser/corpus/literal/super.txt b/test/yarp/snapshots/unparser/corpus/literal/super.txt
index 71550e5acc..117ffd2949 100644
--- a/test/yarp/snapshots/unparser/corpus/literal/super.txt
+++ b/test/yarp/snapshots/unparser/corpus/literal/super.txt
@@ -57,58 +57,56 @@
│ │ └── name: "b"
│ ├── rparen_loc: (33...34) = ")"
│ └── block: ∅
- ├── @ SuperNode (location: (35...48))
+ ├── @ SuperNode (location: (35...47))
│ ├── keyword_loc: (35...40) = "super"
│ ├── lparen_loc: (40...41) = "("
- │ ├── arguments:
- │ │ @ ArgumentsNode (location: (41...47))
- │ │ └── arguments: (length: 1)
- │ │ └── @ BlockArgumentNode (location: (41...47))
- │ │ ├── expression:
- │ │ │ @ CallNode (location: (42...47))
- │ │ │ ├── receiver: ∅
- │ │ │ ├── call_operator_loc: ∅
- │ │ │ ├── message_loc: (42...47) = "block"
- │ │ │ ├── opening_loc: ∅
- │ │ │ ├── arguments: ∅
- │ │ │ ├── closing_loc: ∅
- │ │ │ ├── block: ∅
- │ │ │ ├── flags: variable_call
- │ │ │ └── name: "block"
- │ │ └── operator_loc: (41...42) = "&"
+ │ ├── arguments: ∅
│ ├── rparen_loc: (47...48) = ")"
- │ └── block: ∅
- ├── @ SuperNode (location: (49...65))
+ │ └── block:
+ │ @ BlockArgumentNode (location: (41...47))
+ │ ├── expression:
+ │ │ @ CallNode (location: (42...47))
+ │ │ ├── receiver: ∅
+ │ │ ├── call_operator_loc: ∅
+ │ │ ├── message_loc: (42...47) = "block"
+ │ │ ├── opening_loc: ∅
+ │ │ ├── arguments: ∅
+ │ │ ├── closing_loc: ∅
+ │ │ ├── block: ∅
+ │ │ ├── flags: variable_call
+ │ │ └── name: "block"
+ │ └── operator_loc: (41...42) = "&"
+ ├── @ SuperNode (location: (49...64))
│ ├── keyword_loc: (49...54) = "super"
│ ├── lparen_loc: (54...55) = "("
│ ├── arguments:
- │ │ @ ArgumentsNode (location: (55...64))
- │ │ └── arguments: (length: 2)
- │ │ ├── @ CallNode (location: (55...56))
- │ │ │ ├── receiver: ∅
- │ │ │ ├── call_operator_loc: ∅
- │ │ │ ├── message_loc: (55...56) = "a"
- │ │ │ ├── opening_loc: ∅
- │ │ │ ├── arguments: ∅
- │ │ │ ├── closing_loc: ∅
- │ │ │ ├── block: ∅
- │ │ │ ├── flags: variable_call
- │ │ │ └── name: "a"
- │ │ └── @ BlockArgumentNode (location: (58...64))
- │ │ ├── expression:
- │ │ │ @ CallNode (location: (59...64))
- │ │ │ ├── receiver: ∅
- │ │ │ ├── call_operator_loc: ∅
- │ │ │ ├── message_loc: (59...64) = "block"
- │ │ │ ├── opening_loc: ∅
- │ │ │ ├── arguments: ∅
- │ │ │ ├── closing_loc: ∅
- │ │ │ ├── block: ∅
- │ │ │ ├── flags: variable_call
- │ │ │ └── name: "block"
- │ │ └── operator_loc: (58...59) = "&"
+ │ │ @ ArgumentsNode (location: (55...56))
+ │ │ └── arguments: (length: 1)
+ │ │ └── @ CallNode (location: (55...56))
+ │ │ ├── receiver: ∅
+ │ │ ├── call_operator_loc: ∅
+ │ │ ├── message_loc: (55...56) = "a"
+ │ │ ├── opening_loc: ∅
+ │ │ ├── arguments: ∅
+ │ │ ├── closing_loc: ∅
+ │ │ ├── block: ∅
+ │ │ ├── flags: variable_call
+ │ │ └── name: "a"
│ ├── rparen_loc: (64...65) = ")"
- │ └── block: ∅
+ │ └── block:
+ │ @ BlockArgumentNode (location: (58...64))
+ │ ├── expression:
+ │ │ @ CallNode (location: (59...64))
+ │ │ ├── receiver: ∅
+ │ │ ├── call_operator_loc: ∅
+ │ │ ├── message_loc: (59...64) = "block"
+ │ │ ├── opening_loc: ∅
+ │ │ ├── arguments: ∅
+ │ │ ├── closing_loc: ∅
+ │ │ ├── block: ∅
+ │ │ ├── flags: variable_call
+ │ │ └── name: "block"
+ │ └── operator_loc: (58...59) = "&"
├── @ SuperNode (location: (66...84))
│ ├── keyword_loc: (66...71) = "super"
│ ├── lparen_loc: (71...72) = "("
diff --git a/test/yarp/snapshots/whitequark/anonymous_blockarg.txt b/test/yarp/snapshots/whitequark/anonymous_blockarg.txt
index 8d7b301185..b2d6e22b5a 100644
--- a/test/yarp/snapshots/whitequark/anonymous_blockarg.txt
+++ b/test/yarp/snapshots/whitequark/anonymous_blockarg.txt
@@ -21,21 +21,19 @@
│ ├── name_loc: ∅
│ └── operator_loc: (8...9) = "&"
├── body:
- │ @ StatementsNode (location: (12...18))
+ │ @ StatementsNode (location: (12...17))
│ └── body: (length: 1)
- │ └── @ CallNode (location: (12...18))
+ │ └── @ CallNode (location: (12...17))
│ ├── receiver: ∅
│ ├── call_operator_loc: ∅
│ ├── message_loc: (12...15) = "bar"
│ ├── opening_loc: (15...16) = "("
- │ ├── arguments:
- │ │ @ ArgumentsNode (location: (16...17))
- │ │ └── arguments: (length: 1)
- │ │ └── @ BlockArgumentNode (location: (16...17))
- │ │ ├── expression: ∅
- │ │ └── operator_loc: (16...17) = "&"
+ │ ├── arguments: ∅
│ ├── closing_loc: (17...18) = ")"
- │ ├── block: ∅
+ │ ├── block:
+ │ │ @ BlockArgumentNode (location: (16...17))
+ │ │ ├── expression: ∅
+ │ │ └── operator_loc: (16...17) = "&"
│ ├── flags: ∅
│ └── name: "bar"
├── locals: [:&]
diff --git a/test/yarp/snapshots/whitequark/args_args_assocs.txt b/test/yarp/snapshots/whitequark/args_args_assocs.txt
index ebec1c5256..545b54e660 100644
--- a/test/yarp/snapshots/whitequark/args_args_assocs.txt
+++ b/test/yarp/snapshots/whitequark/args_args_assocs.txt
@@ -1,7 +1,7 @@
-@ ProgramNode (location: (0...46))
+@ ProgramNode (location: (0...45))
├── locals: []
└── statements:
- @ StatementsNode (location: (0...46))
+ @ StatementsNode (location: (0...45))
└── body: (length: 2)
├── @ CallNode (location: (0...19))
│ ├── receiver: ∅
@@ -38,14 +38,14 @@
│ ├── block: ∅
│ ├── flags: ∅
│ └── name: "fun"
- └── @ CallNode (location: (21...46))
+ └── @ CallNode (location: (21...45))
├── receiver: ∅
├── call_operator_loc: ∅
├── message_loc: (21...24) = "fun"
├── opening_loc: (24...25) = "("
├── arguments:
- │ @ ArgumentsNode (location: (25...45))
- │ └── arguments: (length: 3)
+ │ @ ArgumentsNode (location: (25...39))
+ │ └── arguments: (length: 2)
│ ├── @ CallNode (location: (25...28))
│ │ ├── receiver: ∅
│ │ ├── call_operator_loc: ∅
@@ -56,33 +56,33 @@
│ │ ├── block: ∅
│ │ ├── flags: variable_call
│ │ └── name: "foo"
- │ ├── @ KeywordHashNode (location: (30...39))
- │ │ └── elements: (length: 1)
- │ │ └── @ AssocNode (location: (30...39))
- │ │ ├── key:
- │ │ │ @ SymbolNode (location: (30...34))
- │ │ │ ├── opening_loc: (30...31) = ":"
- │ │ │ ├── value_loc: (31...34) = "foo"
- │ │ │ ├── closing_loc: ∅
- │ │ │ └── unescaped: "foo"
- │ │ ├── value:
- │ │ │ @ IntegerNode (location: (38...39))
- │ │ │ └── flags: decimal
- │ │ └── operator_loc: (35...37) = "=>"
- │ └── @ BlockArgumentNode (location: (41...45))
- │ ├── expression:
- │ │ @ CallNode (location: (42...45))
- │ │ ├── receiver: ∅
- │ │ ├── call_operator_loc: ∅
- │ │ ├── message_loc: (42...45) = "baz"
- │ │ ├── opening_loc: ∅
- │ │ ├── arguments: ∅
- │ │ ├── closing_loc: ∅
- │ │ ├── block: ∅
- │ │ ├── flags: variable_call
- │ │ └── name: "baz"
- │ └── operator_loc: (41...42) = "&"
+ │ └── @ KeywordHashNode (location: (30...39))
+ │ └── elements: (length: 1)
+ │ └── @ AssocNode (location: (30...39))
+ │ ├── key:
+ │ │ @ SymbolNode (location: (30...34))
+ │ │ ├── opening_loc: (30...31) = ":"
+ │ │ ├── value_loc: (31...34) = "foo"
+ │ │ ├── closing_loc: ∅
+ │ │ └── unescaped: "foo"
+ │ ├── value:
+ │ │ @ IntegerNode (location: (38...39))
+ │ │ └── flags: decimal
+ │ └── operator_loc: (35...37) = "=>"
├── closing_loc: (45...46) = ")"
- ├── block: ∅
+ ├── block:
+ │ @ BlockArgumentNode (location: (41...45))
+ │ ├── expression:
+ │ │ @ CallNode (location: (42...45))
+ │ │ ├── receiver: ∅
+ │ │ ├── call_operator_loc: ∅
+ │ │ ├── message_loc: (42...45) = "baz"
+ │ │ ├── opening_loc: ∅
+ │ │ ├── arguments: ∅
+ │ │ ├── closing_loc: ∅
+ │ │ ├── block: ∅
+ │ │ ├── flags: variable_call
+ │ │ └── name: "baz"
+ │ └── operator_loc: (41...42) = "&"
├── flags: ∅
└── name: "fun"
diff --git a/test/yarp/snapshots/whitequark/args_args_star.txt b/test/yarp/snapshots/whitequark/args_args_star.txt
index 6e40ad7fc2..2fa0f0e33e 100644
--- a/test/yarp/snapshots/whitequark/args_args_star.txt
+++ b/test/yarp/snapshots/whitequark/args_args_star.txt
@@ -1,7 +1,7 @@
-@ ProgramNode (location: (0...36))
+@ ProgramNode (location: (0...35))
├── locals: []
└── statements:
- @ StatementsNode (location: (0...36))
+ @ StatementsNode (location: (0...35))
└── body: (length: 2)
├── @ CallNode (location: (0...14))
│ ├── receiver: ∅
@@ -38,14 +38,14 @@
│ ├── block: ∅
│ ├── flags: ∅
│ └── name: "fun"
- └── @ CallNode (location: (16...36))
+ └── @ CallNode (location: (16...35))
├── receiver: ∅
├── call_operator_loc: ∅
├── message_loc: (16...19) = "fun"
├── opening_loc: (19...20) = "("
├── arguments:
- │ @ ArgumentsNode (location: (20...35))
- │ └── arguments: (length: 3)
+ │ @ ArgumentsNode (location: (20...29))
+ │ └── arguments: (length: 2)
│ ├── @ CallNode (location: (20...23))
│ │ ├── receiver: ∅
│ │ ├── call_operator_loc: ∅
@@ -56,33 +56,33 @@
│ │ ├── block: ∅
│ │ ├── flags: variable_call
│ │ └── name: "foo"
- │ ├── @ SplatNode (location: (25...29))
- │ │ ├── operator_loc: (25...26) = "*"
- │ │ └── expression:
- │ │ @ CallNode (location: (26...29))
- │ │ ├── receiver: ∅
- │ │ ├── call_operator_loc: ∅
- │ │ ├── message_loc: (26...29) = "bar"
- │ │ ├── opening_loc: ∅
- │ │ ├── arguments: ∅
- │ │ ├── closing_loc: ∅
- │ │ ├── block: ∅
- │ │ ├── flags: variable_call
- │ │ └── name: "bar"
- │ └── @ BlockArgumentNode (location: (31...35))
- │ ├── expression:
- │ │ @ CallNode (location: (32...35))
- │ │ ├── receiver: ∅
- │ │ ├── call_operator_loc: ∅
- │ │ ├── message_loc: (32...35) = "baz"
- │ │ ├── opening_loc: ∅
- │ │ ├── arguments: ∅
- │ │ ├── closing_loc: ∅
- │ │ ├── block: ∅
- │ │ ├── flags: variable_call
- │ │ └── name: "baz"
- │ └── operator_loc: (31...32) = "&"
+ │ └── @ SplatNode (location: (25...29))
+ │ ├── operator_loc: (25...26) = "*"
+ │ └── expression:
+ │ @ CallNode (location: (26...29))
+ │ ├── receiver: ∅
+ │ ├── call_operator_loc: ∅
+ │ ├── message_loc: (26...29) = "bar"
+ │ ├── opening_loc: ∅
+ │ ├── arguments: ∅
+ │ ├── closing_loc: ∅
+ │ ├── block: ∅
+ │ ├── flags: variable_call
+ │ └── name: "bar"
├── closing_loc: (35...36) = ")"
- ├── block: ∅
+ ├── block:
+ │ @ BlockArgumentNode (location: (31...35))
+ │ ├── expression:
+ │ │ @ CallNode (location: (32...35))
+ │ │ ├── receiver: ∅
+ │ │ ├── call_operator_loc: ∅
+ │ │ ├── message_loc: (32...35) = "baz"
+ │ │ ├── opening_loc: ∅
+ │ │ ├── arguments: ∅
+ │ │ ├── closing_loc: ∅
+ │ │ ├── block: ∅
+ │ │ ├── flags: variable_call
+ │ │ └── name: "baz"
+ │ └── operator_loc: (31...32) = "&"
├── flags: ∅
└── name: "fun"
diff --git a/test/yarp/snapshots/whitequark/args_assocs.txt b/test/yarp/snapshots/whitequark/args_assocs.txt
index 4a49911aa3..ae8e3cdf16 100644
--- a/test/yarp/snapshots/whitequark/args_assocs.txt
+++ b/test/yarp/snapshots/whitequark/args_assocs.txt
@@ -28,42 +28,42 @@
│ ├── block: ∅
│ ├── flags: ∅
│ └── name: "fun"
- ├── @ CallNode (location: (16...36))
+ ├── @ CallNode (location: (16...35))
│ ├── receiver: ∅
│ ├── call_operator_loc: ∅
│ ├── message_loc: (16...19) = "fun"
│ ├── opening_loc: (19...20) = "("
│ ├── arguments:
- │ │ @ ArgumentsNode (location: (20...35))
- │ │ └── arguments: (length: 2)
- │ │ ├── @ KeywordHashNode (location: (20...29))
- │ │ │ └── elements: (length: 1)
- │ │ │ └── @ AssocNode (location: (20...29))
- │ │ │ ├── key:
- │ │ │ │ @ SymbolNode (location: (20...24))
- │ │ │ │ ├── opening_loc: (20...21) = ":"
- │ │ │ │ ├── value_loc: (21...24) = "foo"
- │ │ │ │ ├── closing_loc: ∅
- │ │ │ │ └── unescaped: "foo"
- │ │ │ ├── value:
- │ │ │ │ @ IntegerNode (location: (28...29))
- │ │ │ │ └── flags: decimal
- │ │ │ └── operator_loc: (25...27) = "=>"
- │ │ └── @ BlockArgumentNode (location: (31...35))
- │ │ ├── expression:
- │ │ │ @ CallNode (location: (32...35))
- │ │ │ ├── receiver: ∅
- │ │ │ ├── call_operator_loc: ∅
- │ │ │ ├── message_loc: (32...35) = "baz"
- │ │ │ ├── opening_loc: ∅
- │ │ │ ├── arguments: ∅
- │ │ │ ├── closing_loc: ∅
- │ │ │ ├── block: ∅
- │ │ │ ├── flags: variable_call
- │ │ │ └── name: "baz"
- │ │ └── operator_loc: (31...32) = "&"
+ │ │ @ ArgumentsNode (location: (20...29))
+ │ │ └── arguments: (length: 1)
+ │ │ └── @ KeywordHashNode (location: (20...29))
+ │ │ └── elements: (length: 1)
+ │ │ └── @ AssocNode (location: (20...29))
+ │ │ ├── key:
+ │ │ │ @ SymbolNode (location: (20...24))
+ │ │ │ ├── opening_loc: (20...21) = ":"
+ │ │ │ ├── value_loc: (21...24) = "foo"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "foo"
+ │ │ ├── value:
+ │ │ │ @ IntegerNode (location: (28...29))
+ │ │ │ └── flags: decimal
+ │ │ └── operator_loc: (25...27) = "=>"
│ ├── closing_loc: (35...36) = ")"
- │ ├── block: ∅
+ │ ├── block:
+ │ │ @ BlockArgumentNode (location: (31...35))
+ │ │ ├── expression:
+ │ │ │ @ CallNode (location: (32...35))
+ │ │ │ ├── receiver: ∅
+ │ │ │ ├── call_operator_loc: ∅
+ │ │ │ ├── message_loc: (32...35) = "baz"
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── arguments: ∅
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ ├── block: ∅
+ │ │ │ ├── flags: variable_call
+ │ │ │ └── name: "baz"
+ │ │ └── operator_loc: (31...32) = "&"
│ ├── flags: ∅
│ └── name: "fun"
├── @ CallNode (location: (38...59))
diff --git a/test/yarp/snapshots/whitequark/args_assocs_legacy.txt b/test/yarp/snapshots/whitequark/args_assocs_legacy.txt
index 4a49911aa3..ae8e3cdf16 100644
--- a/test/yarp/snapshots/whitequark/args_assocs_legacy.txt
+++ b/test/yarp/snapshots/whitequark/args_assocs_legacy.txt
@@ -28,42 +28,42 @@
│ ├── block: ∅
│ ├── flags: ∅
│ └── name: "fun"
- ├── @ CallNode (location: (16...36))
+ ├── @ CallNode (location: (16...35))
│ ├── receiver: ∅
│ ├── call_operator_loc: ∅
│ ├── message_loc: (16...19) = "fun"
│ ├── opening_loc: (19...20) = "("
│ ├── arguments:
- │ │ @ ArgumentsNode (location: (20...35))
- │ │ └── arguments: (length: 2)
- │ │ ├── @ KeywordHashNode (location: (20...29))
- │ │ │ └── elements: (length: 1)
- │ │ │ └── @ AssocNode (location: (20...29))
- │ │ │ ├── key:
- │ │ │ │ @ SymbolNode (location: (20...24))
- │ │ │ │ ├── opening_loc: (20...21) = ":"
- │ │ │ │ ├── value_loc: (21...24) = "foo"
- │ │ │ │ ├── closing_loc: ∅
- │ │ │ │ └── unescaped: "foo"
- │ │ │ ├── value:
- │ │ │ │ @ IntegerNode (location: (28...29))
- │ │ │ │ └── flags: decimal
- │ │ │ └── operator_loc: (25...27) = "=>"
- │ │ └── @ BlockArgumentNode (location: (31...35))
- │ │ ├── expression:
- │ │ │ @ CallNode (location: (32...35))
- │ │ │ ├── receiver: ∅
- │ │ │ ├── call_operator_loc: ∅
- │ │ │ ├── message_loc: (32...35) = "baz"
- │ │ │ ├── opening_loc: ∅
- │ │ │ ├── arguments: ∅
- │ │ │ ├── closing_loc: ∅
- │ │ │ ├── block: ∅
- │ │ │ ├── flags: variable_call
- │ │ │ └── name: "baz"
- │ │ └── operator_loc: (31...32) = "&"
+ │ │ @ ArgumentsNode (location: (20...29))
+ │ │ └── arguments: (length: 1)
+ │ │ └── @ KeywordHashNode (location: (20...29))
+ │ │ └── elements: (length: 1)
+ │ │ └── @ AssocNode (location: (20...29))
+ │ │ ├── key:
+ │ │ │ @ SymbolNode (location: (20...24))
+ │ │ │ ├── opening_loc: (20...21) = ":"
+ │ │ │ ├── value_loc: (21...24) = "foo"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "foo"
+ │ │ ├── value:
+ │ │ │ @ IntegerNode (location: (28...29))
+ │ │ │ └── flags: decimal
+ │ │ └── operator_loc: (25...27) = "=>"
│ ├── closing_loc: (35...36) = ")"
- │ ├── block: ∅
+ │ ├── block:
+ │ │ @ BlockArgumentNode (location: (31...35))
+ │ │ ├── expression:
+ │ │ │ @ CallNode (location: (32...35))
+ │ │ │ ├── receiver: ∅
+ │ │ │ ├── call_operator_loc: ∅
+ │ │ │ ├── message_loc: (32...35) = "baz"
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── arguments: ∅
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ ├── block: ∅
+ │ │ │ ├── flags: variable_call
+ │ │ │ └── name: "baz"
+ │ │ └── operator_loc: (31...32) = "&"
│ ├── flags: ∅
│ └── name: "fun"
├── @ CallNode (location: (38...59))
diff --git a/test/yarp/snapshots/whitequark/args_block_pass.txt b/test/yarp/snapshots/whitequark/args_block_pass.txt
index 622f3fea37..0667d00520 100644
--- a/test/yarp/snapshots/whitequark/args_block_pass.txt
+++ b/test/yarp/snapshots/whitequark/args_block_pass.txt
@@ -1,30 +1,28 @@
-@ ProgramNode (location: (0...9))
+@ ProgramNode (location: (0...8))
├── locals: []
└── statements:
- @ StatementsNode (location: (0...9))
+ @ StatementsNode (location: (0...8))
└── body: (length: 1)
- └── @ CallNode (location: (0...9))
+ └── @ CallNode (location: (0...8))
├── receiver: ∅
├── call_operator_loc: ∅
├── message_loc: (0...3) = "fun"
├── opening_loc: (3...4) = "("
- ├── arguments:
- │ @ ArgumentsNode (location: (4...8))
- │ └── arguments: (length: 1)
- │ └── @ BlockArgumentNode (location: (4...8))
- │ ├── expression:
- │ │ @ CallNode (location: (5...8))
- │ │ ├── receiver: ∅
- │ │ ├── call_operator_loc: ∅
- │ │ ├── message_loc: (5...8) = "bar"
- │ │ ├── opening_loc: ∅
- │ │ ├── arguments: ∅
- │ │ ├── closing_loc: ∅
- │ │ ├── block: ∅
- │ │ ├── flags: variable_call
- │ │ └── name: "bar"
- │ └── operator_loc: (4...5) = "&"
+ ├── arguments: ∅
├── closing_loc: (8...9) = ")"
- ├── block: ∅
+ ├── block:
+ │ @ BlockArgumentNode (location: (4...8))
+ │ ├── expression:
+ │ │ @ CallNode (location: (5...8))
+ │ │ ├── receiver: ∅
+ │ │ ├── call_operator_loc: ∅
+ │ │ ├── message_loc: (5...8) = "bar"
+ │ │ ├── opening_loc: ∅
+ │ │ ├── arguments: ∅
+ │ │ ├── closing_loc: ∅
+ │ │ ├── block: ∅
+ │ │ ├── flags: variable_call
+ │ │ └── name: "bar"
+ │ └── operator_loc: (4...5) = "&"
├── flags: ∅
└── name: "fun"
diff --git a/test/yarp/snapshots/whitequark/args_star.txt b/test/yarp/snapshots/whitequark/args_star.txt
index 5e1d0efe63..3c25c18574 100644
--- a/test/yarp/snapshots/whitequark/args_star.txt
+++ b/test/yarp/snapshots/whitequark/args_star.txt
@@ -1,7 +1,7 @@
-@ ProgramNode (location: (0...26))
+@ ProgramNode (location: (0...25))
├── locals: []
└── statements:
- @ StatementsNode (location: (0...26))
+ @ StatementsNode (location: (0...25))
└── body: (length: 2)
├── @ CallNode (location: (0...9))
│ ├── receiver: ∅
@@ -28,41 +28,41 @@
│ ├── block: ∅
│ ├── flags: ∅
│ └── name: "fun"
- └── @ CallNode (location: (11...26))
+ └── @ CallNode (location: (11...25))
├── receiver: ∅
├── call_operator_loc: ∅
├── message_loc: (11...14) = "fun"
├── opening_loc: (14...15) = "("
├── arguments:
- │ @ ArgumentsNode (location: (15...25))
- │ └── arguments: (length: 2)
- │ ├── @ SplatNode (location: (15...19))
- │ │ ├── operator_loc: (15...16) = "*"
- │ │ └── expression:
- │ │ @ CallNode (location: (16...19))
- │ │ ├── receiver: ∅
- │ │ ├── call_operator_loc: ∅
- │ │ ├── message_loc: (16...19) = "bar"
- │ │ ├── opening_loc: ∅
- │ │ ├── arguments: ∅
- │ │ ├── closing_loc: ∅
- │ │ ├── block: ∅
- │ │ ├── flags: variable_call
- │ │ └── name: "bar"
- │ └── @ BlockArgumentNode (location: (21...25))
- │ ├── expression:
- │ │ @ CallNode (location: (22...25))
- │ │ ├── receiver: ∅
- │ │ ├── call_operator_loc: ∅
- │ │ ├── message_loc: (22...25) = "baz"
- │ │ ├── opening_loc: ∅
- │ │ ├── arguments: ∅
- │ │ ├── closing_loc: ∅
- │ │ ├── block: ∅
- │ │ ├── flags: variable_call
- │ │ └── name: "baz"
- │ └── operator_loc: (21...22) = "&"
+ │ @ ArgumentsNode (location: (15...19))
+ │ └── arguments: (length: 1)
+ │ └── @ SplatNode (location: (15...19))
+ │ ├── operator_loc: (15...16) = "*"
+ │ └── expression:
+ │ @ CallNode (location: (16...19))
+ │ ├── receiver: ∅
+ │ ├── call_operator_loc: ∅
+ │ ├── message_loc: (16...19) = "bar"
+ │ ├── opening_loc: ∅
+ │ ├── arguments: ∅
+ │ ├── closing_loc: ∅
+ │ ├── block: ∅
+ │ ├── flags: variable_call
+ │ └── name: "bar"
├── closing_loc: (25...26) = ")"
- ├── block: ∅
+ ├── block:
+ │ @ BlockArgumentNode (location: (21...25))
+ │ ├── expression:
+ │ │ @ CallNode (location: (22...25))
+ │ │ ├── receiver: ∅
+ │ │ ├── call_operator_loc: ∅
+ │ │ ├── message_loc: (22...25) = "baz"
+ │ │ ├── opening_loc: ∅
+ │ │ ├── arguments: ∅
+ │ │ ├── closing_loc: ∅
+ │ │ ├── block: ∅
+ │ │ ├── flags: variable_call
+ │ │ └── name: "baz"
+ │ └── operator_loc: (21...22) = "&"
├── flags: ∅
└── name: "fun"
diff --git a/yarp/config.yml b/yarp/config.yml
index fbaea52f4b..59406fedea 100644
--- a/yarp/config.yml
+++ b/yarp/config.yml
@@ -668,7 +668,6 @@ nodes:
type: location?
- name: block
type: node?
- kind: BlockNode
- name: flags
type: flags
kind: CallNodeFlags
@@ -2315,7 +2314,6 @@ nodes:
type: location?
- name: block
type: node?
- kind: BlockNode
comment: |
Represents the use of the `super` keyword with parentheses or arguments.
diff --git a/yarp/yarp.c b/yarp/yarp.c
index 6dc7141370..2f6a46f789 100644
--- a/yarp/yarp.c
+++ b/yarp/yarp.c
@@ -549,11 +549,7 @@ typedef struct {
yp_location_t opening_loc;
yp_arguments_node_t *arguments;
yp_location_t closing_loc;
- yp_block_node_t *block;
-
- // This boolean is used to tell if there is an implicit block (i.e., an
- // argument passed with an & operator).
- bool implicit_block;
+ yp_node_t *block;
} yp_arguments_t;
#define YP_EMPTY_ARGUMENTS ((yp_arguments_t) { \
@@ -561,36 +557,37 @@ typedef struct {
.arguments = NULL, \
.closing_loc = YP_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE, \
.block = NULL, \
- .implicit_block = false \
})
-// Check that the set of arguments parsed for a given node is valid. This means
-// checking that we don't have both an implicit and explicit block.
+// Check that we're not about to attempt to attach a brace block to a call that
+// has arguments without parentheses.
static void
-yp_arguments_validate(yp_parser_t *parser, yp_arguments_t *arguments) {
- if (arguments->block != NULL && arguments->implicit_block) {
- yp_diagnostic_list_append(
- &parser->error_list,
- arguments->block->base.location.start,
- arguments->block->base.location.end,
- YP_ERR_ARGUMENT_BLOCK_MULTI
- );
+yp_arguments_validate_block(yp_parser_t *parser, yp_arguments_t *arguments, yp_block_node_t *block) {
+ // First, check that we have arguments and that we don't have a closing
+ // location for them.
+ if (arguments->arguments == NULL || arguments->closing_loc.start != NULL) {
+ return;
}
- // Brace blocks can't be attached to arguments, only to the call
- if (arguments->block != NULL &&
- *arguments->block->opening_loc.start == '{' &&
- arguments->arguments != NULL &&
- !(arguments->arguments->arguments.size == 1 &&
- YP_NODE_TYPE_P(arguments->arguments->arguments.nodes[0], YP_PARENTHESES_NODE)) &&
- !arguments->closing_loc.end) {
- yp_diagnostic_list_append(
- &parser->error_list,
- arguments->block->base.location.start,
- arguments->block->base.location.end,
- YP_ERR_ARGUMENT_BLOCK_MULTI
- );
+ // Next, check that we don't have a single parentheses argument. This would
+ // look like:
+ //
+ // foo (1) {}
+ //
+ // In this case, it's actually okay for the block to be attached to the
+ // call, even though it looks like it's attached to the argument.
+ if (arguments->arguments->arguments.size == 1 && YP_NODE_TYPE_P(arguments->arguments->arguments.nodes[0], YP_PARENTHESES_NODE)) {
+ return;
}
+
+ // If we didn't hit a case before this check, then at this point we need to
+ // add a syntax error.
+ yp_diagnostic_list_append(
+ &parser->error_list,
+ block->base.location.start,
+ block->base.location.end,
+ YP_ERR_ARGUMENT_UNEXPECTED_BLOCK
+ );
}
/******************************************************************************/
@@ -1340,7 +1337,7 @@ yp_call_node_aref_create(yp_parser_t *parser, yp_node_t *receiver, yp_arguments_
node->base.location.start = receiver->location.start;
if (arguments->block != NULL) {
- node->base.location.end = arguments->block->base.location.end;
+ node->base.location.end = arguments->block->location.end;
} else {
node->base.location.end = arguments->closing_loc.end;
}
@@ -1384,7 +1381,7 @@ yp_call_node_call_create(yp_parser_t *parser, yp_node_t *receiver, yp_token_t *o
node->base.location.start = receiver->location.start;
if (arguments->block != NULL) {
- node->base.location.end = arguments->block->base.location.end;
+ node->base.location.end = arguments->block->location.end;
} else if (arguments->closing_loc.start != NULL) {
node->base.location.end = arguments->closing_loc.end;
} else if (arguments->arguments != NULL) {
@@ -1417,7 +1414,7 @@ yp_call_node_fcall_create(yp_parser_t *parser, yp_token_t *message, yp_arguments
node->base.location.start = message->start;
if (arguments->block != NULL) {
- node->base.location.end = arguments->block->base.location.end;
+ node->base.location.end = arguments->block->location.end;
} else if (arguments->closing_loc.start != NULL) {
node->base.location.end = arguments->closing_loc.end;
} else if (arguments->arguments != NULL) {
@@ -1465,7 +1462,7 @@ yp_call_node_shorthand_create(yp_parser_t *parser, yp_node_t *receiver, yp_token
node->base.location.start = receiver->location.start;
if (arguments->block != NULL) {
- node->base.location.end = arguments->block->base.location.end;
+ node->base.location.end = arguments->block->location.end;
} else {
node->base.location.end = arguments->closing_loc.end;
}
@@ -2414,18 +2411,24 @@ yp_forwarding_parameter_node_create(yp_parser_t *parser, const yp_token_t *token
// Allocate and initialize a new ForwardingSuper node.
static yp_forwarding_super_node_t *
yp_forwarding_super_node_create(yp_parser_t *parser, const yp_token_t *token, yp_arguments_t *arguments) {
+ assert(arguments->block == NULL || YP_NODE_TYPE_P(arguments->block, YP_BLOCK_NODE));
assert(token->type == YP_TOKEN_KEYWORD_SUPER);
yp_forwarding_super_node_t *node = YP_ALLOC_NODE(parser, yp_forwarding_super_node_t);
+ yp_block_node_t *block = NULL;
+ if (arguments->block != NULL) {
+ block = (yp_block_node_t *) arguments->block;
+ }
+
*node = (yp_forwarding_super_node_t) {
{
.type = YP_FORWARDING_SUPER_NODE,
.location = {
.start = token->start,
- .end = arguments->block != NULL ? arguments->block->base.location.end : token->end
+ .end = block != NULL ? block->base.location.end : token->end
},
},
- .block = arguments->block
+ .block = block
};
return node;
@@ -4282,7 +4285,7 @@ yp_super_node_create(yp_parser_t *parser, const yp_token_t *keyword, yp_argument
const uint8_t *end;
if (arguments->block != NULL) {
- end = arguments->block->base.location.end;
+ end = arguments->block->location.end;
} else if (arguments->closing_loc.start != NULL) {
end = arguments->closing_loc.end;
} else if (arguments->arguments != NULL) {
@@ -8894,6 +8897,16 @@ parse_assocs(yp_parser_t *parser, yp_node_t *node) {
}
}
+// Append an argument to a list of arguments.
+static inline void
+parse_arguments_append(yp_parser_t *parser, yp_arguments_t *arguments, yp_node_t *argument) {
+ if (arguments->arguments == NULL) {
+ arguments->arguments = yp_arguments_node_create(parser);
+ }
+
+ yp_arguments_node_arguments_append(arguments->arguments, argument);
+}
+
// Parse a list of arguments.
static void
parse_arguments(yp_parser_t *parser, yp_arguments_t *arguments, bool accepts_forwarding, yp_token_type_t terminator) {
@@ -8927,13 +8940,14 @@ parse_arguments(yp_parser_t *parser, yp_arguments_t *arguments, bool accepts_for
}
yp_keyword_hash_node_t *hash = yp_keyword_hash_node_create(parser);
- argument = (yp_node_t *)hash;
+ argument = (yp_node_t *) hash;
if (!match7(parser, terminator, YP_TOKEN_NEWLINE, YP_TOKEN_SEMICOLON, YP_TOKEN_EOF, YP_TOKEN_BRACE_RIGHT, YP_TOKEN_KEYWORD_DO, YP_TOKEN_PARENTHESIS_RIGHT)) {
parse_assocs(parser, (yp_node_t *) hash);
}
parsed_bare_hash = true;
+ parse_arguments_append(parser, arguments, argument);
break;
}
case YP_TOKEN_UAMPERSAND: {
@@ -8947,9 +8961,14 @@ parse_arguments(yp_parser_t *parser, yp_arguments_t *arguments, bool accepts_for
yp_diagnostic_list_append(&parser->error_list, operator.start, operator.end, YP_ERR_ARGUMENT_NO_FORWARDING_AMP);
}
- argument = (yp_node_t *)yp_block_argument_node_create(parser, &operator, expression);
+ argument = (yp_node_t *) yp_block_argument_node_create(parser, &operator, expression);
+ if (parsed_block_argument) {
+ parse_arguments_append(parser, arguments, argument);
+ } else {
+ arguments->block = argument;
+ }
+
parsed_block_argument = true;
- arguments->implicit_block = true;
break;
}
case YP_TOKEN_USTAR: {
@@ -8972,6 +8991,7 @@ parse_arguments(yp_parser_t *parser, yp_arguments_t *arguments, bool accepts_for
argument = (yp_node_t *) yp_splat_node_create(parser, &operator, expression);
}
+ parse_arguments_append(parser, arguments, argument);
break;
}
case YP_TOKEN_UDOT_DOT_DOT: {
@@ -8989,7 +9009,8 @@ parse_arguments(yp_parser_t *parser, yp_arguments_t *arguments, bool accepts_for
yp_diagnostic_list_append(&parser->error_list, parser->previous.start, parser->previous.end, YP_ERR_ARGUMENT_NO_FORWARDING_ELLIPSES);
}
- argument = (yp_node_t *)yp_forwarding_arguments_node_create(parser, &parser->previous);
+ argument = (yp_node_t *) yp_forwarding_arguments_node_create(parser, &parser->previous);
+ parse_arguments_append(parser, arguments, argument);
break;
}
}
@@ -9032,12 +9053,11 @@ parse_arguments(yp_parser_t *parser, yp_arguments_t *arguments, bool accepts_for
parsed_bare_hash = true;
}
+ parse_arguments_append(parser, arguments, argument);
break;
}
}
- yp_arguments_node_arguments_append(arguments->arguments, argument);
-
// If parsing the argument failed, we need to stop parsing arguments.
if (YP_NODE_TYPE_P(argument, YP_MISSING_NODE) || parser->recovering) break;
@@ -9737,8 +9757,6 @@ parse_arguments_list(yp_parser_t *parser, yp_arguments_t *arguments, bool accept
if (accept1(parser, YP_TOKEN_PARENTHESIS_RIGHT)) {
arguments->closing_loc = YP_LOCATION_TOKEN_VALUE(&parser->previous);
} else {
- arguments->arguments = yp_arguments_node_create(parser);
-
yp_accepts_block_stack_push(parser, true);
parse_arguments(parser, arguments, true, YP_TOKEN_PARENTHESIS_RIGHT);
expect1(parser, YP_TOKEN_PARENTHESIS_RIGHT, YP_ERR_ARGUMENT_TERM_PAREN);
@@ -9753,7 +9771,6 @@ parse_arguments_list(yp_parser_t *parser, yp_arguments_t *arguments, bool accept
// If we get here, then the subsequent token cannot be used as an infix
// operator. In this case we assume the subsequent token is part of an
// argument to this method call.
- arguments->arguments = yp_arguments_node_create(parser);
parse_arguments(parser, arguments, true, YP_TOKEN_EOF);
yp_accepts_block_stack_pop(parser);
@@ -9763,16 +9780,28 @@ parse_arguments_list(yp_parser_t *parser, yp_arguments_t *arguments, bool accept
// node that starts with a {. If there is, then we can parse it and add it to
// the arguments.
if (accepts_block) {
+ yp_block_node_t *block = NULL;
+
if (accept1(parser, YP_TOKEN_BRACE_LEFT)) {
found |= true;
- arguments->block = parse_block(parser);
+ block = parse_block(parser);
+ yp_arguments_validate_block(parser, arguments, block);
} else if (yp_accepts_block_stack_p(parser) && accept1(parser, YP_TOKEN_KEYWORD_DO)) {
found |= true;
- arguments->block = parse_block(parser);
+ block = parse_block(parser);
+ }
+
+ if (block != NULL) {
+ if (arguments->block == NULL) {
+ arguments->block = (yp_node_t *) block;
+ } else {
+ yp_diagnostic_list_append(&parser->error_list, block->base.location.start, block->base.location.end, YP_ERR_ARGUMENT_BLOCK_MULTI);
+ yp_arguments_node_arguments_append(arguments->arguments, arguments->block);
+ arguments->block = (yp_node_t *) block;
+ }
}
}
- yp_arguments_validate(parser, arguments);
return found;
}
@@ -11706,7 +11735,7 @@ parse_expression_prefix(yp_parser_t *parser, yp_binding_power_t binding_power) {
call->block = arguments.block;
if (arguments.block != NULL) {
- call->base.location.end = arguments.block->base.location.end;
+ call->base.location.end = arguments.block->location.end;
} else if (arguments.closing_loc.start == NULL) {
if (arguments.arguments != NULL) {
call->base.location.end = arguments.arguments->base.location.end;
@@ -12125,7 +12154,6 @@ parse_expression_prefix(yp_parser_t *parser, yp_binding_power_t binding_power) {
yp_binding_power_t binding_power = yp_binding_powers[parser->current.type].left;
if (binding_power == YP_BINDING_POWER_UNSET || binding_power >= YP_BINDING_POWER_RANGE) {
- arguments.arguments = yp_arguments_node_create(parser);
parse_arguments(parser, &arguments, false, YP_TOKEN_EOF);
}
}
@@ -14083,11 +14111,8 @@ parse_expression_infix(yp_parser_t *parser, yp_node_t *node, yp_binding_power_t
if (!accept1(parser, YP_TOKEN_BRACKET_RIGHT)) {
yp_accepts_block_stack_push(parser, true);
- arguments.arguments = yp_arguments_node_create(parser);
-
parse_arguments(parser, &arguments, false, YP_TOKEN_BRACKET_RIGHT);
yp_accepts_block_stack_pop(parser);
-
expect1(parser, YP_TOKEN_BRACKET_RIGHT, YP_ERR_EXPECT_RBRACKET);
}
@@ -14103,13 +14128,23 @@ parse_expression_infix(yp_parser_t *parser, yp_node_t *node, yp_binding_power_t
// If we're at the end of the arguments, we can now check if there is a
// block node that starts with a {. If there is, then we can parse it and
// add it to the arguments.
+ yp_block_node_t *block = NULL;
if (accept1(parser, YP_TOKEN_BRACE_LEFT)) {
- arguments.block = parse_block(parser);
+ block = parse_block(parser);
+ yp_arguments_validate_block(parser, &arguments, block);
} else if (yp_accepts_block_stack_p(parser) && accept1(parser, YP_TOKEN_KEYWORD_DO)) {
- arguments.block = parse_block(parser);
+ block = parse_block(parser);
+ }
+
+ if (block != NULL) {
+ if (arguments.block != NULL) {
+ yp_diagnostic_list_append(&parser->error_list, block->base.location.start, block->base.location.end, YP_ERR_ARGUMENT_AFTER_BLOCK);
+ yp_arguments_node_arguments_append(arguments.arguments, arguments.block);
+ }
+
+ arguments.block = (yp_node_t *) block;
}
- yp_arguments_validate(parser, &arguments);
return (yp_node_t *) yp_call_node_aref_create(parser, node, &arguments);
}
case YP_TOKEN_KEYWORD_IN: {