yarp 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/yarp/node.rb CHANGED
@@ -144,6 +144,52 @@ module YARP
144
144
  end
145
145
  end
146
146
 
147
+ # Represents the use of the `&&=` operator.
148
+ #
149
+ # target &&= value
150
+ # ^^^^^^^^^^^^^^^^
151
+ class AndWriteNode < Node
152
+ # attr_reader target: Node
153
+ attr_reader :target
154
+
155
+ # attr_reader value: Node
156
+ attr_reader :value
157
+
158
+ # attr_reader operator_loc: Location
159
+ attr_reader :operator_loc
160
+
161
+ # def initialize: (target: Node, value: Node, operator_loc: Location, location: Location) -> void
162
+ def initialize(target, value, operator_loc, location)
163
+ @target = target
164
+ @value = value
165
+ @operator_loc = operator_loc
166
+ @location = location
167
+ end
168
+
169
+ # def accept: (visitor: Visitor) -> void
170
+ def accept(visitor)
171
+ visitor.visit_and_write_node(self)
172
+ end
173
+
174
+ # def child_nodes: () -> Array[nil | Node]
175
+ def child_nodes
176
+ [target, value]
177
+ end
178
+
179
+ # def deconstruct: () -> Array[nil | Node]
180
+ alias deconstruct child_nodes
181
+
182
+ # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
183
+ def deconstruct_keys(keys)
184
+ { target: target, value: value, operator_loc: operator_loc, location: location }
185
+ end
186
+
187
+ # def operator: () -> String
188
+ def operator
189
+ operator_loc.slice
190
+ end
191
+ end
192
+
147
193
  # Represents a set of arguments to a method or a keyword.
148
194
  #
149
195
  # return foo, bar, baz
@@ -543,8 +589,8 @@ module YARP
543
589
  # attr_reader parameters: Node?
544
590
  attr_reader :parameters
545
591
 
546
- # attr_reader statements: Node?
547
- attr_reader :statements
592
+ # attr_reader body: Node?
593
+ attr_reader :body
548
594
 
549
595
  # attr_reader opening_loc: Location
550
596
  attr_reader :opening_loc
@@ -552,11 +598,11 @@ module YARP
552
598
  # attr_reader closing_loc: Location
553
599
  attr_reader :closing_loc
554
600
 
555
- # def initialize: (locals: Array[Symbol], parameters: Node?, statements: Node?, opening_loc: Location, closing_loc: Location, location: Location) -> void
556
- def initialize(locals, parameters, statements, opening_loc, closing_loc, location)
601
+ # def initialize: (locals: Array[Symbol], parameters: Node?, body: Node?, opening_loc: Location, closing_loc: Location, location: Location) -> void
602
+ def initialize(locals, parameters, body, opening_loc, closing_loc, location)
557
603
  @locals = locals
558
604
  @parameters = parameters
559
- @statements = statements
605
+ @body = body
560
606
  @opening_loc = opening_loc
561
607
  @closing_loc = closing_loc
562
608
  @location = location
@@ -569,7 +615,7 @@ module YARP
569
615
 
570
616
  # def child_nodes: () -> Array[nil | Node]
571
617
  def child_nodes
572
- [parameters, statements]
618
+ [parameters, body]
573
619
  end
574
620
 
575
621
  # def deconstruct: () -> Array[nil | Node]
@@ -577,7 +623,7 @@ module YARP
577
623
 
578
624
  # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
579
625
  def deconstruct_keys(keys)
580
- { locals: locals, parameters: parameters, statements: statements, opening_loc: opening_loc, closing_loc: closing_loc, location: location }
626
+ { locals: locals, parameters: parameters, body: body, opening_loc: opening_loc, closing_loc: closing_loc, location: location }
581
627
  end
582
628
 
583
629
  # def opening: () -> String
@@ -1119,20 +1165,20 @@ module YARP
1119
1165
  # attr_reader superclass: Node?
1120
1166
  attr_reader :superclass
1121
1167
 
1122
- # attr_reader statements: Node?
1123
- attr_reader :statements
1168
+ # attr_reader body: Node?
1169
+ attr_reader :body
1124
1170
 
1125
1171
  # attr_reader end_keyword_loc: Location
1126
1172
  attr_reader :end_keyword_loc
1127
1173
 
1128
- # def initialize: (locals: Array[Symbol], class_keyword_loc: Location, constant_path: Node, inheritance_operator_loc: Location?, superclass: Node?, statements: Node?, end_keyword_loc: Location, location: Location) -> void
1129
- def initialize(locals, class_keyword_loc, constant_path, inheritance_operator_loc, superclass, statements, end_keyword_loc, location)
1174
+ # def initialize: (locals: Array[Symbol], class_keyword_loc: Location, constant_path: Node, inheritance_operator_loc: Location?, superclass: Node?, body: Node?, end_keyword_loc: Location, location: Location) -> void
1175
+ def initialize(locals, class_keyword_loc, constant_path, inheritance_operator_loc, superclass, body, end_keyword_loc, location)
1130
1176
  @locals = locals
1131
1177
  @class_keyword_loc = class_keyword_loc
1132
1178
  @constant_path = constant_path
1133
1179
  @inheritance_operator_loc = inheritance_operator_loc
1134
1180
  @superclass = superclass
1135
- @statements = statements
1181
+ @body = body
1136
1182
  @end_keyword_loc = end_keyword_loc
1137
1183
  @location = location
1138
1184
  end
@@ -1144,7 +1190,7 @@ module YARP
1144
1190
 
1145
1191
  # def child_nodes: () -> Array[nil | Node]
1146
1192
  def child_nodes
1147
- [constant_path, superclass, statements]
1193
+ [constant_path, superclass, body]
1148
1194
  end
1149
1195
 
1150
1196
  # def deconstruct: () -> Array[nil | Node]
@@ -1152,7 +1198,7 @@ module YARP
1152
1198
 
1153
1199
  # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
1154
1200
  def deconstruct_keys(keys)
1155
- { locals: locals, class_keyword_loc: class_keyword_loc, constant_path: constant_path, inheritance_operator_loc: inheritance_operator_loc, superclass: superclass, statements: statements, end_keyword_loc: end_keyword_loc, location: location }
1201
+ { locals: locals, class_keyword_loc: class_keyword_loc, constant_path: constant_path, inheritance_operator_loc: inheritance_operator_loc, superclass: superclass, body: body, end_keyword_loc: end_keyword_loc, location: location }
1156
1202
  end
1157
1203
 
1158
1204
  # def class_keyword: () -> String
@@ -1171,31 +1217,60 @@ module YARP
1171
1217
  end
1172
1218
  end
1173
1219
 
1174
- # Represents the use of the `&&=` operator for assignment to a class variable.
1220
+ # Represents referencing a class variable.
1175
1221
  #
1176
- # @@target &&= value
1177
- # ^^^^^^^^^^^^^^^^
1178
- class ClassVariableOperatorAndWriteNode < Node
1222
+ # @@foo
1223
+ # ^^^^^
1224
+ class ClassVariableReadNode < Node
1225
+ # def initialize: (location: Location) -> void
1226
+ def initialize(location)
1227
+ @location = location
1228
+ end
1229
+
1230
+ # def accept: (visitor: Visitor) -> void
1231
+ def accept(visitor)
1232
+ visitor.visit_class_variable_read_node(self)
1233
+ end
1234
+
1235
+ # def child_nodes: () -> Array[nil | Node]
1236
+ def child_nodes
1237
+ []
1238
+ end
1239
+
1240
+ # def deconstruct: () -> Array[nil | Node]
1241
+ alias deconstruct child_nodes
1242
+
1243
+ # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
1244
+ def deconstruct_keys(keys)
1245
+ { location: location }
1246
+ end
1247
+ end
1248
+
1249
+ # Represents writing to a class variable.
1250
+ #
1251
+ # @@foo = 1
1252
+ # ^^^^^^^^^
1253
+ class ClassVariableWriteNode < Node
1179
1254
  # attr_reader name_loc: Location
1180
1255
  attr_reader :name_loc
1181
1256
 
1182
- # attr_reader operator_loc: Location
1183
- attr_reader :operator_loc
1184
-
1185
- # attr_reader value: Node
1257
+ # attr_reader value: Node?
1186
1258
  attr_reader :value
1187
1259
 
1188
- # def initialize: (name_loc: Location, operator_loc: Location, value: Node, location: Location) -> void
1189
- def initialize(name_loc, operator_loc, value, location)
1260
+ # attr_reader operator_loc: Location?
1261
+ attr_reader :operator_loc
1262
+
1263
+ # def initialize: (name_loc: Location, value: Node?, operator_loc: Location?, location: Location) -> void
1264
+ def initialize(name_loc, value, operator_loc, location)
1190
1265
  @name_loc = name_loc
1191
- @operator_loc = operator_loc
1192
1266
  @value = value
1267
+ @operator_loc = operator_loc
1193
1268
  @location = location
1194
1269
  end
1195
1270
 
1196
1271
  # def accept: (visitor: Visitor) -> void
1197
1272
  def accept(visitor)
1198
- visitor.visit_class_variable_operator_and_write_node(self)
1273
+ visitor.visit_class_variable_write_node(self)
1199
1274
  end
1200
1275
 
1201
1276
  # def child_nodes: () -> Array[nil | Node]
@@ -1208,7 +1283,7 @@ module YARP
1208
1283
 
1209
1284
  # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
1210
1285
  def deconstruct_keys(keys)
1211
- { name_loc: name_loc, operator_loc: operator_loc, value: value, location: location }
1286
+ { name_loc: name_loc, value: value, operator_loc: operator_loc, location: location }
1212
1287
  end
1213
1288
 
1214
1289
  # def name: () -> String
@@ -1216,42 +1291,42 @@ module YARP
1216
1291
  name_loc.slice
1217
1292
  end
1218
1293
 
1219
- # def operator: () -> String
1294
+ # def operator: () -> String?
1220
1295
  def operator
1221
- operator_loc.slice
1296
+ operator_loc&.slice
1222
1297
  end
1223
1298
  end
1224
1299
 
1225
- # Represents the use of the `||=` operator for assignment to a class variable.
1300
+ # Represents accessing a constant through a path of `::` operators.
1226
1301
  #
1227
- # @@target ||= value
1228
- # ^^^^^^^^^^^^^^^^^^
1229
- class ClassVariableOperatorOrWriteNode < Node
1230
- # attr_reader name_loc: Location
1231
- attr_reader :name_loc
1302
+ # Foo::Bar
1303
+ # ^^^^^^^^
1304
+ class ConstantPathNode < Node
1305
+ # attr_reader parent: Node?
1306
+ attr_reader :parent
1232
1307
 
1233
- # attr_reader operator_loc: Location
1234
- attr_reader :operator_loc
1308
+ # attr_reader child: Node
1309
+ attr_reader :child
1235
1310
 
1236
- # attr_reader value: Node
1237
- attr_reader :value
1311
+ # attr_reader delimiter_loc: Location
1312
+ attr_reader :delimiter_loc
1238
1313
 
1239
- # def initialize: (name_loc: Location, operator_loc: Location, value: Node, location: Location) -> void
1240
- def initialize(name_loc, operator_loc, value, location)
1241
- @name_loc = name_loc
1242
- @operator_loc = operator_loc
1243
- @value = value
1314
+ # def initialize: (parent: Node?, child: Node, delimiter_loc: Location, location: Location) -> void
1315
+ def initialize(parent, child, delimiter_loc, location)
1316
+ @parent = parent
1317
+ @child = child
1318
+ @delimiter_loc = delimiter_loc
1244
1319
  @location = location
1245
1320
  end
1246
1321
 
1247
1322
  # def accept: (visitor: Visitor) -> void
1248
1323
  def accept(visitor)
1249
- visitor.visit_class_variable_operator_or_write_node(self)
1324
+ visitor.visit_constant_path_node(self)
1250
1325
  end
1251
1326
 
1252
1327
  # def child_nodes: () -> Array[nil | Node]
1253
1328
  def child_nodes
1254
- [value]
1329
+ [parent, child]
1255
1330
  end
1256
1331
 
1257
1332
  # def deconstruct: () -> Array[nil | Node]
@@ -1259,54 +1334,51 @@ module YARP
1259
1334
 
1260
1335
  # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
1261
1336
  def deconstruct_keys(keys)
1262
- { name_loc: name_loc, operator_loc: operator_loc, value: value, location: location }
1263
- end
1264
-
1265
- # def name: () -> String
1266
- def name
1267
- name_loc.slice
1337
+ { parent: parent, child: child, delimiter_loc: delimiter_loc, location: location }
1268
1338
  end
1269
1339
 
1270
- # def operator: () -> String
1271
- def operator
1272
- operator_loc.slice
1340
+ # def delimiter: () -> String
1341
+ def delimiter
1342
+ delimiter_loc.slice
1273
1343
  end
1274
1344
  end
1275
1345
 
1276
- # Represents assigning to a class variable using an operator that isn't `=`.
1346
+ # Represents writing to a constant path.
1277
1347
  #
1278
- # @@target += value
1279
- # ^^^^^^^^^^^^^^^^^
1280
- class ClassVariableOperatorWriteNode < Node
1281
- # attr_reader name_loc: Location
1282
- attr_reader :name_loc
1348
+ # ::Foo = 1
1349
+ # ^^^^^^^^^
1350
+ #
1351
+ # Foo::Bar = 1
1352
+ # ^^^^^^^^^^^^
1353
+ #
1354
+ # ::Foo::Bar = 1
1355
+ # ^^^^^^^^^^^^^^
1356
+ class ConstantPathWriteNode < Node
1357
+ # attr_reader target: Node
1358
+ attr_reader :target
1283
1359
 
1284
- # attr_reader operator_loc: Location
1360
+ # attr_reader operator_loc: Location?
1285
1361
  attr_reader :operator_loc
1286
1362
 
1287
- # attr_reader value: Node
1363
+ # attr_reader value: Node?
1288
1364
  attr_reader :value
1289
1365
 
1290
- # attr_reader operator: Symbol
1291
- attr_reader :operator
1292
-
1293
- # def initialize: (name_loc: Location, operator_loc: Location, value: Node, operator: Symbol, location: Location) -> void
1294
- def initialize(name_loc, operator_loc, value, operator, location)
1295
- @name_loc = name_loc
1366
+ # def initialize: (target: Node, operator_loc: Location?, value: Node?, location: Location) -> void
1367
+ def initialize(target, operator_loc, value, location)
1368
+ @target = target
1296
1369
  @operator_loc = operator_loc
1297
1370
  @value = value
1298
- @operator = operator
1299
1371
  @location = location
1300
1372
  end
1301
1373
 
1302
1374
  # def accept: (visitor: Visitor) -> void
1303
1375
  def accept(visitor)
1304
- visitor.visit_class_variable_operator_write_node(self)
1376
+ visitor.visit_constant_path_write_node(self)
1305
1377
  end
1306
1378
 
1307
1379
  # def child_nodes: () -> Array[nil | Node]
1308
1380
  def child_nodes
1309
- [value]
1381
+ [target, value]
1310
1382
  end
1311
1383
 
1312
1384
  # def deconstruct: () -> Array[nil | Node]
@@ -1314,20 +1386,20 @@ module YARP
1314
1386
 
1315
1387
  # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
1316
1388
  def deconstruct_keys(keys)
1317
- { name_loc: name_loc, operator_loc: operator_loc, value: value, operator: operator, location: location }
1389
+ { target: target, operator_loc: operator_loc, value: value, location: location }
1318
1390
  end
1319
1391
 
1320
- # def name: () -> String
1321
- def name
1322
- name_loc.slice
1392
+ # def operator: () -> String?
1393
+ def operator
1394
+ operator_loc&.slice
1323
1395
  end
1324
1396
  end
1325
1397
 
1326
- # Represents referencing a class variable.
1398
+ # Represents referencing a constant.
1327
1399
  #
1328
- # @@foo
1329
- # ^^^^^
1330
- class ClassVariableReadNode < Node
1400
+ # Foo
1401
+ # ^^^
1402
+ class ConstantReadNode < Node
1331
1403
  # def initialize: (location: Location) -> void
1332
1404
  def initialize(location)
1333
1405
  @location = location
@@ -1335,7 +1407,7 @@ module YARP
1335
1407
 
1336
1408
  # def accept: (visitor: Visitor) -> void
1337
1409
  def accept(visitor)
1338
- visitor.visit_class_variable_read_node(self)
1410
+ visitor.visit_constant_read_node(self)
1339
1411
  end
1340
1412
 
1341
1413
  # def child_nodes: () -> Array[nil | Node]
@@ -1352,11 +1424,11 @@ module YARP
1352
1424
  end
1353
1425
  end
1354
1426
 
1355
- # Represents writing to a class variable.
1427
+ # Represents writing to a constant.
1356
1428
  #
1357
- # @@foo = 1
1358
- # ^^^^^^^^^
1359
- class ClassVariableWriteNode < Node
1429
+ # Foo = 1
1430
+ # ^^^^^^^
1431
+ class ConstantWriteNode < Node
1360
1432
  # attr_reader name_loc: Location
1361
1433
  attr_reader :name_loc
1362
1434
 
@@ -1376,7 +1448,7 @@ module YARP
1376
1448
 
1377
1449
  # def accept: (visitor: Visitor) -> void
1378
1450
  def accept(visitor)
1379
- visitor.visit_class_variable_write_node(self)
1451
+ visitor.visit_constant_write_node(self)
1380
1452
  end
1381
1453
 
1382
1454
  # def child_nodes: () -> Array[nil | Node]
@@ -1403,36 +1475,69 @@ module YARP
1403
1475
  end
1404
1476
  end
1405
1477
 
1406
- # Represents the use of the `&&=` operator for assignment to a constant.
1478
+ # Represents a method definition.
1407
1479
  #
1408
- # Target &&= value
1409
- # ^^^^^^^^^^^^^^^^
1410
- class ConstantOperatorAndWriteNode < Node
1480
+ # def method
1481
+ # end
1482
+ # ^^^^^^^^^^
1483
+ class DefNode < Node
1411
1484
  # attr_reader name_loc: Location
1412
1485
  attr_reader :name_loc
1413
1486
 
1414
- # attr_reader operator_loc: Location
1487
+ # attr_reader receiver: Node?
1488
+ attr_reader :receiver
1489
+
1490
+ # attr_reader parameters: Node?
1491
+ attr_reader :parameters
1492
+
1493
+ # attr_reader body: Node?
1494
+ attr_reader :body
1495
+
1496
+ # attr_reader locals: Array[Symbol]
1497
+ attr_reader :locals
1498
+
1499
+ # attr_reader def_keyword_loc: Location
1500
+ attr_reader :def_keyword_loc
1501
+
1502
+ # attr_reader operator_loc: Location?
1415
1503
  attr_reader :operator_loc
1416
1504
 
1417
- # attr_reader value: Node
1418
- attr_reader :value
1505
+ # attr_reader lparen_loc: Location?
1506
+ attr_reader :lparen_loc
1419
1507
 
1420
- # def initialize: (name_loc: Location, operator_loc: Location, value: Node, location: Location) -> void
1421
- def initialize(name_loc, operator_loc, value, location)
1508
+ # attr_reader rparen_loc: Location?
1509
+ attr_reader :rparen_loc
1510
+
1511
+ # attr_reader equal_loc: Location?
1512
+ attr_reader :equal_loc
1513
+
1514
+ # attr_reader end_keyword_loc: Location?
1515
+ attr_reader :end_keyword_loc
1516
+
1517
+ # def initialize: (name_loc: Location, receiver: Node?, parameters: Node?, body: Node?, locals: Array[Symbol], def_keyword_loc: Location, operator_loc: Location?, lparen_loc: Location?, rparen_loc: Location?, equal_loc: Location?, end_keyword_loc: Location?, location: Location) -> void
1518
+ def initialize(name_loc, receiver, parameters, body, locals, def_keyword_loc, operator_loc, lparen_loc, rparen_loc, equal_loc, end_keyword_loc, location)
1422
1519
  @name_loc = name_loc
1520
+ @receiver = receiver
1521
+ @parameters = parameters
1522
+ @body = body
1523
+ @locals = locals
1524
+ @def_keyword_loc = def_keyword_loc
1423
1525
  @operator_loc = operator_loc
1424
- @value = value
1526
+ @lparen_loc = lparen_loc
1527
+ @rparen_loc = rparen_loc
1528
+ @equal_loc = equal_loc
1529
+ @end_keyword_loc = end_keyword_loc
1425
1530
  @location = location
1426
1531
  end
1427
1532
 
1428
1533
  # def accept: (visitor: Visitor) -> void
1429
1534
  def accept(visitor)
1430
- visitor.visit_constant_operator_and_write_node(self)
1535
+ visitor.visit_def_node(self)
1431
1536
  end
1432
1537
 
1433
1538
  # def child_nodes: () -> Array[nil | Node]
1434
1539
  def child_nodes
1435
- [value]
1540
+ [receiver, parameters, body]
1436
1541
  end
1437
1542
 
1438
1543
  # def deconstruct: () -> Array[nil | Node]
@@ -1440,507 +1545,7 @@ module YARP
1440
1545
 
1441
1546
  # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
1442
1547
  def deconstruct_keys(keys)
1443
- { name_loc: name_loc, operator_loc: operator_loc, value: value, location: location }
1444
- end
1445
-
1446
- # def name: () -> String
1447
- def name
1448
- name_loc.slice
1449
- end
1450
-
1451
- # def operator: () -> String
1452
- def operator
1453
- operator_loc.slice
1454
- end
1455
- end
1456
-
1457
- # Represents the use of the `||=` operator for assignment to a constant.
1458
- #
1459
- # Target ||= value
1460
- # ^^^^^^^^^^^^^^^^
1461
- class ConstantOperatorOrWriteNode < Node
1462
- # attr_reader name_loc: Location
1463
- attr_reader :name_loc
1464
-
1465
- # attr_reader operator_loc: Location
1466
- attr_reader :operator_loc
1467
-
1468
- # attr_reader value: Node
1469
- attr_reader :value
1470
-
1471
- # def initialize: (name_loc: Location, operator_loc: Location, value: Node, location: Location) -> void
1472
- def initialize(name_loc, operator_loc, value, location)
1473
- @name_loc = name_loc
1474
- @operator_loc = operator_loc
1475
- @value = value
1476
- @location = location
1477
- end
1478
-
1479
- # def accept: (visitor: Visitor) -> void
1480
- def accept(visitor)
1481
- visitor.visit_constant_operator_or_write_node(self)
1482
- end
1483
-
1484
- # def child_nodes: () -> Array[nil | Node]
1485
- def child_nodes
1486
- [value]
1487
- end
1488
-
1489
- # def deconstruct: () -> Array[nil | Node]
1490
- alias deconstruct child_nodes
1491
-
1492
- # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
1493
- def deconstruct_keys(keys)
1494
- { name_loc: name_loc, operator_loc: operator_loc, value: value, location: location }
1495
- end
1496
-
1497
- # def name: () -> String
1498
- def name
1499
- name_loc.slice
1500
- end
1501
-
1502
- # def operator: () -> String
1503
- def operator
1504
- operator_loc.slice
1505
- end
1506
- end
1507
-
1508
- # Represents assigning to a constant using an operator that isn't `=`.
1509
- #
1510
- # Target += value
1511
- # ^^^^^^^^^^^^^^^
1512
- class ConstantOperatorWriteNode < Node
1513
- # attr_reader name_loc: Location
1514
- attr_reader :name_loc
1515
-
1516
- # attr_reader operator_loc: Location
1517
- attr_reader :operator_loc
1518
-
1519
- # attr_reader value: Node
1520
- attr_reader :value
1521
-
1522
- # attr_reader operator: Symbol
1523
- attr_reader :operator
1524
-
1525
- # def initialize: (name_loc: Location, operator_loc: Location, value: Node, operator: Symbol, location: Location) -> void
1526
- def initialize(name_loc, operator_loc, value, operator, location)
1527
- @name_loc = name_loc
1528
- @operator_loc = operator_loc
1529
- @value = value
1530
- @operator = operator
1531
- @location = location
1532
- end
1533
-
1534
- # def accept: (visitor: Visitor) -> void
1535
- def accept(visitor)
1536
- visitor.visit_constant_operator_write_node(self)
1537
- end
1538
-
1539
- # def child_nodes: () -> Array[nil | Node]
1540
- def child_nodes
1541
- [value]
1542
- end
1543
-
1544
- # def deconstruct: () -> Array[nil | Node]
1545
- alias deconstruct child_nodes
1546
-
1547
- # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
1548
- def deconstruct_keys(keys)
1549
- { name_loc: name_loc, operator_loc: operator_loc, value: value, operator: operator, location: location }
1550
- end
1551
-
1552
- # def name: () -> String
1553
- def name
1554
- name_loc.slice
1555
- end
1556
- end
1557
-
1558
- # Represents accessing a constant through a path of `::` operators.
1559
- #
1560
- # Foo::Bar
1561
- # ^^^^^^^^
1562
- class ConstantPathNode < Node
1563
- # attr_reader parent: Node?
1564
- attr_reader :parent
1565
-
1566
- # attr_reader child: Node
1567
- attr_reader :child
1568
-
1569
- # attr_reader delimiter_loc: Location
1570
- attr_reader :delimiter_loc
1571
-
1572
- # def initialize: (parent: Node?, child: Node, delimiter_loc: Location, location: Location) -> void
1573
- def initialize(parent, child, delimiter_loc, location)
1574
- @parent = parent
1575
- @child = child
1576
- @delimiter_loc = delimiter_loc
1577
- @location = location
1578
- end
1579
-
1580
- # def accept: (visitor: Visitor) -> void
1581
- def accept(visitor)
1582
- visitor.visit_constant_path_node(self)
1583
- end
1584
-
1585
- # def child_nodes: () -> Array[nil | Node]
1586
- def child_nodes
1587
- [parent, child]
1588
- end
1589
-
1590
- # def deconstruct: () -> Array[nil | Node]
1591
- alias deconstruct child_nodes
1592
-
1593
- # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
1594
- def deconstruct_keys(keys)
1595
- { parent: parent, child: child, delimiter_loc: delimiter_loc, location: location }
1596
- end
1597
-
1598
- # def delimiter: () -> String
1599
- def delimiter
1600
- delimiter_loc.slice
1601
- end
1602
- end
1603
-
1604
- # Represents the use of the `&&=` operator for assignment to a constant path.
1605
- #
1606
- # Parent::Child &&= value
1607
- # ^^^^^^^^^^^^^^^^^^^^^^^
1608
- class ConstantPathOperatorAndWriteNode < Node
1609
- # attr_reader target: Node
1610
- attr_reader :target
1611
-
1612
- # attr_reader operator_loc: Location
1613
- attr_reader :operator_loc
1614
-
1615
- # attr_reader value: Node
1616
- attr_reader :value
1617
-
1618
- # def initialize: (target: Node, operator_loc: Location, value: Node, location: Location) -> void
1619
- def initialize(target, operator_loc, value, location)
1620
- @target = target
1621
- @operator_loc = operator_loc
1622
- @value = value
1623
- @location = location
1624
- end
1625
-
1626
- # def accept: (visitor: Visitor) -> void
1627
- def accept(visitor)
1628
- visitor.visit_constant_path_operator_and_write_node(self)
1629
- end
1630
-
1631
- # def child_nodes: () -> Array[nil | Node]
1632
- def child_nodes
1633
- [target, value]
1634
- end
1635
-
1636
- # def deconstruct: () -> Array[nil | Node]
1637
- alias deconstruct child_nodes
1638
-
1639
- # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
1640
- def deconstruct_keys(keys)
1641
- { target: target, operator_loc: operator_loc, value: value, location: location }
1642
- end
1643
-
1644
- # def operator: () -> String
1645
- def operator
1646
- operator_loc.slice
1647
- end
1648
- end
1649
-
1650
- # Represents the use of the `||=` operator for assignment to a constant path.
1651
- #
1652
- # Parent::Child ||= value
1653
- # ^^^^^^^^^^^^^^^^^^^^^^^
1654
- class ConstantPathOperatorOrWriteNode < Node
1655
- # attr_reader target: Node
1656
- attr_reader :target
1657
-
1658
- # attr_reader operator_loc: Location
1659
- attr_reader :operator_loc
1660
-
1661
- # attr_reader value: Node
1662
- attr_reader :value
1663
-
1664
- # def initialize: (target: Node, operator_loc: Location, value: Node, location: Location) -> void
1665
- def initialize(target, operator_loc, value, location)
1666
- @target = target
1667
- @operator_loc = operator_loc
1668
- @value = value
1669
- @location = location
1670
- end
1671
-
1672
- # def accept: (visitor: Visitor) -> void
1673
- def accept(visitor)
1674
- visitor.visit_constant_path_operator_or_write_node(self)
1675
- end
1676
-
1677
- # def child_nodes: () -> Array[nil | Node]
1678
- def child_nodes
1679
- [target, value]
1680
- end
1681
-
1682
- # def deconstruct: () -> Array[nil | Node]
1683
- alias deconstruct child_nodes
1684
-
1685
- # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
1686
- def deconstruct_keys(keys)
1687
- { target: target, operator_loc: operator_loc, value: value, location: location }
1688
- end
1689
-
1690
- # def operator: () -> String
1691
- def operator
1692
- operator_loc.slice
1693
- end
1694
- end
1695
-
1696
- # Represents assigning to a constant path using an operator that isn't `=`.
1697
- #
1698
- # Parent::Child += value
1699
- # ^^^^^^^^^^^^^^^^^^^^^^
1700
- class ConstantPathOperatorWriteNode < Node
1701
- # attr_reader target: Node
1702
- attr_reader :target
1703
-
1704
- # attr_reader operator_loc: Location
1705
- attr_reader :operator_loc
1706
-
1707
- # attr_reader value: Node
1708
- attr_reader :value
1709
-
1710
- # attr_reader operator: Symbol
1711
- attr_reader :operator
1712
-
1713
- # def initialize: (target: Node, operator_loc: Location, value: Node, operator: Symbol, location: Location) -> void
1714
- def initialize(target, operator_loc, value, operator, location)
1715
- @target = target
1716
- @operator_loc = operator_loc
1717
- @value = value
1718
- @operator = operator
1719
- @location = location
1720
- end
1721
-
1722
- # def accept: (visitor: Visitor) -> void
1723
- def accept(visitor)
1724
- visitor.visit_constant_path_operator_write_node(self)
1725
- end
1726
-
1727
- # def child_nodes: () -> Array[nil | Node]
1728
- def child_nodes
1729
- [target, value]
1730
- end
1731
-
1732
- # def deconstruct: () -> Array[nil | Node]
1733
- alias deconstruct child_nodes
1734
-
1735
- # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
1736
- def deconstruct_keys(keys)
1737
- { target: target, operator_loc: operator_loc, value: value, operator: operator, location: location }
1738
- end
1739
- end
1740
-
1741
- # Represents writing to a constant path.
1742
- #
1743
- # ::Foo = 1
1744
- # ^^^^^^^^^
1745
- #
1746
- # Foo::Bar = 1
1747
- # ^^^^^^^^^^^^
1748
- #
1749
- # ::Foo::Bar = 1
1750
- # ^^^^^^^^^^^^^^
1751
- class ConstantPathWriteNode < Node
1752
- # attr_reader target: Node
1753
- attr_reader :target
1754
-
1755
- # attr_reader operator_loc: Location?
1756
- attr_reader :operator_loc
1757
-
1758
- # attr_reader value: Node?
1759
- attr_reader :value
1760
-
1761
- # def initialize: (target: Node, operator_loc: Location?, value: Node?, location: Location) -> void
1762
- def initialize(target, operator_loc, value, location)
1763
- @target = target
1764
- @operator_loc = operator_loc
1765
- @value = value
1766
- @location = location
1767
- end
1768
-
1769
- # def accept: (visitor: Visitor) -> void
1770
- def accept(visitor)
1771
- visitor.visit_constant_path_write_node(self)
1772
- end
1773
-
1774
- # def child_nodes: () -> Array[nil | Node]
1775
- def child_nodes
1776
- [target, value]
1777
- end
1778
-
1779
- # def deconstruct: () -> Array[nil | Node]
1780
- alias deconstruct child_nodes
1781
-
1782
- # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
1783
- def deconstruct_keys(keys)
1784
- { target: target, operator_loc: operator_loc, value: value, location: location }
1785
- end
1786
-
1787
- # def operator: () -> String?
1788
- def operator
1789
- operator_loc&.slice
1790
- end
1791
- end
1792
-
1793
- # Represents referencing a constant.
1794
- #
1795
- # Foo
1796
- # ^^^
1797
- class ConstantReadNode < Node
1798
- # def initialize: (location: Location) -> void
1799
- def initialize(location)
1800
- @location = location
1801
- end
1802
-
1803
- # def accept: (visitor: Visitor) -> void
1804
- def accept(visitor)
1805
- visitor.visit_constant_read_node(self)
1806
- end
1807
-
1808
- # def child_nodes: () -> Array[nil | Node]
1809
- def child_nodes
1810
- []
1811
- end
1812
-
1813
- # def deconstruct: () -> Array[nil | Node]
1814
- alias deconstruct child_nodes
1815
-
1816
- # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
1817
- def deconstruct_keys(keys)
1818
- { location: location }
1819
- end
1820
- end
1821
-
1822
- # Represents writing to a constant.
1823
- #
1824
- # Foo = 1
1825
- # ^^^^^^^
1826
- class ConstantWriteNode < Node
1827
- # attr_reader name_loc: Location
1828
- attr_reader :name_loc
1829
-
1830
- # attr_reader value: Node?
1831
- attr_reader :value
1832
-
1833
- # attr_reader operator_loc: Location?
1834
- attr_reader :operator_loc
1835
-
1836
- # def initialize: (name_loc: Location, value: Node?, operator_loc: Location?, location: Location) -> void
1837
- def initialize(name_loc, value, operator_loc, location)
1838
- @name_loc = name_loc
1839
- @value = value
1840
- @operator_loc = operator_loc
1841
- @location = location
1842
- end
1843
-
1844
- # def accept: (visitor: Visitor) -> void
1845
- def accept(visitor)
1846
- visitor.visit_constant_write_node(self)
1847
- end
1848
-
1849
- # def child_nodes: () -> Array[nil | Node]
1850
- def child_nodes
1851
- [value]
1852
- end
1853
-
1854
- # def deconstruct: () -> Array[nil | Node]
1855
- alias deconstruct child_nodes
1856
-
1857
- # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
1858
- def deconstruct_keys(keys)
1859
- { name_loc: name_loc, value: value, operator_loc: operator_loc, location: location }
1860
- end
1861
-
1862
- # def name: () -> String
1863
- def name
1864
- name_loc.slice
1865
- end
1866
-
1867
- # def operator: () -> String?
1868
- def operator
1869
- operator_loc&.slice
1870
- end
1871
- end
1872
-
1873
- # Represents a method definition.
1874
- #
1875
- # def method
1876
- # end
1877
- # ^^^^^^^^^^
1878
- class DefNode < Node
1879
- # attr_reader name_loc: Location
1880
- attr_reader :name_loc
1881
-
1882
- # attr_reader receiver: Node?
1883
- attr_reader :receiver
1884
-
1885
- # attr_reader parameters: Node?
1886
- attr_reader :parameters
1887
-
1888
- # attr_reader statements: Node?
1889
- attr_reader :statements
1890
-
1891
- # attr_reader locals: Array[Symbol]
1892
- attr_reader :locals
1893
-
1894
- # attr_reader def_keyword_loc: Location
1895
- attr_reader :def_keyword_loc
1896
-
1897
- # attr_reader operator_loc: Location?
1898
- attr_reader :operator_loc
1899
-
1900
- # attr_reader lparen_loc: Location?
1901
- attr_reader :lparen_loc
1902
-
1903
- # attr_reader rparen_loc: Location?
1904
- attr_reader :rparen_loc
1905
-
1906
- # attr_reader equal_loc: Location?
1907
- attr_reader :equal_loc
1908
-
1909
- # attr_reader end_keyword_loc: Location?
1910
- attr_reader :end_keyword_loc
1911
-
1912
- # def initialize: (name_loc: Location, receiver: Node?, parameters: Node?, statements: Node?, locals: Array[Symbol], def_keyword_loc: Location, operator_loc: Location?, lparen_loc: Location?, rparen_loc: Location?, equal_loc: Location?, end_keyword_loc: Location?, location: Location) -> void
1913
- def initialize(name_loc, receiver, parameters, statements, locals, def_keyword_loc, operator_loc, lparen_loc, rparen_loc, equal_loc, end_keyword_loc, location)
1914
- @name_loc = name_loc
1915
- @receiver = receiver
1916
- @parameters = parameters
1917
- @statements = statements
1918
- @locals = locals
1919
- @def_keyword_loc = def_keyword_loc
1920
- @operator_loc = operator_loc
1921
- @lparen_loc = lparen_loc
1922
- @rparen_loc = rparen_loc
1923
- @equal_loc = equal_loc
1924
- @end_keyword_loc = end_keyword_loc
1925
- @location = location
1926
- end
1927
-
1928
- # def accept: (visitor: Visitor) -> void
1929
- def accept(visitor)
1930
- visitor.visit_def_node(self)
1931
- end
1932
-
1933
- # def child_nodes: () -> Array[nil | Node]
1934
- def child_nodes
1935
- [receiver, parameters, statements]
1936
- end
1937
-
1938
- # def deconstruct: () -> Array[nil | Node]
1939
- alias deconstruct child_nodes
1940
-
1941
- # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
1942
- def deconstruct_keys(keys)
1943
- { name_loc: name_loc, receiver: receiver, parameters: parameters, statements: statements, locals: locals, def_keyword_loc: def_keyword_loc, operator_loc: operator_loc, lparen_loc: lparen_loc, rparen_loc: rparen_loc, equal_loc: equal_loc, end_keyword_loc: end_keyword_loc, location: location }
1548
+ { name_loc: name_loc, receiver: receiver, parameters: parameters, body: body, locals: locals, def_keyword_loc: def_keyword_loc, operator_loc: operator_loc, lparen_loc: lparen_loc, rparen_loc: rparen_loc, equal_loc: equal_loc, end_keyword_loc: end_keyword_loc, location: location }
1944
1549
  end
1945
1550
 
1946
1551
  # def name: () -> String
@@ -2490,137 +2095,33 @@ module YARP
2490
2095
  def do_keyword
2491
2096
  do_keyword_loc&.slice
2492
2097
  end
2493
-
2494
- # def end_keyword: () -> String
2495
- def end_keyword
2496
- end_keyword_loc.slice
2497
- end
2498
- end
2499
-
2500
- # Represents forwarding all arguments to this method to another method.
2501
- #
2502
- # def foo(...)
2503
- # bar(...)
2504
- # ^^^^^^^^
2505
- # end
2506
- class ForwardingArgumentsNode < Node
2507
- # def initialize: (location: Location) -> void
2508
- def initialize(location)
2509
- @location = location
2510
- end
2511
-
2512
- # def accept: (visitor: Visitor) -> void
2513
- def accept(visitor)
2514
- visitor.visit_forwarding_arguments_node(self)
2515
- end
2516
-
2517
- # def child_nodes: () -> Array[nil | Node]
2518
- def child_nodes
2519
- []
2520
- end
2521
-
2522
- # def deconstruct: () -> Array[nil | Node]
2523
- alias deconstruct child_nodes
2524
-
2525
- # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
2526
- def deconstruct_keys(keys)
2527
- { location: location }
2528
- end
2529
- end
2530
-
2531
- # Represents the use of the forwarding parameter in a method, block, or lambda declaration.
2532
- #
2533
- # def foo(...)
2534
- # ^^^
2535
- # end
2536
- class ForwardingParameterNode < Node
2537
- # def initialize: (location: Location) -> void
2538
- def initialize(location)
2539
- @location = location
2540
- end
2541
-
2542
- # def accept: (visitor: Visitor) -> void
2543
- def accept(visitor)
2544
- visitor.visit_forwarding_parameter_node(self)
2545
- end
2546
-
2547
- # def child_nodes: () -> Array[nil | Node]
2548
- def child_nodes
2549
- []
2550
- end
2551
-
2552
- # def deconstruct: () -> Array[nil | Node]
2553
- alias deconstruct child_nodes
2554
-
2555
- # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
2556
- def deconstruct_keys(keys)
2557
- { location: location }
2558
- end
2559
- end
2560
-
2561
- # Represents the use of the `super` keyword without parentheses or arguments.
2562
- #
2563
- # super
2564
- # ^^^^^
2565
- class ForwardingSuperNode < Node
2566
- # attr_reader block: Node?
2567
- attr_reader :block
2568
-
2569
- # def initialize: (block: Node?, location: Location) -> void
2570
- def initialize(block, location)
2571
- @block = block
2572
- @location = location
2573
- end
2574
-
2575
- # def accept: (visitor: Visitor) -> void
2576
- def accept(visitor)
2577
- visitor.visit_forwarding_super_node(self)
2578
- end
2579
-
2580
- # def child_nodes: () -> Array[nil | Node]
2581
- def child_nodes
2582
- [block]
2583
- end
2584
-
2585
- # def deconstruct: () -> Array[nil | Node]
2586
- alias deconstruct child_nodes
2587
-
2588
- # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
2589
- def deconstruct_keys(keys)
2590
- { block: block, location: location }
2591
- end
2098
+
2099
+ # def end_keyword: () -> String
2100
+ def end_keyword
2101
+ end_keyword_loc.slice
2102
+ end
2592
2103
  end
2593
2104
 
2594
- # Represents the use of the `&&=` operator for assignment to a global variable.
2105
+ # Represents forwarding all arguments to this method to another method.
2595
2106
  #
2596
- # $target &&= value
2597
- # ^^^^^^^^^^^^^^^^^
2598
- class GlobalVariableOperatorAndWriteNode < Node
2599
- # attr_reader name_loc: Location
2600
- attr_reader :name_loc
2601
-
2602
- # attr_reader operator_loc: Location
2603
- attr_reader :operator_loc
2604
-
2605
- # attr_reader value: Node
2606
- attr_reader :value
2607
-
2608
- # def initialize: (name_loc: Location, operator_loc: Location, value: Node, location: Location) -> void
2609
- def initialize(name_loc, operator_loc, value, location)
2610
- @name_loc = name_loc
2611
- @operator_loc = operator_loc
2612
- @value = value
2107
+ # def foo(...)
2108
+ # bar(...)
2109
+ # ^^^^^^^^
2110
+ # end
2111
+ class ForwardingArgumentsNode < Node
2112
+ # def initialize: (location: Location) -> void
2113
+ def initialize(location)
2613
2114
  @location = location
2614
2115
  end
2615
2116
 
2616
2117
  # def accept: (visitor: Visitor) -> void
2617
2118
  def accept(visitor)
2618
- visitor.visit_global_variable_operator_and_write_node(self)
2119
+ visitor.visit_forwarding_arguments_node(self)
2619
2120
  end
2620
2121
 
2621
2122
  # def child_nodes: () -> Array[nil | Node]
2622
2123
  def child_nodes
2623
- [value]
2124
+ []
2624
2125
  end
2625
2126
 
2626
2127
  # def deconstruct: () -> Array[nil | Node]
@@ -2628,50 +2129,29 @@ module YARP
2628
2129
 
2629
2130
  # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
2630
2131
  def deconstruct_keys(keys)
2631
- { name_loc: name_loc, operator_loc: operator_loc, value: value, location: location }
2632
- end
2633
-
2634
- # def name: () -> String
2635
- def name
2636
- name_loc.slice
2637
- end
2638
-
2639
- # def operator: () -> String
2640
- def operator
2641
- operator_loc.slice
2132
+ { location: location }
2642
2133
  end
2643
2134
  end
2644
2135
 
2645
- # Represents the use of the `||=` operator for assignment to a global variable.
2136
+ # Represents the use of the forwarding parameter in a method, block, or lambda declaration.
2646
2137
  #
2647
- # $target ||= value
2648
- # ^^^^^^^^^^^^^^^^^
2649
- class GlobalVariableOperatorOrWriteNode < Node
2650
- # attr_reader name_loc: Location
2651
- attr_reader :name_loc
2652
-
2653
- # attr_reader operator_loc: Location
2654
- attr_reader :operator_loc
2655
-
2656
- # attr_reader value: Node
2657
- attr_reader :value
2658
-
2659
- # def initialize: (name_loc: Location, operator_loc: Location, value: Node, location: Location) -> void
2660
- def initialize(name_loc, operator_loc, value, location)
2661
- @name_loc = name_loc
2662
- @operator_loc = operator_loc
2663
- @value = value
2138
+ # def foo(...)
2139
+ # ^^^
2140
+ # end
2141
+ class ForwardingParameterNode < Node
2142
+ # def initialize: (location: Location) -> void
2143
+ def initialize(location)
2664
2144
  @location = location
2665
2145
  end
2666
2146
 
2667
2147
  # def accept: (visitor: Visitor) -> void
2668
2148
  def accept(visitor)
2669
- visitor.visit_global_variable_operator_or_write_node(self)
2149
+ visitor.visit_forwarding_parameter_node(self)
2670
2150
  end
2671
2151
 
2672
2152
  # def child_nodes: () -> Array[nil | Node]
2673
2153
  def child_nodes
2674
- [value]
2154
+ []
2675
2155
  end
2676
2156
 
2677
2157
  # def deconstruct: () -> Array[nil | Node]
@@ -2679,54 +2159,32 @@ module YARP
2679
2159
 
2680
2160
  # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
2681
2161
  def deconstruct_keys(keys)
2682
- { name_loc: name_loc, operator_loc: operator_loc, value: value, location: location }
2683
- end
2684
-
2685
- # def name: () -> String
2686
- def name
2687
- name_loc.slice
2688
- end
2689
-
2690
- # def operator: () -> String
2691
- def operator
2692
- operator_loc.slice
2162
+ { location: location }
2693
2163
  end
2694
2164
  end
2695
2165
 
2696
- # Represents assigning to a global variable using an operator that isn't `=`.
2166
+ # Represents the use of the `super` keyword without parentheses or arguments.
2697
2167
  #
2698
- # $target += value
2699
- # ^^^^^^^^^^^^^^^^
2700
- class GlobalVariableOperatorWriteNode < Node
2701
- # attr_reader name_loc: Location
2702
- attr_reader :name_loc
2703
-
2704
- # attr_reader operator_loc: Location
2705
- attr_reader :operator_loc
2706
-
2707
- # attr_reader value: Node
2708
- attr_reader :value
2709
-
2710
- # attr_reader operator: Symbol
2711
- attr_reader :operator
2168
+ # super
2169
+ # ^^^^^
2170
+ class ForwardingSuperNode < Node
2171
+ # attr_reader block: Node?
2172
+ attr_reader :block
2712
2173
 
2713
- # def initialize: (name_loc: Location, operator_loc: Location, value: Node, operator: Symbol, location: Location) -> void
2714
- def initialize(name_loc, operator_loc, value, operator, location)
2715
- @name_loc = name_loc
2716
- @operator_loc = operator_loc
2717
- @value = value
2718
- @operator = operator
2174
+ # def initialize: (block: Node?, location: Location) -> void
2175
+ def initialize(block, location)
2176
+ @block = block
2719
2177
  @location = location
2720
2178
  end
2721
2179
 
2722
2180
  # def accept: (visitor: Visitor) -> void
2723
2181
  def accept(visitor)
2724
- visitor.visit_global_variable_operator_write_node(self)
2182
+ visitor.visit_forwarding_super_node(self)
2725
2183
  end
2726
2184
 
2727
2185
  # def child_nodes: () -> Array[nil | Node]
2728
2186
  def child_nodes
2729
- [value]
2187
+ [block]
2730
2188
  end
2731
2189
 
2732
2190
  # def deconstruct: () -> Array[nil | Node]
@@ -2734,12 +2192,7 @@ module YARP
2734
2192
 
2735
2193
  # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
2736
2194
  def deconstruct_keys(keys)
2737
- { name_loc: name_loc, operator_loc: operator_loc, value: value, operator: operator, location: location }
2738
- end
2739
-
2740
- # def name: () -> String
2741
- def name
2742
- name_loc.slice
2195
+ { block: block, location: location }
2743
2196
  end
2744
2197
  end
2745
2198
 
@@ -2956,170 +2409,31 @@ module YARP
2956
2409
  # attr_reader consequent: Node?
2957
2410
  attr_reader :consequent
2958
2411
 
2959
- # attr_reader end_keyword_loc: Location?
2960
- attr_reader :end_keyword_loc
2961
-
2962
- # def initialize: (if_keyword_loc: Location?, predicate: Node, statements: Node?, consequent: Node?, end_keyword_loc: Location?, location: Location) -> void
2963
- def initialize(if_keyword_loc, predicate, statements, consequent, end_keyword_loc, location)
2964
- @if_keyword_loc = if_keyword_loc
2965
- @predicate = predicate
2966
- @statements = statements
2967
- @consequent = consequent
2968
- @end_keyword_loc = end_keyword_loc
2969
- @location = location
2970
- end
2971
-
2972
- # def accept: (visitor: Visitor) -> void
2973
- def accept(visitor)
2974
- visitor.visit_if_node(self)
2975
- end
2976
-
2977
- def set_newline_flag(newline_marked)
2978
- predicate.set_newline_flag(newline_marked)
2979
- end
2980
-
2981
- # def child_nodes: () -> Array[nil | Node]
2982
- def child_nodes
2983
- [predicate, statements, consequent]
2984
- end
2985
-
2986
- # def deconstruct: () -> Array[nil | Node]
2987
- alias deconstruct child_nodes
2988
-
2989
- # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
2990
- def deconstruct_keys(keys)
2991
- { if_keyword_loc: if_keyword_loc, predicate: predicate, statements: statements, consequent: consequent, end_keyword_loc: end_keyword_loc, location: location }
2992
- end
2993
-
2994
- # def if_keyword: () -> String?
2995
- def if_keyword
2996
- if_keyword_loc&.slice
2997
- end
2998
-
2999
- # def end_keyword: () -> String?
3000
- def end_keyword
3001
- end_keyword_loc&.slice
3002
- end
3003
- end
3004
-
3005
- # Represents an imaginary number literal.
3006
- #
3007
- # 1.0i
3008
- # ^^^^
3009
- class ImaginaryNode < Node
3010
- # attr_reader numeric: Node
3011
- attr_reader :numeric
3012
-
3013
- # def initialize: (numeric: Node, location: Location) -> void
3014
- def initialize(numeric, location)
3015
- @numeric = numeric
3016
- @location = location
3017
- end
3018
-
3019
- # def accept: (visitor: Visitor) -> void
3020
- def accept(visitor)
3021
- visitor.visit_imaginary_node(self)
3022
- end
3023
-
3024
- # def child_nodes: () -> Array[nil | Node]
3025
- def child_nodes
3026
- [numeric]
3027
- end
3028
-
3029
- # def deconstruct: () -> Array[nil | Node]
3030
- alias deconstruct child_nodes
3031
-
3032
- # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
3033
- def deconstruct_keys(keys)
3034
- { numeric: numeric, location: location }
3035
- end
3036
- end
3037
-
3038
- # Represents the use of the `in` keyword in a case statement.
3039
- #
3040
- # case a; in b then c end
3041
- # ^^^^^^^^^^^
3042
- class InNode < Node
3043
- # attr_reader pattern: Node
3044
- attr_reader :pattern
3045
-
3046
- # attr_reader statements: Node?
3047
- attr_reader :statements
3048
-
3049
- # attr_reader in_loc: Location
3050
- attr_reader :in_loc
3051
-
3052
- # attr_reader then_loc: Location?
3053
- attr_reader :then_loc
3054
-
3055
- # def initialize: (pattern: Node, statements: Node?, in_loc: Location, then_loc: Location?, location: Location) -> void
3056
- def initialize(pattern, statements, in_loc, then_loc, location)
3057
- @pattern = pattern
3058
- @statements = statements
3059
- @in_loc = in_loc
3060
- @then_loc = then_loc
3061
- @location = location
3062
- end
3063
-
3064
- # def accept: (visitor: Visitor) -> void
3065
- def accept(visitor)
3066
- visitor.visit_in_node(self)
3067
- end
3068
-
3069
- # def child_nodes: () -> Array[nil | Node]
3070
- def child_nodes
3071
- [pattern, statements]
3072
- end
3073
-
3074
- # def deconstruct: () -> Array[nil | Node]
3075
- alias deconstruct child_nodes
3076
-
3077
- # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
3078
- def deconstruct_keys(keys)
3079
- { pattern: pattern, statements: statements, in_loc: in_loc, then_loc: then_loc, location: location }
3080
- end
3081
-
3082
- # def in: () -> String
3083
- def in
3084
- in_loc.slice
3085
- end
3086
-
3087
- # def then: () -> String?
3088
- def then
3089
- then_loc&.slice
3090
- end
3091
- end
3092
-
3093
- # Represents the use of the `&&=` operator for assignment to an instance variable.
3094
- #
3095
- # @target &&= value
3096
- # ^^^^^^^^^^^^^^^^^
3097
- class InstanceVariableOperatorAndWriteNode < Node
3098
- # attr_reader name_loc: Location
3099
- attr_reader :name_loc
3100
-
3101
- # attr_reader operator_loc: Location
3102
- attr_reader :operator_loc
3103
-
3104
- # attr_reader value: Node
3105
- attr_reader :value
2412
+ # attr_reader end_keyword_loc: Location?
2413
+ attr_reader :end_keyword_loc
3106
2414
 
3107
- # def initialize: (name_loc: Location, operator_loc: Location, value: Node, location: Location) -> void
3108
- def initialize(name_loc, operator_loc, value, location)
3109
- @name_loc = name_loc
3110
- @operator_loc = operator_loc
3111
- @value = value
2415
+ # def initialize: (if_keyword_loc: Location?, predicate: Node, statements: Node?, consequent: Node?, end_keyword_loc: Location?, location: Location) -> void
2416
+ def initialize(if_keyword_loc, predicate, statements, consequent, end_keyword_loc, location)
2417
+ @if_keyword_loc = if_keyword_loc
2418
+ @predicate = predicate
2419
+ @statements = statements
2420
+ @consequent = consequent
2421
+ @end_keyword_loc = end_keyword_loc
3112
2422
  @location = location
3113
2423
  end
3114
2424
 
3115
2425
  # def accept: (visitor: Visitor) -> void
3116
2426
  def accept(visitor)
3117
- visitor.visit_instance_variable_operator_and_write_node(self)
2427
+ visitor.visit_if_node(self)
2428
+ end
2429
+
2430
+ def set_newline_flag(newline_marked)
2431
+ predicate.set_newline_flag(newline_marked)
3118
2432
  end
3119
2433
 
3120
2434
  # def child_nodes: () -> Array[nil | Node]
3121
2435
  def child_nodes
3122
- [value]
2436
+ [predicate, statements, consequent]
3123
2437
  end
3124
2438
 
3125
2439
  # def deconstruct: () -> Array[nil | Node]
@@ -3127,50 +2441,42 @@ module YARP
3127
2441
 
3128
2442
  # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
3129
2443
  def deconstruct_keys(keys)
3130
- { name_loc: name_loc, operator_loc: operator_loc, value: value, location: location }
2444
+ { if_keyword_loc: if_keyword_loc, predicate: predicate, statements: statements, consequent: consequent, end_keyword_loc: end_keyword_loc, location: location }
3131
2445
  end
3132
2446
 
3133
- # def name: () -> String
3134
- def name
3135
- name_loc.slice
2447
+ # def if_keyword: () -> String?
2448
+ def if_keyword
2449
+ if_keyword_loc&.slice
3136
2450
  end
3137
2451
 
3138
- # def operator: () -> String
3139
- def operator
3140
- operator_loc.slice
2452
+ # def end_keyword: () -> String?
2453
+ def end_keyword
2454
+ end_keyword_loc&.slice
3141
2455
  end
3142
2456
  end
3143
2457
 
3144
- # Represents the use of the `||=` operator for assignment to an instance variable.
2458
+ # Represents an imaginary number literal.
3145
2459
  #
3146
- # @target ||= value
3147
- # ^^^^^^^^^^^^^^^^^
3148
- class InstanceVariableOperatorOrWriteNode < Node
3149
- # attr_reader name_loc: Location
3150
- attr_reader :name_loc
3151
-
3152
- # attr_reader operator_loc: Location
3153
- attr_reader :operator_loc
3154
-
3155
- # attr_reader value: Node
3156
- attr_reader :value
2460
+ # 1.0i
2461
+ # ^^^^
2462
+ class ImaginaryNode < Node
2463
+ # attr_reader numeric: Node
2464
+ attr_reader :numeric
3157
2465
 
3158
- # def initialize: (name_loc: Location, operator_loc: Location, value: Node, location: Location) -> void
3159
- def initialize(name_loc, operator_loc, value, location)
3160
- @name_loc = name_loc
3161
- @operator_loc = operator_loc
3162
- @value = value
2466
+ # def initialize: (numeric: Node, location: Location) -> void
2467
+ def initialize(numeric, location)
2468
+ @numeric = numeric
3163
2469
  @location = location
3164
2470
  end
3165
2471
 
3166
2472
  # def accept: (visitor: Visitor) -> void
3167
2473
  def accept(visitor)
3168
- visitor.visit_instance_variable_operator_or_write_node(self)
2474
+ visitor.visit_imaginary_node(self)
3169
2475
  end
3170
2476
 
3171
2477
  # def child_nodes: () -> Array[nil | Node]
3172
2478
  def child_nodes
3173
- [value]
2479
+ [numeric]
3174
2480
  end
3175
2481
 
3176
2482
  # def deconstruct: () -> Array[nil | Node]
@@ -3178,54 +2484,44 @@ module YARP
3178
2484
 
3179
2485
  # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
3180
2486
  def deconstruct_keys(keys)
3181
- { name_loc: name_loc, operator_loc: operator_loc, value: value, location: location }
3182
- end
3183
-
3184
- # def name: () -> String
3185
- def name
3186
- name_loc.slice
3187
- end
3188
-
3189
- # def operator: () -> String
3190
- def operator
3191
- operator_loc.slice
2487
+ { numeric: numeric, location: location }
3192
2488
  end
3193
2489
  end
3194
2490
 
3195
- # Represents assigning to an instance variable using an operator that isn't `=`.
2491
+ # Represents the use of the `in` keyword in a case statement.
3196
2492
  #
3197
- # @target += value
3198
- # ^^^^^^^^^^^^^^^^
3199
- class InstanceVariableOperatorWriteNode < Node
3200
- # attr_reader name_loc: Location
3201
- attr_reader :name_loc
2493
+ # case a; in b then c end
2494
+ # ^^^^^^^^^^^
2495
+ class InNode < Node
2496
+ # attr_reader pattern: Node
2497
+ attr_reader :pattern
3202
2498
 
3203
- # attr_reader operator_loc: Location
3204
- attr_reader :operator_loc
2499
+ # attr_reader statements: Node?
2500
+ attr_reader :statements
3205
2501
 
3206
- # attr_reader value: Node
3207
- attr_reader :value
2502
+ # attr_reader in_loc: Location
2503
+ attr_reader :in_loc
3208
2504
 
3209
- # attr_reader operator: Symbol
3210
- attr_reader :operator
2505
+ # attr_reader then_loc: Location?
2506
+ attr_reader :then_loc
3211
2507
 
3212
- # def initialize: (name_loc: Location, operator_loc: Location, value: Node, operator: Symbol, location: Location) -> void
3213
- def initialize(name_loc, operator_loc, value, operator, location)
3214
- @name_loc = name_loc
3215
- @operator_loc = operator_loc
3216
- @value = value
3217
- @operator = operator
2508
+ # def initialize: (pattern: Node, statements: Node?, in_loc: Location, then_loc: Location?, location: Location) -> void
2509
+ def initialize(pattern, statements, in_loc, then_loc, location)
2510
+ @pattern = pattern
2511
+ @statements = statements
2512
+ @in_loc = in_loc
2513
+ @then_loc = then_loc
3218
2514
  @location = location
3219
2515
  end
3220
2516
 
3221
2517
  # def accept: (visitor: Visitor) -> void
3222
2518
  def accept(visitor)
3223
- visitor.visit_instance_variable_operator_write_node(self)
2519
+ visitor.visit_in_node(self)
3224
2520
  end
3225
2521
 
3226
2522
  # def child_nodes: () -> Array[nil | Node]
3227
2523
  def child_nodes
3228
- [value]
2524
+ [pattern, statements]
3229
2525
  end
3230
2526
 
3231
2527
  # def deconstruct: () -> Array[nil | Node]
@@ -3233,12 +2529,17 @@ module YARP
3233
2529
 
3234
2530
  # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
3235
2531
  def deconstruct_keys(keys)
3236
- { name_loc: name_loc, operator_loc: operator_loc, value: value, operator: operator, location: location }
2532
+ { pattern: pattern, statements: statements, in_loc: in_loc, then_loc: then_loc, location: location }
3237
2533
  end
3238
2534
 
3239
- # def name: () -> String
3240
- def name
3241
- name_loc.slice
2535
+ # def in: () -> String
2536
+ def in
2537
+ in_loc.slice
2538
+ end
2539
+
2540
+ # def then: () -> String?
2541
+ def then
2542
+ then_loc&.slice
3242
2543
  end
3243
2544
  end
3244
2545
 
@@ -3690,202 +2991,42 @@ module YARP
3690
2991
 
3691
2992
  # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
3692
2993
  def deconstruct_keys(keys)
3693
- { name_loc: name_loc, value: value, location: location }
3694
- end
3695
-
3696
- # def name: () -> String
3697
- def name
3698
- name_loc.slice
3699
- end
3700
- end
3701
-
3702
- # Represents a keyword rest parameter to a method, block, or lambda definition.
3703
- #
3704
- # def a(**b)
3705
- # ^^^
3706
- # end
3707
- class KeywordRestParameterNode < Node
3708
- # attr_reader operator_loc: Location
3709
- attr_reader :operator_loc
3710
-
3711
- # attr_reader name_loc: Location?
3712
- attr_reader :name_loc
3713
-
3714
- # def initialize: (operator_loc: Location, name_loc: Location?, location: Location) -> void
3715
- def initialize(operator_loc, name_loc, location)
3716
- @operator_loc = operator_loc
3717
- @name_loc = name_loc
3718
- @location = location
3719
- end
3720
-
3721
- # def accept: (visitor: Visitor) -> void
3722
- def accept(visitor)
3723
- visitor.visit_keyword_rest_parameter_node(self)
3724
- end
3725
-
3726
- # def child_nodes: () -> Array[nil | Node]
3727
- def child_nodes
3728
- []
3729
- end
3730
-
3731
- # def deconstruct: () -> Array[nil | Node]
3732
- alias deconstruct child_nodes
3733
-
3734
- # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
3735
- def deconstruct_keys(keys)
3736
- { operator_loc: operator_loc, name_loc: name_loc, location: location }
3737
- end
3738
-
3739
- # def operator: () -> String
3740
- def operator
3741
- operator_loc.slice
3742
- end
3743
-
3744
- # def name: () -> String?
3745
- def name
3746
- name_loc&.slice
3747
- end
3748
- end
3749
-
3750
- # Represents using a lambda literal (not the lambda method call).
3751
- #
3752
- # ->(value) { value * 2 }
3753
- # ^^^^^^^^^^^^^^^^^^^^^^^
3754
- class LambdaNode < Node
3755
- # attr_reader locals: Array[Symbol]
3756
- attr_reader :locals
3757
-
3758
- # attr_reader opening_loc: Location
3759
- attr_reader :opening_loc
3760
-
3761
- # attr_reader parameters: Node?
3762
- attr_reader :parameters
3763
-
3764
- # attr_reader statements: Node?
3765
- attr_reader :statements
3766
-
3767
- # def initialize: (locals: Array[Symbol], opening_loc: Location, parameters: Node?, statements: Node?, location: Location) -> void
3768
- def initialize(locals, opening_loc, parameters, statements, location)
3769
- @locals = locals
3770
- @opening_loc = opening_loc
3771
- @parameters = parameters
3772
- @statements = statements
3773
- @location = location
3774
- end
3775
-
3776
- # def accept: (visitor: Visitor) -> void
3777
- def accept(visitor)
3778
- visitor.visit_lambda_node(self)
3779
- end
3780
-
3781
- # def child_nodes: () -> Array[nil | Node]
3782
- def child_nodes
3783
- [parameters, statements]
3784
- end
3785
-
3786
- # def deconstruct: () -> Array[nil | Node]
3787
- alias deconstruct child_nodes
3788
-
3789
- # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
3790
- def deconstruct_keys(keys)
3791
- { locals: locals, opening_loc: opening_loc, parameters: parameters, statements: statements, location: location }
3792
- end
3793
-
3794
- # def opening: () -> String
3795
- def opening
3796
- opening_loc.slice
3797
- end
3798
- end
3799
-
3800
- # Represents the use of the `&&=` operator for assignment to a local variable.
3801
- #
3802
- # target &&= value
3803
- # ^^^^^^^^^^^^^^^^
3804
- class LocalVariableOperatorAndWriteNode < Node
3805
- # attr_reader name_loc: Location
3806
- attr_reader :name_loc
3807
-
3808
- # attr_reader operator_loc: Location
3809
- attr_reader :operator_loc
3810
-
3811
- # attr_reader value: Node
3812
- attr_reader :value
3813
-
3814
- # attr_reader constant_id: Symbol
3815
- attr_reader :constant_id
3816
-
3817
- # def initialize: (name_loc: Location, operator_loc: Location, value: Node, constant_id: Symbol, location: Location) -> void
3818
- def initialize(name_loc, operator_loc, value, constant_id, location)
3819
- @name_loc = name_loc
3820
- @operator_loc = operator_loc
3821
- @value = value
3822
- @constant_id = constant_id
3823
- @location = location
3824
- end
3825
-
3826
- # def accept: (visitor: Visitor) -> void
3827
- def accept(visitor)
3828
- visitor.visit_local_variable_operator_and_write_node(self)
3829
- end
3830
-
3831
- # def child_nodes: () -> Array[nil | Node]
3832
- def child_nodes
3833
- [value]
3834
- end
3835
-
3836
- # def deconstruct: () -> Array[nil | Node]
3837
- alias deconstruct child_nodes
3838
-
3839
- # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
3840
- def deconstruct_keys(keys)
3841
- { name_loc: name_loc, operator_loc: operator_loc, value: value, constant_id: constant_id, location: location }
2994
+ { name_loc: name_loc, value: value, location: location }
3842
2995
  end
3843
2996
 
3844
2997
  # def name: () -> String
3845
2998
  def name
3846
2999
  name_loc.slice
3847
3000
  end
3848
-
3849
- # def operator: () -> String
3850
- def operator
3851
- operator_loc.slice
3852
- end
3853
3001
  end
3854
3002
 
3855
- # Represents the use of the `||=` operator for assignment to a local variable.
3003
+ # Represents a keyword rest parameter to a method, block, or lambda definition.
3856
3004
  #
3857
- # target ||= value
3858
- # ^^^^^^^^^^^^^^^^
3859
- class LocalVariableOperatorOrWriteNode < Node
3860
- # attr_reader name_loc: Location
3861
- attr_reader :name_loc
3862
-
3005
+ # def a(**b)
3006
+ # ^^^
3007
+ # end
3008
+ class KeywordRestParameterNode < Node
3863
3009
  # attr_reader operator_loc: Location
3864
3010
  attr_reader :operator_loc
3865
3011
 
3866
- # attr_reader value: Node
3867
- attr_reader :value
3868
-
3869
- # attr_reader constant_id: Symbol
3870
- attr_reader :constant_id
3012
+ # attr_reader name_loc: Location?
3013
+ attr_reader :name_loc
3871
3014
 
3872
- # def initialize: (name_loc: Location, operator_loc: Location, value: Node, constant_id: Symbol, location: Location) -> void
3873
- def initialize(name_loc, operator_loc, value, constant_id, location)
3874
- @name_loc = name_loc
3015
+ # def initialize: (operator_loc: Location, name_loc: Location?, location: Location) -> void
3016
+ def initialize(operator_loc, name_loc, location)
3875
3017
  @operator_loc = operator_loc
3876
- @value = value
3877
- @constant_id = constant_id
3018
+ @name_loc = name_loc
3878
3019
  @location = location
3879
3020
  end
3880
3021
 
3881
3022
  # def accept: (visitor: Visitor) -> void
3882
3023
  def accept(visitor)
3883
- visitor.visit_local_variable_operator_or_write_node(self)
3024
+ visitor.visit_keyword_rest_parameter_node(self)
3884
3025
  end
3885
3026
 
3886
3027
  # def child_nodes: () -> Array[nil | Node]
3887
3028
  def child_nodes
3888
- [value]
3029
+ []
3889
3030
  end
3890
3031
 
3891
3032
  # def deconstruct: () -> Array[nil | Node]
@@ -3893,58 +3034,54 @@ module YARP
3893
3034
 
3894
3035
  # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
3895
3036
  def deconstruct_keys(keys)
3896
- { name_loc: name_loc, operator_loc: operator_loc, value: value, constant_id: constant_id, location: location }
3897
- end
3898
-
3899
- # def name: () -> String
3900
- def name
3901
- name_loc.slice
3037
+ { operator_loc: operator_loc, name_loc: name_loc, location: location }
3902
3038
  end
3903
3039
 
3904
3040
  # def operator: () -> String
3905
3041
  def operator
3906
3042
  operator_loc.slice
3907
3043
  end
3044
+
3045
+ # def name: () -> String?
3046
+ def name
3047
+ name_loc&.slice
3048
+ end
3908
3049
  end
3909
3050
 
3910
- # Represents assigning to a local variable using an operator that isn't `=`.
3051
+ # Represents using a lambda literal (not the lambda method call).
3911
3052
  #
3912
- # target += value
3913
- # ^^^^^^^^^^^^^^^
3914
- class LocalVariableOperatorWriteNode < Node
3915
- # attr_reader name_loc: Location
3916
- attr_reader :name_loc
3917
-
3918
- # attr_reader operator_loc: Location
3919
- attr_reader :operator_loc
3053
+ # ->(value) { value * 2 }
3054
+ # ^^^^^^^^^^^^^^^^^^^^^^^
3055
+ class LambdaNode < Node
3056
+ # attr_reader locals: Array[Symbol]
3057
+ attr_reader :locals
3920
3058
 
3921
- # attr_reader value: Node
3922
- attr_reader :value
3059
+ # attr_reader opening_loc: Location
3060
+ attr_reader :opening_loc
3923
3061
 
3924
- # attr_reader constant_id: Symbol
3925
- attr_reader :constant_id
3062
+ # attr_reader parameters: Node?
3063
+ attr_reader :parameters
3926
3064
 
3927
- # attr_reader operator_id: Symbol
3928
- attr_reader :operator_id
3065
+ # attr_reader body: Node?
3066
+ attr_reader :body
3929
3067
 
3930
- # def initialize: (name_loc: Location, operator_loc: Location, value: Node, constant_id: Symbol, operator_id: Symbol, location: Location) -> void
3931
- def initialize(name_loc, operator_loc, value, constant_id, operator_id, location)
3932
- @name_loc = name_loc
3933
- @operator_loc = operator_loc
3934
- @value = value
3935
- @constant_id = constant_id
3936
- @operator_id = operator_id
3068
+ # def initialize: (locals: Array[Symbol], opening_loc: Location, parameters: Node?, body: Node?, location: Location) -> void
3069
+ def initialize(locals, opening_loc, parameters, body, location)
3070
+ @locals = locals
3071
+ @opening_loc = opening_loc
3072
+ @parameters = parameters
3073
+ @body = body
3937
3074
  @location = location
3938
3075
  end
3939
3076
 
3940
3077
  # def accept: (visitor: Visitor) -> void
3941
3078
  def accept(visitor)
3942
- visitor.visit_local_variable_operator_write_node(self)
3079
+ visitor.visit_lambda_node(self)
3943
3080
  end
3944
3081
 
3945
3082
  # def child_nodes: () -> Array[nil | Node]
3946
3083
  def child_nodes
3947
- [value]
3084
+ [parameters, body]
3948
3085
  end
3949
3086
 
3950
3087
  # def deconstruct: () -> Array[nil | Node]
@@ -3952,17 +3089,12 @@ module YARP
3952
3089
 
3953
3090
  # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
3954
3091
  def deconstruct_keys(keys)
3955
- { name_loc: name_loc, operator_loc: operator_loc, value: value, constant_id: constant_id, operator_id: operator_id, location: location }
3956
- end
3957
-
3958
- # def name: () -> String
3959
- def name
3960
- name_loc.slice
3092
+ { locals: locals, opening_loc: opening_loc, parameters: parameters, body: body, location: location }
3961
3093
  end
3962
3094
 
3963
- # def operator: () -> String
3964
- def operator
3965
- operator_loc.slice
3095
+ # def opening: () -> String
3096
+ def opening
3097
+ opening_loc.slice
3966
3098
  end
3967
3099
  end
3968
3100
 
@@ -4197,18 +3329,18 @@ module YARP
4197
3329
  # attr_reader constant_path: Node
4198
3330
  attr_reader :constant_path
4199
3331
 
4200
- # attr_reader statements: Node?
4201
- attr_reader :statements
3332
+ # attr_reader body: Node?
3333
+ attr_reader :body
4202
3334
 
4203
3335
  # attr_reader end_keyword_loc: Location
4204
3336
  attr_reader :end_keyword_loc
4205
3337
 
4206
- # def initialize: (locals: Array[Symbol], module_keyword_loc: Location, constant_path: Node, statements: Node?, end_keyword_loc: Location, location: Location) -> void
4207
- def initialize(locals, module_keyword_loc, constant_path, statements, end_keyword_loc, location)
3338
+ # def initialize: (locals: Array[Symbol], module_keyword_loc: Location, constant_path: Node, body: Node?, end_keyword_loc: Location, location: Location) -> void
3339
+ def initialize(locals, module_keyword_loc, constant_path, body, end_keyword_loc, location)
4208
3340
  @locals = locals
4209
3341
  @module_keyword_loc = module_keyword_loc
4210
3342
  @constant_path = constant_path
4211
- @statements = statements
3343
+ @body = body
4212
3344
  @end_keyword_loc = end_keyword_loc
4213
3345
  @location = location
4214
3346
  end
@@ -4220,7 +3352,7 @@ module YARP
4220
3352
 
4221
3353
  # def child_nodes: () -> Array[nil | Node]
4222
3354
  def child_nodes
4223
- [constant_path, statements]
3355
+ [constant_path, body]
4224
3356
  end
4225
3357
 
4226
3358
  # def deconstruct: () -> Array[nil | Node]
@@ -4228,7 +3360,7 @@ module YARP
4228
3360
 
4229
3361
  # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
4230
3362
  def deconstruct_keys(keys)
4231
- { locals: locals, module_keyword_loc: module_keyword_loc, constant_path: constant_path, statements: statements, end_keyword_loc: end_keyword_loc, location: location }
3363
+ { locals: locals, module_keyword_loc: module_keyword_loc, constant_path: constant_path, body: body, end_keyword_loc: end_keyword_loc, location: location }
4232
3364
  end
4233
3365
 
4234
3366
  # def module_keyword: () -> String
@@ -4454,6 +3586,51 @@ module YARP
4454
3586
  end
4455
3587
  end
4456
3588
 
3589
+ # Represents the use of an operator on a write.
3590
+ #
3591
+ # target += value
3592
+ # ^^^^^^^^^^^^^^^
3593
+ class OperatorWriteNode < Node
3594
+ # attr_reader target: Node
3595
+ attr_reader :target
3596
+
3597
+ # attr_reader operator_loc: Location
3598
+ attr_reader :operator_loc
3599
+
3600
+ # attr_reader operator: Symbol
3601
+ attr_reader :operator
3602
+
3603
+ # attr_reader value: Node
3604
+ attr_reader :value
3605
+
3606
+ # def initialize: (target: Node, operator_loc: Location, operator: Symbol, value: Node, location: Location) -> void
3607
+ def initialize(target, operator_loc, operator, value, location)
3608
+ @target = target
3609
+ @operator_loc = operator_loc
3610
+ @operator = operator
3611
+ @value = value
3612
+ @location = location
3613
+ end
3614
+
3615
+ # def accept: (visitor: Visitor) -> void
3616
+ def accept(visitor)
3617
+ visitor.visit_operator_write_node(self)
3618
+ end
3619
+
3620
+ # def child_nodes: () -> Array[nil | Node]
3621
+ def child_nodes
3622
+ [target, value]
3623
+ end
3624
+
3625
+ # def deconstruct: () -> Array[nil | Node]
3626
+ alias deconstruct child_nodes
3627
+
3628
+ # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
3629
+ def deconstruct_keys(keys)
3630
+ { target: target, operator_loc: operator_loc, operator: operator, value: value, location: location }
3631
+ end
3632
+ end
3633
+
4457
3634
  # Represents an optional parameter to a method, block, or lambda definition.
4458
3635
  #
4459
3636
  # def a(b = 1)
@@ -4556,6 +3733,52 @@ module YARP
4556
3733
  end
4557
3734
  end
4558
3735
 
3736
+ # Represents the use of the `||=` operator.
3737
+ #
3738
+ # target ||= value
3739
+ # ^^^^^^^^^^^^^^^^
3740
+ class OrWriteNode < Node
3741
+ # attr_reader target: Node
3742
+ attr_reader :target
3743
+
3744
+ # attr_reader value: Node
3745
+ attr_reader :value
3746
+
3747
+ # attr_reader operator_loc: Location
3748
+ attr_reader :operator_loc
3749
+
3750
+ # def initialize: (target: Node, value: Node, operator_loc: Location, location: Location) -> void
3751
+ def initialize(target, value, operator_loc, location)
3752
+ @target = target
3753
+ @value = value
3754
+ @operator_loc = operator_loc
3755
+ @location = location
3756
+ end
3757
+
3758
+ # def accept: (visitor: Visitor) -> void
3759
+ def accept(visitor)
3760
+ visitor.visit_or_write_node(self)
3761
+ end
3762
+
3763
+ # def child_nodes: () -> Array[nil | Node]
3764
+ def child_nodes
3765
+ [target, value]
3766
+ end
3767
+
3768
+ # def deconstruct: () -> Array[nil | Node]
3769
+ alias deconstruct child_nodes
3770
+
3771
+ # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
3772
+ def deconstruct_keys(keys)
3773
+ { target: target, value: value, operator_loc: operator_loc, location: location }
3774
+ end
3775
+
3776
+ # def operator: () -> String
3777
+ def operator
3778
+ operator_loc.slice
3779
+ end
3780
+ end
3781
+
4559
3782
  # Represents the list of parameters on a method, block, or lambda definition.
4560
3783
  #
4561
3784
  # def a(b, c, d)
@@ -4619,8 +3842,8 @@ module YARP
4619
3842
  # (10 + 34)
4620
3843
  # ^^^^^^^^^
4621
3844
  class ParenthesesNode < Node
4622
- # attr_reader statements: Node?
4623
- attr_reader :statements
3845
+ # attr_reader body: Node?
3846
+ attr_reader :body
4624
3847
 
4625
3848
  # attr_reader opening_loc: Location
4626
3849
  attr_reader :opening_loc
@@ -4628,9 +3851,9 @@ module YARP
4628
3851
  # attr_reader closing_loc: Location
4629
3852
  attr_reader :closing_loc
4630
3853
 
4631
- # def initialize: (statements: Node?, opening_loc: Location, closing_loc: Location, location: Location) -> void
4632
- def initialize(statements, opening_loc, closing_loc, location)
4633
- @statements = statements
3854
+ # def initialize: (body: Node?, opening_loc: Location, closing_loc: Location, location: Location) -> void
3855
+ def initialize(body, opening_loc, closing_loc, location)
3856
+ @body = body
4634
3857
  @opening_loc = opening_loc
4635
3858
  @closing_loc = closing_loc
4636
3859
  @location = location
@@ -4647,7 +3870,7 @@ module YARP
4647
3870
 
4648
3871
  # def child_nodes: () -> Array[nil | Node]
4649
3872
  def child_nodes
4650
- [statements]
3873
+ [body]
4651
3874
  end
4652
3875
 
4653
3876
  # def deconstruct: () -> Array[nil | Node]
@@ -4655,7 +3878,7 @@ module YARP
4655
3878
 
4656
3879
  # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
4657
3880
  def deconstruct_keys(keys)
4658
- { statements: statements, opening_loc: opening_loc, closing_loc: closing_loc, location: location }
3881
+ { body: body, opening_loc: opening_loc, closing_loc: closing_loc, location: location }
4659
3882
  end
4660
3883
 
4661
3884
  # def opening: () -> String
@@ -5521,19 +4744,19 @@ module YARP
5521
4744
  # attr_reader expression: Node
5522
4745
  attr_reader :expression
5523
4746
 
5524
- # attr_reader statements: Node?
5525
- attr_reader :statements
4747
+ # attr_reader body: Node?
4748
+ attr_reader :body
5526
4749
 
5527
4750
  # attr_reader end_keyword_loc: Location
5528
4751
  attr_reader :end_keyword_loc
5529
4752
 
5530
- # def initialize: (locals: Array[Symbol], class_keyword_loc: Location, operator_loc: Location, expression: Node, statements: Node?, end_keyword_loc: Location, location: Location) -> void
5531
- def initialize(locals, class_keyword_loc, operator_loc, expression, statements, end_keyword_loc, location)
4753
+ # def initialize: (locals: Array[Symbol], class_keyword_loc: Location, operator_loc: Location, expression: Node, body: Node?, end_keyword_loc: Location, location: Location) -> void
4754
+ def initialize(locals, class_keyword_loc, operator_loc, expression, body, end_keyword_loc, location)
5532
4755
  @locals = locals
5533
4756
  @class_keyword_loc = class_keyword_loc
5534
4757
  @operator_loc = operator_loc
5535
4758
  @expression = expression
5536
- @statements = statements
4759
+ @body = body
5537
4760
  @end_keyword_loc = end_keyword_loc
5538
4761
  @location = location
5539
4762
  end
@@ -5545,7 +4768,7 @@ module YARP
5545
4768
 
5546
4769
  # def child_nodes: () -> Array[nil | Node]
5547
4770
  def child_nodes
5548
- [expression, statements]
4771
+ [expression, body]
5549
4772
  end
5550
4773
 
5551
4774
  # def deconstruct: () -> Array[nil | Node]
@@ -5553,7 +4776,7 @@ module YARP
5553
4776
 
5554
4777
  # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
5555
4778
  def deconstruct_keys(keys)
5556
- { locals: locals, class_keyword_loc: class_keyword_loc, operator_loc: operator_loc, expression: expression, statements: statements, end_keyword_loc: end_keyword_loc, location: location }
4779
+ { locals: locals, class_keyword_loc: class_keyword_loc, operator_loc: operator_loc, expression: expression, body: body, end_keyword_loc: end_keyword_loc, location: location }
5557
4780
  end
5558
4781
 
5559
4782
  # def class_keyword: () -> String
@@ -6171,10 +5394,12 @@ module YARP
6171
5394
  end
6172
5395
  end
6173
5396
 
6174
- # case true
6175
- # when true
6176
- # ^^^^^^^^^
6177
- # end
5397
+ # Represents the use of the `when` keyword within a case statement.
5398
+ #
5399
+ # case true
5400
+ # when true
5401
+ # ^^^^^^^^^
5402
+ # end
6178
5403
  class WhenNode < Node
6179
5404
  # attr_reader keyword_loc: Location
6180
5405
  attr_reader :keyword_loc
@@ -6453,6 +5678,9 @@ module YARP
6453
5678
  # Visit a AndNode node
6454
5679
  alias visit_and_node visit_child_nodes
6455
5680
 
5681
+ # Visit a AndWriteNode node
5682
+ alias visit_and_write_node visit_child_nodes
5683
+
6456
5684
  # Visit a ArgumentsNode node
6457
5685
  alias visit_arguments_node visit_child_nodes
6458
5686
 
@@ -6510,42 +5738,15 @@ module YARP
6510
5738
  # Visit a ClassNode node
6511
5739
  alias visit_class_node visit_child_nodes
6512
5740
 
6513
- # Visit a ClassVariableOperatorAndWriteNode node
6514
- alias visit_class_variable_operator_and_write_node visit_child_nodes
6515
-
6516
- # Visit a ClassVariableOperatorOrWriteNode node
6517
- alias visit_class_variable_operator_or_write_node visit_child_nodes
6518
-
6519
- # Visit a ClassVariableOperatorWriteNode node
6520
- alias visit_class_variable_operator_write_node visit_child_nodes
6521
-
6522
5741
  # Visit a ClassVariableReadNode node
6523
5742
  alias visit_class_variable_read_node visit_child_nodes
6524
5743
 
6525
5744
  # Visit a ClassVariableWriteNode node
6526
5745
  alias visit_class_variable_write_node visit_child_nodes
6527
5746
 
6528
- # Visit a ConstantOperatorAndWriteNode node
6529
- alias visit_constant_operator_and_write_node visit_child_nodes
6530
-
6531
- # Visit a ConstantOperatorOrWriteNode node
6532
- alias visit_constant_operator_or_write_node visit_child_nodes
6533
-
6534
- # Visit a ConstantOperatorWriteNode node
6535
- alias visit_constant_operator_write_node visit_child_nodes
6536
-
6537
5747
  # Visit a ConstantPathNode node
6538
5748
  alias visit_constant_path_node visit_child_nodes
6539
5749
 
6540
- # Visit a ConstantPathOperatorAndWriteNode node
6541
- alias visit_constant_path_operator_and_write_node visit_child_nodes
6542
-
6543
- # Visit a ConstantPathOperatorOrWriteNode node
6544
- alias visit_constant_path_operator_or_write_node visit_child_nodes
6545
-
6546
- # Visit a ConstantPathOperatorWriteNode node
6547
- alias visit_constant_path_operator_write_node visit_child_nodes
6548
-
6549
5750
  # Visit a ConstantPathWriteNode node
6550
5751
  alias visit_constant_path_write_node visit_child_nodes
6551
5752
 
@@ -6597,15 +5798,6 @@ module YARP
6597
5798
  # Visit a ForwardingSuperNode node
6598
5799
  alias visit_forwarding_super_node visit_child_nodes
6599
5800
 
6600
- # Visit a GlobalVariableOperatorAndWriteNode node
6601
- alias visit_global_variable_operator_and_write_node visit_child_nodes
6602
-
6603
- # Visit a GlobalVariableOperatorOrWriteNode node
6604
- alias visit_global_variable_operator_or_write_node visit_child_nodes
6605
-
6606
- # Visit a GlobalVariableOperatorWriteNode node
6607
- alias visit_global_variable_operator_write_node visit_child_nodes
6608
-
6609
5801
  # Visit a GlobalVariableReadNode node
6610
5802
  alias visit_global_variable_read_node visit_child_nodes
6611
5803
 
@@ -6627,15 +5819,6 @@ module YARP
6627
5819
  # Visit a InNode node
6628
5820
  alias visit_in_node visit_child_nodes
6629
5821
 
6630
- # Visit a InstanceVariableOperatorAndWriteNode node
6631
- alias visit_instance_variable_operator_and_write_node visit_child_nodes
6632
-
6633
- # Visit a InstanceVariableOperatorOrWriteNode node
6634
- alias visit_instance_variable_operator_or_write_node visit_child_nodes
6635
-
6636
- # Visit a InstanceVariableOperatorWriteNode node
6637
- alias visit_instance_variable_operator_write_node visit_child_nodes
6638
-
6639
5822
  # Visit a InstanceVariableReadNode node
6640
5823
  alias visit_instance_variable_read_node visit_child_nodes
6641
5824
 
@@ -6669,15 +5852,6 @@ module YARP
6669
5852
  # Visit a LambdaNode node
6670
5853
  alias visit_lambda_node visit_child_nodes
6671
5854
 
6672
- # Visit a LocalVariableOperatorAndWriteNode node
6673
- alias visit_local_variable_operator_and_write_node visit_child_nodes
6674
-
6675
- # Visit a LocalVariableOperatorOrWriteNode node
6676
- alias visit_local_variable_operator_or_write_node visit_child_nodes
6677
-
6678
- # Visit a LocalVariableOperatorWriteNode node
6679
- alias visit_local_variable_operator_write_node visit_child_nodes
6680
-
6681
5855
  # Visit a LocalVariableReadNode node
6682
5856
  alias visit_local_variable_read_node visit_child_nodes
6683
5857
 
@@ -6711,12 +5885,18 @@ module YARP
6711
5885
  # Visit a NumberedReferenceReadNode node
6712
5886
  alias visit_numbered_reference_read_node visit_child_nodes
6713
5887
 
5888
+ # Visit a OperatorWriteNode node
5889
+ alias visit_operator_write_node visit_child_nodes
5890
+
6714
5891
  # Visit a OptionalParameterNode node
6715
5892
  alias visit_optional_parameter_node visit_child_nodes
6716
5893
 
6717
5894
  # Visit a OrNode node
6718
5895
  alias visit_or_node visit_child_nodes
6719
5896
 
5897
+ # Visit a OrWriteNode node
5898
+ alias visit_or_write_node visit_child_nodes
5899
+
6720
5900
  # Visit a ParametersNode node
6721
5901
  alias visit_parameters_node visit_child_nodes
6722
5902
 
@@ -6852,6 +6032,11 @@ module YARP
6852
6032
  AndNode.new(left, right, operator_loc, location)
6853
6033
  end
6854
6034
 
6035
+ # Create a new AndWriteNode node
6036
+ def AndWriteNode(target, value, operator_loc, location = Location())
6037
+ AndWriteNode.new(target, value, operator_loc, location)
6038
+ end
6039
+
6855
6040
  # Create a new ArgumentsNode node
6856
6041
  def ArgumentsNode(arguments, location = Location())
6857
6042
  ArgumentsNode.new(arguments, location)
@@ -6893,8 +6078,8 @@ module YARP
6893
6078
  end
6894
6079
 
6895
6080
  # Create a new BlockNode node
6896
- def BlockNode(locals, parameters, statements, opening_loc, closing_loc, location = Location())
6897
- BlockNode.new(locals, parameters, statements, opening_loc, closing_loc, location)
6081
+ def BlockNode(locals, parameters, body, opening_loc, closing_loc, location = Location())
6082
+ BlockNode.new(locals, parameters, body, opening_loc, closing_loc, location)
6898
6083
  end
6899
6084
 
6900
6085
  # Create a new BlockParameterNode node
@@ -6943,23 +6128,8 @@ module YARP
6943
6128
  end
6944
6129
 
6945
6130
  # Create a new ClassNode node
6946
- def ClassNode(locals, class_keyword_loc, constant_path, inheritance_operator_loc, superclass, statements, end_keyword_loc, location = Location())
6947
- ClassNode.new(locals, class_keyword_loc, constant_path, inheritance_operator_loc, superclass, statements, end_keyword_loc, location)
6948
- end
6949
-
6950
- # Create a new ClassVariableOperatorAndWriteNode node
6951
- def ClassVariableOperatorAndWriteNode(name_loc, operator_loc, value, location = Location())
6952
- ClassVariableOperatorAndWriteNode.new(name_loc, operator_loc, value, location)
6953
- end
6954
-
6955
- # Create a new ClassVariableOperatorOrWriteNode node
6956
- def ClassVariableOperatorOrWriteNode(name_loc, operator_loc, value, location = Location())
6957
- ClassVariableOperatorOrWriteNode.new(name_loc, operator_loc, value, location)
6958
- end
6959
-
6960
- # Create a new ClassVariableOperatorWriteNode node
6961
- def ClassVariableOperatorWriteNode(name_loc, operator_loc, value, operator, location = Location())
6962
- ClassVariableOperatorWriteNode.new(name_loc, operator_loc, value, operator, location)
6131
+ def ClassNode(locals, class_keyword_loc, constant_path, inheritance_operator_loc, superclass, body, end_keyword_loc, location = Location())
6132
+ ClassNode.new(locals, class_keyword_loc, constant_path, inheritance_operator_loc, superclass, body, end_keyword_loc, location)
6963
6133
  end
6964
6134
 
6965
6135
  # Create a new ClassVariableReadNode node
@@ -6972,41 +6142,11 @@ module YARP
6972
6142
  ClassVariableWriteNode.new(name_loc, value, operator_loc, location)
6973
6143
  end
6974
6144
 
6975
- # Create a new ConstantOperatorAndWriteNode node
6976
- def ConstantOperatorAndWriteNode(name_loc, operator_loc, value, location = Location())
6977
- ConstantOperatorAndWriteNode.new(name_loc, operator_loc, value, location)
6978
- end
6979
-
6980
- # Create a new ConstantOperatorOrWriteNode node
6981
- def ConstantOperatorOrWriteNode(name_loc, operator_loc, value, location = Location())
6982
- ConstantOperatorOrWriteNode.new(name_loc, operator_loc, value, location)
6983
- end
6984
-
6985
- # Create a new ConstantOperatorWriteNode node
6986
- def ConstantOperatorWriteNode(name_loc, operator_loc, value, operator, location = Location())
6987
- ConstantOperatorWriteNode.new(name_loc, operator_loc, value, operator, location)
6988
- end
6989
-
6990
6145
  # Create a new ConstantPathNode node
6991
6146
  def ConstantPathNode(parent, child, delimiter_loc, location = Location())
6992
6147
  ConstantPathNode.new(parent, child, delimiter_loc, location)
6993
6148
  end
6994
6149
 
6995
- # Create a new ConstantPathOperatorAndWriteNode node
6996
- def ConstantPathOperatorAndWriteNode(target, operator_loc, value, location = Location())
6997
- ConstantPathOperatorAndWriteNode.new(target, operator_loc, value, location)
6998
- end
6999
-
7000
- # Create a new ConstantPathOperatorOrWriteNode node
7001
- def ConstantPathOperatorOrWriteNode(target, operator_loc, value, location = Location())
7002
- ConstantPathOperatorOrWriteNode.new(target, operator_loc, value, location)
7003
- end
7004
-
7005
- # Create a new ConstantPathOperatorWriteNode node
7006
- def ConstantPathOperatorWriteNode(target, operator_loc, value, operator, location = Location())
7007
- ConstantPathOperatorWriteNode.new(target, operator_loc, value, operator, location)
7008
- end
7009
-
7010
6150
  # Create a new ConstantPathWriteNode node
7011
6151
  def ConstantPathWriteNode(target, operator_loc, value, location = Location())
7012
6152
  ConstantPathWriteNode.new(target, operator_loc, value, location)
@@ -7023,8 +6163,8 @@ module YARP
7023
6163
  end
7024
6164
 
7025
6165
  # Create a new DefNode node
7026
- def DefNode(name_loc, receiver, parameters, statements, locals, def_keyword_loc, operator_loc, lparen_loc, rparen_loc, equal_loc, end_keyword_loc, location = Location())
7027
- DefNode.new(name_loc, receiver, parameters, statements, locals, def_keyword_loc, operator_loc, lparen_loc, rparen_loc, equal_loc, end_keyword_loc, location)
6166
+ def DefNode(name_loc, receiver, parameters, body, locals, def_keyword_loc, operator_loc, lparen_loc, rparen_loc, equal_loc, end_keyword_loc, location = Location())
6167
+ DefNode.new(name_loc, receiver, parameters, body, locals, def_keyword_loc, operator_loc, lparen_loc, rparen_loc, equal_loc, end_keyword_loc, location)
7028
6168
  end
7029
6169
 
7030
6170
  # Create a new DefinedNode node
@@ -7092,21 +6232,6 @@ module YARP
7092
6232
  ForwardingSuperNode.new(block, location)
7093
6233
  end
7094
6234
 
7095
- # Create a new GlobalVariableOperatorAndWriteNode node
7096
- def GlobalVariableOperatorAndWriteNode(name_loc, operator_loc, value, location = Location())
7097
- GlobalVariableOperatorAndWriteNode.new(name_loc, operator_loc, value, location)
7098
- end
7099
-
7100
- # Create a new GlobalVariableOperatorOrWriteNode node
7101
- def GlobalVariableOperatorOrWriteNode(name_loc, operator_loc, value, location = Location())
7102
- GlobalVariableOperatorOrWriteNode.new(name_loc, operator_loc, value, location)
7103
- end
7104
-
7105
- # Create a new GlobalVariableOperatorWriteNode node
7106
- def GlobalVariableOperatorWriteNode(name_loc, operator_loc, value, operator, location = Location())
7107
- GlobalVariableOperatorWriteNode.new(name_loc, operator_loc, value, operator, location)
7108
- end
7109
-
7110
6235
  # Create a new GlobalVariableReadNode node
7111
6236
  def GlobalVariableReadNode(location = Location())
7112
6237
  GlobalVariableReadNode.new(location)
@@ -7142,21 +6267,6 @@ module YARP
7142
6267
  InNode.new(pattern, statements, in_loc, then_loc, location)
7143
6268
  end
7144
6269
 
7145
- # Create a new InstanceVariableOperatorAndWriteNode node
7146
- def InstanceVariableOperatorAndWriteNode(name_loc, operator_loc, value, location = Location())
7147
- InstanceVariableOperatorAndWriteNode.new(name_loc, operator_loc, value, location)
7148
- end
7149
-
7150
- # Create a new InstanceVariableOperatorOrWriteNode node
7151
- def InstanceVariableOperatorOrWriteNode(name_loc, operator_loc, value, location = Location())
7152
- InstanceVariableOperatorOrWriteNode.new(name_loc, operator_loc, value, location)
7153
- end
7154
-
7155
- # Create a new InstanceVariableOperatorWriteNode node
7156
- def InstanceVariableOperatorWriteNode(name_loc, operator_loc, value, operator, location = Location())
7157
- InstanceVariableOperatorWriteNode.new(name_loc, operator_loc, value, operator, location)
7158
- end
7159
-
7160
6270
  # Create a new InstanceVariableReadNode node
7161
6271
  def InstanceVariableReadNode(location = Location())
7162
6272
  InstanceVariableReadNode.new(location)
@@ -7208,23 +6318,8 @@ module YARP
7208
6318
  end
7209
6319
 
7210
6320
  # Create a new LambdaNode node
7211
- def LambdaNode(locals, opening_loc, parameters, statements, location = Location())
7212
- LambdaNode.new(locals, opening_loc, parameters, statements, location)
7213
- end
7214
-
7215
- # Create a new LocalVariableOperatorAndWriteNode node
7216
- def LocalVariableOperatorAndWriteNode(name_loc, operator_loc, value, constant_id, location = Location())
7217
- LocalVariableOperatorAndWriteNode.new(name_loc, operator_loc, value, constant_id, location)
7218
- end
7219
-
7220
- # Create a new LocalVariableOperatorOrWriteNode node
7221
- def LocalVariableOperatorOrWriteNode(name_loc, operator_loc, value, constant_id, location = Location())
7222
- LocalVariableOperatorOrWriteNode.new(name_loc, operator_loc, value, constant_id, location)
7223
- end
7224
-
7225
- # Create a new LocalVariableOperatorWriteNode node
7226
- def LocalVariableOperatorWriteNode(name_loc, operator_loc, value, constant_id, operator_id, location = Location())
7227
- LocalVariableOperatorWriteNode.new(name_loc, operator_loc, value, constant_id, operator_id, location)
6321
+ def LambdaNode(locals, opening_loc, parameters, body, location = Location())
6322
+ LambdaNode.new(locals, opening_loc, parameters, body, location)
7228
6323
  end
7229
6324
 
7230
6325
  # Create a new LocalVariableReadNode node
@@ -7253,8 +6348,8 @@ module YARP
7253
6348
  end
7254
6349
 
7255
6350
  # Create a new ModuleNode node
7256
- def ModuleNode(locals, module_keyword_loc, constant_path, statements, end_keyword_loc, location = Location())
7257
- ModuleNode.new(locals, module_keyword_loc, constant_path, statements, end_keyword_loc, location)
6351
+ def ModuleNode(locals, module_keyword_loc, constant_path, body, end_keyword_loc, location = Location())
6352
+ ModuleNode.new(locals, module_keyword_loc, constant_path, body, end_keyword_loc, location)
7258
6353
  end
7259
6354
 
7260
6355
  # Create a new MultiWriteNode node
@@ -7282,6 +6377,11 @@ module YARP
7282
6377
  NumberedReferenceReadNode.new(location)
7283
6378
  end
7284
6379
 
6380
+ # Create a new OperatorWriteNode node
6381
+ def OperatorWriteNode(target, operator_loc, operator, value, location = Location())
6382
+ OperatorWriteNode.new(target, operator_loc, operator, value, location)
6383
+ end
6384
+
7285
6385
  # Create a new OptionalParameterNode node
7286
6386
  def OptionalParameterNode(constant_id, name_loc, operator_loc, value, location = Location())
7287
6387
  OptionalParameterNode.new(constant_id, name_loc, operator_loc, value, location)
@@ -7292,14 +6392,19 @@ module YARP
7292
6392
  OrNode.new(left, right, operator_loc, location)
7293
6393
  end
7294
6394
 
6395
+ # Create a new OrWriteNode node
6396
+ def OrWriteNode(target, value, operator_loc, location = Location())
6397
+ OrWriteNode.new(target, value, operator_loc, location)
6398
+ end
6399
+
7295
6400
  # Create a new ParametersNode node
7296
6401
  def ParametersNode(requireds, optionals, posts, rest, keywords, keyword_rest, block, location = Location())
7297
6402
  ParametersNode.new(requireds, optionals, posts, rest, keywords, keyword_rest, block, location)
7298
6403
  end
7299
6404
 
7300
6405
  # Create a new ParenthesesNode node
7301
- def ParenthesesNode(statements, opening_loc, closing_loc, location = Location())
7302
- ParenthesesNode.new(statements, opening_loc, closing_loc, location)
6406
+ def ParenthesesNode(body, opening_loc, closing_loc, location = Location())
6407
+ ParenthesesNode.new(body, opening_loc, closing_loc, location)
7303
6408
  end
7304
6409
 
7305
6410
  # Create a new PinnedExpressionNode node
@@ -7388,8 +6493,8 @@ module YARP
7388
6493
  end
7389
6494
 
7390
6495
  # Create a new SingletonClassNode node
7391
- def SingletonClassNode(locals, class_keyword_loc, operator_loc, expression, statements, end_keyword_loc, location = Location())
7392
- SingletonClassNode.new(locals, class_keyword_loc, operator_loc, expression, statements, end_keyword_loc, location)
6496
+ def SingletonClassNode(locals, class_keyword_loc, operator_loc, expression, body, end_keyword_loc, location = Location())
6497
+ SingletonClassNode.new(locals, class_keyword_loc, operator_loc, expression, body, end_keyword_loc, location)
7393
6498
  end
7394
6499
 
7395
6500
  # Create a new SourceEncodingNode node