prism 0.15.1 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +35 -1
  3. data/Makefile +12 -0
  4. data/README.md +3 -1
  5. data/config.yml +66 -50
  6. data/docs/configuration.md +2 -0
  7. data/docs/fuzzing.md +1 -1
  8. data/docs/javascript.md +90 -0
  9. data/docs/releasing.md +27 -0
  10. data/docs/ruby_api.md +2 -0
  11. data/docs/serialization.md +28 -29
  12. data/ext/prism/api_node.c +856 -826
  13. data/ext/prism/api_pack.c +20 -9
  14. data/ext/prism/extension.c +494 -119
  15. data/ext/prism/extension.h +1 -1
  16. data/include/prism/ast.h +3157 -747
  17. data/include/prism/defines.h +40 -8
  18. data/include/prism/diagnostic.h +36 -3
  19. data/include/prism/enc/pm_encoding.h +119 -28
  20. data/include/prism/node.h +38 -30
  21. data/include/prism/options.h +204 -0
  22. data/include/prism/pack.h +44 -33
  23. data/include/prism/parser.h +445 -199
  24. data/include/prism/prettyprint.h +26 -0
  25. data/include/prism/regexp.h +16 -2
  26. data/include/prism/util/pm_buffer.h +102 -18
  27. data/include/prism/util/pm_char.h +162 -48
  28. data/include/prism/util/pm_constant_pool.h +128 -34
  29. data/include/prism/util/pm_list.h +68 -38
  30. data/include/prism/util/pm_memchr.h +18 -3
  31. data/include/prism/util/pm_newline_list.h +71 -28
  32. data/include/prism/util/pm_state_stack.h +25 -7
  33. data/include/prism/util/pm_string.h +115 -27
  34. data/include/prism/util/pm_string_list.h +25 -6
  35. data/include/prism/util/pm_strncasecmp.h +32 -0
  36. data/include/prism/util/pm_strpbrk.h +31 -17
  37. data/include/prism/version.h +28 -3
  38. data/include/prism.h +229 -36
  39. data/lib/prism/compiler.rb +5 -5
  40. data/lib/prism/debug.rb +43 -13
  41. data/lib/prism/desugar_compiler.rb +1 -1
  42. data/lib/prism/dispatcher.rb +27 -26
  43. data/lib/prism/dsl.rb +16 -16
  44. data/lib/prism/ffi.rb +138 -61
  45. data/lib/prism/lex_compat.rb +26 -16
  46. data/lib/prism/mutation_compiler.rb +11 -11
  47. data/lib/prism/node.rb +426 -227
  48. data/lib/prism/node_ext.rb +23 -16
  49. data/lib/prism/node_inspector.rb +1 -1
  50. data/lib/prism/pack.rb +79 -40
  51. data/lib/prism/parse_result/comments.rb +7 -2
  52. data/lib/prism/parse_result/newlines.rb +4 -0
  53. data/lib/prism/parse_result.rb +157 -21
  54. data/lib/prism/pattern.rb +14 -3
  55. data/lib/prism/ripper_compat.rb +28 -10
  56. data/lib/prism/serialize.rb +935 -307
  57. data/lib/prism/visitor.rb +9 -5
  58. data/lib/prism.rb +20 -2
  59. data/prism.gemspec +11 -2
  60. data/rbi/prism.rbi +7305 -0
  61. data/rbi/prism_static.rbi +196 -0
  62. data/sig/prism.rbs +4468 -0
  63. data/sig/prism_static.rbs +123 -0
  64. data/src/diagnostic.c +56 -53
  65. data/src/enc/pm_big5.c +1 -0
  66. data/src/enc/pm_euc_jp.c +1 -0
  67. data/src/enc/pm_gbk.c +1 -0
  68. data/src/enc/pm_shift_jis.c +1 -0
  69. data/src/enc/pm_tables.c +316 -80
  70. data/src/enc/pm_unicode.c +54 -9
  71. data/src/enc/pm_windows_31j.c +1 -0
  72. data/src/node.c +357 -345
  73. data/src/options.c +170 -0
  74. data/src/prettyprint.c +7697 -1643
  75. data/src/prism.c +1964 -1125
  76. data/src/regexp.c +153 -95
  77. data/src/serialize.c +432 -397
  78. data/src/token_type.c +3 -1
  79. data/src/util/pm_buffer.c +88 -23
  80. data/src/util/pm_char.c +103 -57
  81. data/src/util/pm_constant_pool.c +52 -22
  82. data/src/util/pm_list.c +12 -4
  83. data/src/util/pm_memchr.c +5 -3
  84. data/src/util/pm_newline_list.c +25 -63
  85. data/src/util/pm_state_stack.c +9 -3
  86. data/src/util/pm_string.c +95 -85
  87. data/src/util/pm_string_list.c +14 -15
  88. data/src/util/pm_strncasecmp.c +10 -3
  89. data/src/util/pm_strpbrk.c +25 -19
  90. metadata +12 -3
  91. data/docs/prism.png +0 -0
data/lib/prism/node.rb CHANGED
@@ -9,13 +9,15 @@ module Prism
9
9
  # This represents a node in the tree. It is the parent class of all of the
10
10
  # various node types.
11
11
  class Node
12
+ # A Location instance that represents the location of this node in the
13
+ # source.
12
14
  attr_reader :location
13
15
 
14
- def newline?
16
+ def newline? # :nodoc:
15
17
  @newline ? true : false
16
18
  end
17
19
 
18
- def set_newline_flag(newline_marked)
20
+ def set_newline_flag(newline_marked) # :nodoc:
19
21
  line = location.start_line
20
22
  unless newline_marked[line]
21
23
  newline_marked[line] = true
@@ -103,6 +105,7 @@ module Prism
103
105
  keyword_loc.slice
104
106
  end
105
107
 
108
+ # def inspect(inspector: NodeInspector) -> String
106
109
  def inspect(inspector = NodeInspector.new)
107
110
  inspector << inspector.header(self)
108
111
  inspector << "├── new_name:\n"
@@ -207,6 +210,7 @@ module Prism
207
210
  keyword_loc.slice
208
211
  end
209
212
 
213
+ # def inspect(inspector: NodeInspector) -> String
210
214
  def inspect(inspector = NodeInspector.new)
211
215
  inspector << inspector.header(self)
212
216
  inspector << "├── new_name:\n"
@@ -311,6 +315,7 @@ module Prism
311
315
  operator_loc.slice
312
316
  end
313
317
 
318
+ # def inspect(inspector: NodeInspector) -> String
314
319
  def inspect(inspector = NodeInspector.new)
315
320
  inspector << inspector.header(self)
316
321
  inspector << "├── left:\n"
@@ -415,6 +420,7 @@ module Prism
415
420
  operator_loc.slice
416
421
  end
417
422
 
423
+ # def inspect(inspector: NodeInspector) -> String
418
424
  def inspect(inspector = NodeInspector.new)
419
425
  inspector << inspector.header(self)
420
426
  inspector << "├── left:\n"
@@ -462,9 +468,13 @@ module Prism
462
468
  # attr_reader arguments: Array[Node]
463
469
  attr_reader :arguments
464
470
 
465
- # def initialize: (arguments: Array[Node], location: Location) -> void
466
- def initialize(arguments, location)
471
+ # attr_reader flags: Integer
472
+ private attr_reader :flags
473
+
474
+ # def initialize: (arguments: Array[Node], flags: Integer, location: Location) -> void
475
+ def initialize(arguments, flags, location)
467
476
  @arguments = arguments
477
+ @flags = flags
468
478
  @location = location
469
479
  end
470
480
 
@@ -492,6 +502,7 @@ module Prism
492
502
  def copy(**params)
493
503
  ArgumentsNode.new(
494
504
  params.fetch(:arguments) { arguments },
505
+ params.fetch(:flags) { flags },
495
506
  params.fetch(:location) { location },
496
507
  )
497
508
  end
@@ -501,12 +512,20 @@ module Prism
501
512
 
502
513
  # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
503
514
  def deconstruct_keys(keys)
504
- { arguments: arguments, location: location }
515
+ { arguments: arguments, flags: flags, location: location }
505
516
  end
506
517
 
518
+ # def keyword_splat?: () -> bool
519
+ def keyword_splat?
520
+ flags.anybits?(ArgumentsNodeFlags::KEYWORD_SPLAT)
521
+ end
522
+
523
+ # def inspect(inspector: NodeInspector) -> String
507
524
  def inspect(inspector = NodeInspector.new)
508
525
  inspector << inspector.header(self)
509
- inspector << "└── arguments: #{inspector.list("#{inspector.prefix} ", arguments)}"
526
+ inspector << "├── arguments: #{inspector.list("#{inspector.prefix}", arguments)}"
527
+ flags = [("keyword_splat" if keyword_splat?)].compact
528
+ inspector << "└── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n"
510
529
  inspector.to_str
511
530
  end
512
531
 
@@ -610,6 +629,7 @@ module Prism
610
629
  closing_loc&.slice
611
630
  end
612
631
 
632
+ # def inspect(inspector: NodeInspector) -> String
613
633
  def inspect(inspector = NodeInspector.new)
614
634
  inspector << inspector.header(self)
615
635
  inspector << "├── elements: #{inspector.list("#{inspector.prefix}│ ", elements)}"
@@ -749,6 +769,7 @@ module Prism
749
769
  closing_loc&.slice
750
770
  end
751
771
 
772
+ # def inspect(inspector: NodeInspector) -> String
752
773
  def inspect(inspector = NodeInspector.new)
753
774
  inspector << inspector.header(self)
754
775
  if (constant = self.constant).nil?
@@ -867,6 +888,7 @@ module Prism
867
888
  operator_loc&.slice
868
889
  end
869
890
 
891
+ # def inspect(inspector: NodeInspector) -> String
870
892
  def inspect(inspector = NodeInspector.new)
871
893
  inspector << inspector.header(self)
872
894
  inspector << "├── key:\n"
@@ -972,6 +994,7 @@ module Prism
972
994
  operator_loc.slice
973
995
  end
974
996
 
997
+ # def inspect(inspector: NodeInspector) -> String
975
998
  def inspect(inspector = NodeInspector.new)
976
999
  inspector << inspector.header(self)
977
1000
  if (value = self.value).nil?
@@ -1063,6 +1086,7 @@ module Prism
1063
1086
  { name: name, location: location }
1064
1087
  end
1065
1088
 
1089
+ # def inspect(inspector: NodeInspector) -> String
1066
1090
  def inspect(inspector = NodeInspector.new)
1067
1091
  inspector << inspector.header(self)
1068
1092
  inspector << "└── name: #{name.inspect}\n"
@@ -1139,7 +1163,7 @@ module Prism
1139
1163
  visitor.visit_begin_node(self)
1140
1164
  end
1141
1165
 
1142
- def set_newline_flag(newline_marked)
1166
+ def set_newline_flag(newline_marked) # :nodoc:
1143
1167
  # Never mark BeginNode with a newline flag, mark children instead
1144
1168
  end
1145
1169
 
@@ -1194,6 +1218,7 @@ module Prism
1194
1218
  end_keyword_loc&.slice
1195
1219
  end
1196
1220
 
1221
+ # def inspect(inspector: NodeInspector) -> String
1197
1222
  def inspect(inspector = NodeInspector.new)
1198
1223
  inspector << inspector.header(self)
1199
1224
  inspector << "├── begin_keyword_loc: #{inspector.location(begin_keyword_loc)}\n"
@@ -1316,6 +1341,7 @@ module Prism
1316
1341
  operator_loc.slice
1317
1342
  end
1318
1343
 
1344
+ # def inspect(inspector: NodeInspector) -> String
1319
1345
  def inspect(inspector = NodeInspector.new)
1320
1346
  inspector << inspector.header(self)
1321
1347
  if (expression = self.expression).nil?
@@ -1407,6 +1433,7 @@ module Prism
1407
1433
  { name: name, location: location }
1408
1434
  end
1409
1435
 
1436
+ # def inspect(inspector: NodeInspector) -> String
1410
1437
  def inspect(inspector = NodeInspector.new)
1411
1438
  inspector << inspector.header(self)
1412
1439
  inspector << "└── name: #{name.inspect}\n"
@@ -1525,6 +1552,7 @@ module Prism
1525
1552
  closing_loc.slice
1526
1553
  end
1527
1554
 
1555
+ # def inspect(inspector: NodeInspector) -> String
1528
1556
  def inspect(inspector = NodeInspector.new)
1529
1557
  inspector << inspector.header(self)
1530
1558
  inspector << "├── locals: #{locals.inspect}\n"
@@ -1640,9 +1668,14 @@ module Prism
1640
1668
  operator_loc.slice
1641
1669
  end
1642
1670
 
1671
+ # def inspect(inspector: NodeInspector) -> String
1643
1672
  def inspect(inspector = NodeInspector.new)
1644
1673
  inspector << inspector.header(self)
1645
- inspector << "├── name: #{name.inspect}\n"
1674
+ if (name = self.name).nil?
1675
+ inspector << "├── name: ∅\n"
1676
+ else
1677
+ inspector << "├── name: #{name.inspect}\n"
1678
+ end
1646
1679
  inspector << "├── name_loc: #{inspector.location(name_loc)}\n"
1647
1680
  inspector << "└── operator_loc: #{inspector.location(operator_loc)}\n"
1648
1681
  inspector.to_str
@@ -1759,6 +1792,7 @@ module Prism
1759
1792
  closing_loc&.slice
1760
1793
  end
1761
1794
 
1795
+ # def inspect(inspector: NodeInspector) -> String
1762
1796
  def inspect(inspector = NodeInspector.new)
1763
1797
  inspector << inspector.header(self)
1764
1798
  if (parameters = self.parameters).nil?
@@ -1864,6 +1898,7 @@ module Prism
1864
1898
  keyword_loc.slice
1865
1899
  end
1866
1900
 
1901
+ # def inspect(inspector: NodeInspector) -> String
1867
1902
  def inspect(inspector = NodeInspector.new)
1868
1903
  inspector << inspector.header(self)
1869
1904
  if (arguments = self.arguments).nil?
@@ -2018,6 +2053,7 @@ module Prism
2018
2053
  operator_loc.slice
2019
2054
  end
2020
2055
 
2056
+ # def inspect(inspector: NodeInspector) -> String
2021
2057
  def inspect(inspector = NodeInspector.new)
2022
2058
  inspector << inspector.header(self)
2023
2059
  if (receiver = self.receiver).nil?
@@ -2206,6 +2242,7 @@ module Prism
2206
2242
  flags.anybits?(CallNodeFlags::VARIABLE_CALL)
2207
2243
  end
2208
2244
 
2245
+ # def inspect(inspector: NodeInspector) -> String
2209
2246
  def inspect(inspector = NodeInspector.new)
2210
2247
  inspector << inspector.header(self)
2211
2248
  if (receiver = self.receiver).nil?
@@ -2378,6 +2415,7 @@ module Prism
2378
2415
  flags.anybits?(CallNodeFlags::VARIABLE_CALL)
2379
2416
  end
2380
2417
 
2418
+ # def inspect(inspector: NodeInspector) -> String
2381
2419
  def inspect(inspector = NodeInspector.new)
2382
2420
  inspector << inspector.header(self)
2383
2421
  if (receiver = self.receiver).nil?
@@ -2541,6 +2579,7 @@ module Prism
2541
2579
  operator_loc.slice
2542
2580
  end
2543
2581
 
2582
+ # def inspect(inspector: NodeInspector) -> String
2544
2583
  def inspect(inspector = NodeInspector.new)
2545
2584
  inspector << inspector.header(self)
2546
2585
  if (receiver = self.receiver).nil?
@@ -2655,6 +2694,7 @@ module Prism
2655
2694
  operator_loc.slice
2656
2695
  end
2657
2696
 
2697
+ # def inspect(inspector: NodeInspector) -> String
2658
2698
  def inspect(inspector = NodeInspector.new)
2659
2699
  inspector << inspector.header(self)
2660
2700
  inspector << "├── value:\n"
@@ -2696,10 +2736,10 @@ module Prism
2696
2736
 
2697
2737
  # Represents the use of a case statement.
2698
2738
  #
2699
- # case true
2700
- # ^^^^^^^^^
2701
- # when false
2702
- # end
2739
+ # case true
2740
+ # when false
2741
+ # end
2742
+ # ^^^^^^^^^^
2703
2743
  class CaseNode < Node
2704
2744
  # attr_reader predicate: Node?
2705
2745
  attr_reader :predicate
@@ -2780,6 +2820,7 @@ module Prism
2780
2820
  end_keyword_loc.slice
2781
2821
  end
2782
2822
 
2823
+ # def inspect(inspector: NodeInspector) -> String
2783
2824
  def inspect(inspector = NodeInspector.new)
2784
2825
  inspector << inspector.header(self)
2785
2826
  if (predicate = self.predicate).nil?
@@ -2933,6 +2974,7 @@ module Prism
2933
2974
  end_keyword_loc.slice
2934
2975
  end
2935
2976
 
2977
+ # def inspect(inspector: NodeInspector) -> String
2936
2978
  def inspect(inspector = NodeInspector.new)
2937
2979
  inspector << inspector.header(self)
2938
2980
  inspector << "├── locals: #{locals.inspect}\n"
@@ -2989,7 +3031,7 @@ module Prism
2989
3031
  # Represents the use of the `&&=` operator for assignment to a class variable.
2990
3032
  #
2991
3033
  # @@target &&= value
2992
- # ^^^^^^^^^^^^^^^^
3034
+ # ^^^^^^^^^^^^^^^^^^
2993
3035
  class ClassVariableAndWriteNode < Node
2994
3036
  # attr_reader name: Symbol
2995
3037
  attr_reader :name
@@ -3056,6 +3098,7 @@ module Prism
3056
3098
  operator_loc.slice
3057
3099
  end
3058
3100
 
3101
+ # def inspect(inspector: NodeInspector) -> String
3059
3102
  def inspect(inspector = NodeInspector.new)
3060
3103
  inspector << inspector.header(self)
3061
3104
  inspector << "├── name: #{name.inspect}\n"
@@ -3165,6 +3208,7 @@ module Prism
3165
3208
  { name: name, name_loc: name_loc, operator_loc: operator_loc, value: value, operator: operator, location: location }
3166
3209
  end
3167
3210
 
3211
+ # def inspect(inspector: NodeInspector) -> String
3168
3212
  def inspect(inspector = NodeInspector.new)
3169
3213
  inspector << inspector.header(self)
3170
3214
  inspector << "├── name: #{name.inspect}\n"
@@ -3275,6 +3319,7 @@ module Prism
3275
3319
  operator_loc.slice
3276
3320
  end
3277
3321
 
3322
+ # def inspect(inspector: NodeInspector) -> String
3278
3323
  def inspect(inspector = NodeInspector.new)
3279
3324
  inspector << inspector.header(self)
3280
3325
  inspector << "├── name: #{name.inspect}\n"
@@ -3364,6 +3409,7 @@ module Prism
3364
3409
  { name: name, location: location }
3365
3410
  end
3366
3411
 
3412
+ # def inspect(inspector: NodeInspector) -> String
3367
3413
  def inspect(inspector = NodeInspector.new)
3368
3414
  inspector << inspector.header(self)
3369
3415
  inspector << "└── name: #{name.inspect}\n"
@@ -3449,6 +3495,7 @@ module Prism
3449
3495
  { name: name, location: location }
3450
3496
  end
3451
3497
 
3498
+ # def inspect(inspector: NodeInspector) -> String
3452
3499
  def inspect(inspector = NodeInspector.new)
3453
3500
  inspector << inspector.header(self)
3454
3501
  inspector << "└── name: #{name.inspect}\n"
@@ -3554,6 +3601,7 @@ module Prism
3554
3601
  operator_loc&.slice
3555
3602
  end
3556
3603
 
3604
+ # def inspect(inspector: NodeInspector) -> String
3557
3605
  def inspect(inspector = NodeInspector.new)
3558
3606
  inspector << inspector.header(self)
3559
3607
  inspector << "├── name: #{name.inspect}\n"
@@ -3663,6 +3711,7 @@ module Prism
3663
3711
  operator_loc.slice
3664
3712
  end
3665
3713
 
3714
+ # def inspect(inspector: NodeInspector) -> String
3666
3715
  def inspect(inspector = NodeInspector.new)
3667
3716
  inspector << inspector.header(self)
3668
3717
  inspector << "├── name: #{name.inspect}\n"
@@ -3772,6 +3821,7 @@ module Prism
3772
3821
  { name: name, name_loc: name_loc, operator_loc: operator_loc, value: value, operator: operator, location: location }
3773
3822
  end
3774
3823
 
3824
+ # def inspect(inspector: NodeInspector) -> String
3775
3825
  def inspect(inspector = NodeInspector.new)
3776
3826
  inspector << inspector.header(self)
3777
3827
  inspector << "├── name: #{name.inspect}\n"
@@ -3882,6 +3932,7 @@ module Prism
3882
3932
  operator_loc.slice
3883
3933
  end
3884
3934
 
3935
+ # def inspect(inspector: NodeInspector) -> String
3885
3936
  def inspect(inspector = NodeInspector.new)
3886
3937
  inspector << inspector.header(self)
3887
3938
  inspector << "├── name: #{name.inspect}\n"
@@ -3986,6 +4037,7 @@ module Prism
3986
4037
  operator_loc.slice
3987
4038
  end
3988
4039
 
4040
+ # def inspect(inspector: NodeInspector) -> String
3989
4041
  def inspect(inspector = NodeInspector.new)
3990
4042
  inspector << inspector.header(self)
3991
4043
  inspector << "├── target:\n"
@@ -4093,6 +4145,7 @@ module Prism
4093
4145
  delimiter_loc.slice
4094
4146
  end
4095
4147
 
4148
+ # def inspect(inspector: NodeInspector) -> String
4096
4149
  def inspect(inspector = NodeInspector.new)
4097
4150
  inspector << inspector.header(self)
4098
4151
  if (parent = self.parent).nil?
@@ -4201,6 +4254,7 @@ module Prism
4201
4254
  { target: target, operator_loc: operator_loc, value: value, operator: operator, location: location }
4202
4255
  end
4203
4256
 
4257
+ # def inspect(inspector: NodeInspector) -> String
4204
4258
  def inspect(inspector = NodeInspector.new)
4205
4259
  inspector << inspector.header(self)
4206
4260
  inspector << "├── target:\n"
@@ -4306,6 +4360,7 @@ module Prism
4306
4360
  operator_loc.slice
4307
4361
  end
4308
4362
 
4363
+ # def inspect(inspector: NodeInspector) -> String
4309
4364
  def inspect(inspector = NodeInspector.new)
4310
4365
  inspector << inspector.header(self)
4311
4366
  inspector << "├── target:\n"
@@ -4413,6 +4468,7 @@ module Prism
4413
4468
  delimiter_loc.slice
4414
4469
  end
4415
4470
 
4471
+ # def inspect(inspector: NodeInspector) -> String
4416
4472
  def inspect(inspector = NodeInspector.new)
4417
4473
  inspector << inspector.header(self)
4418
4474
  if (parent = self.parent).nil?
@@ -4527,6 +4583,7 @@ module Prism
4527
4583
  operator_loc.slice
4528
4584
  end
4529
4585
 
4586
+ # def inspect(inspector: NodeInspector) -> String
4530
4587
  def inspect(inspector = NodeInspector.new)
4531
4588
  inspector << inspector.header(self)
4532
4589
  inspector << "├── target:\n"
@@ -4616,6 +4673,7 @@ module Prism
4616
4673
  { name: name, location: location }
4617
4674
  end
4618
4675
 
4676
+ # def inspect(inspector: NodeInspector) -> String
4619
4677
  def inspect(inspector = NodeInspector.new)
4620
4678
  inspector << inspector.header(self)
4621
4679
  inspector << "└── name: #{name.inspect}\n"
@@ -4701,6 +4759,7 @@ module Prism
4701
4759
  { name: name, location: location }
4702
4760
  end
4703
4761
 
4762
+ # def inspect(inspector: NodeInspector) -> String
4704
4763
  def inspect(inspector = NodeInspector.new)
4705
4764
  inspector << inspector.header(self)
4706
4765
  inspector << "└── name: #{name.inspect}\n"
@@ -4806,6 +4865,7 @@ module Prism
4806
4865
  operator_loc.slice
4807
4866
  end
4808
4867
 
4868
+ # def inspect(inspector: NodeInspector) -> String
4809
4869
  def inspect(inspector = NodeInspector.new)
4810
4870
  inspector << inspector.header(self)
4811
4871
  inspector << "├── name: #{name.inspect}\n"
@@ -4985,6 +5045,7 @@ module Prism
4985
5045
  end_keyword_loc&.slice
4986
5046
  end
4987
5047
 
5048
+ # def inspect(inspector: NodeInspector) -> String
4988
5049
  def inspect(inspector = NodeInspector.new)
4989
5050
  inspector << inspector.header(self)
4990
5051
  inspector << "├── name: #{name.inspect}\n"
@@ -5126,6 +5187,7 @@ module Prism
5126
5187
  keyword_loc.slice
5127
5188
  end
5128
5189
 
5190
+ # def inspect(inspector: NodeInspector) -> String
5129
5191
  def inspect(inspector = NodeInspector.new)
5130
5192
  inspector << inspector.header(self)
5131
5193
  inspector << "├── lparen_loc: #{inspector.location(lparen_loc)}\n"
@@ -5237,6 +5299,7 @@ module Prism
5237
5299
  end_keyword_loc&.slice
5238
5300
  end
5239
5301
 
5302
+ # def inspect(inspector: NodeInspector) -> String
5240
5303
  def inspect(inspector = NodeInspector.new)
5241
5304
  inspector << inspector.header(self)
5242
5305
  inspector << "├── else_keyword_loc: #{inspector.location(else_keyword_loc)}\n"
@@ -5351,6 +5414,7 @@ module Prism
5351
5414
  closing_loc.slice
5352
5415
  end
5353
5416
 
5417
+ # def inspect(inspector: NodeInspector) -> String
5354
5418
  def inspect(inspector = NodeInspector.new)
5355
5419
  inspector << inspector.header(self)
5356
5420
  inspector << "├── opening_loc: #{inspector.location(opening_loc)}\n"
@@ -5453,6 +5517,7 @@ module Prism
5453
5517
  operator_loc.slice
5454
5518
  end
5455
5519
 
5520
+ # def inspect(inspector: NodeInspector) -> String
5456
5521
  def inspect(inspector = NodeInspector.new)
5457
5522
  inspector << inspector.header(self)
5458
5523
  inspector << "├── operator_loc: #{inspector.location(operator_loc)}\n"
@@ -5566,6 +5631,7 @@ module Prism
5566
5631
  end_keyword_loc.slice
5567
5632
  end
5568
5633
 
5634
+ # def inspect(inspector: NodeInspector) -> String
5569
5635
  def inspect(inspector = NodeInspector.new)
5570
5636
  inspector << inspector.header(self)
5571
5637
  inspector << "├── ensure_keyword_loc: #{inspector.location(ensure_keyword_loc)}\n"
@@ -5653,6 +5719,7 @@ module Prism
5653
5719
  { location: location }
5654
5720
  end
5655
5721
 
5722
+ # def inspect(inspector: NodeInspector) -> String
5656
5723
  def inspect(inspector = NodeInspector.new)
5657
5724
  inspector << inspector.header(self)
5658
5725
  inspector.to_str
@@ -5690,13 +5757,13 @@ module Prism
5690
5757
  # Represents a find pattern in pattern matching.
5691
5758
  #
5692
5759
  # foo in *bar, baz, *qux
5693
- # ^^^^^^^^^^^^^^^^^^^^^^
5760
+ # ^^^^^^^^^^^^^^^
5694
5761
  #
5695
5762
  # foo in [*bar, baz, *qux]
5696
- # ^^^^^^^^^^^^^^^^^^^^^^^^
5763
+ # ^^^^^^^^^^^^^^^^^
5697
5764
  #
5698
5765
  # foo in Foo(*bar, baz, *qux)
5699
- # ^^^^^^^^^^^^^^^^^^^^^^^^^^^
5766
+ # ^^^^^^^^^^^^^^^^^^^^
5700
5767
  class FindPatternNode < Node
5701
5768
  # attr_reader constant: Node?
5702
5769
  attr_reader :constant
@@ -5783,6 +5850,7 @@ module Prism
5783
5850
  closing_loc&.slice
5784
5851
  end
5785
5852
 
5853
+ # def inspect(inspector: NodeInspector) -> String
5786
5854
  def inspect(inspector = NodeInspector.new)
5787
5855
  inspector << inspector.header(self)
5788
5856
  if (constant = self.constant).nil?
@@ -5908,6 +5976,7 @@ module Prism
5908
5976
  flags.anybits?(RangeFlags::EXCLUDE_END)
5909
5977
  end
5910
5978
 
5979
+ # def inspect(inspector: NodeInspector) -> String
5911
5980
  def inspect(inspector = NodeInspector.new)
5912
5981
  inspector << inspector.header(self)
5913
5982
  if (left = self.left).nil?
@@ -6002,6 +6071,7 @@ module Prism
6002
6071
  { location: location }
6003
6072
  end
6004
6073
 
6074
+ # def inspect(inspector: NodeInspector) -> String
6005
6075
  def inspect(inspector = NodeInspector.new)
6006
6076
  inspector << inspector.header(self)
6007
6077
  inspector.to_str
@@ -6140,6 +6210,7 @@ module Prism
6140
6210
  end_keyword_loc.slice
6141
6211
  end
6142
6212
 
6213
+ # def inspect(inspector: NodeInspector) -> String
6143
6214
  def inspect(inspector = NodeInspector.new)
6144
6215
  inspector << inspector.header(self)
6145
6216
  inspector << "├── index:\n"
@@ -6192,7 +6263,7 @@ module Prism
6192
6263
  #
6193
6264
  # def foo(...)
6194
6265
  # bar(...)
6195
- # ^^^^^^^^
6266
+ # ^^^
6196
6267
  # end
6197
6268
  class ForwardingArgumentsNode < Node
6198
6269
  # def initialize: (location: Location) -> void
@@ -6235,6 +6306,7 @@ module Prism
6235
6306
  { location: location }
6236
6307
  end
6237
6308
 
6309
+ # def inspect(inspector: NodeInspector) -> String
6238
6310
  def inspect(inspector = NodeInspector.new)
6239
6311
  inspector << inspector.header(self)
6240
6312
  inspector.to_str
@@ -6315,6 +6387,7 @@ module Prism
6315
6387
  { location: location }
6316
6388
  end
6317
6389
 
6390
+ # def inspect(inspector: NodeInspector) -> String
6318
6391
  def inspect(inspector = NodeInspector.new)
6319
6392
  inspector << inspector.header(self)
6320
6393
  inspector.to_str
@@ -6401,6 +6474,7 @@ module Prism
6401
6474
  { block: block, location: location }
6402
6475
  end
6403
6476
 
6477
+ # def inspect(inspector: NodeInspector) -> String
6404
6478
  def inspect(inspector = NodeInspector.new)
6405
6479
  inspector << inspector.header(self)
6406
6480
  if (block = self.block).nil?
@@ -6511,6 +6585,7 @@ module Prism
6511
6585
  operator_loc.slice
6512
6586
  end
6513
6587
 
6588
+ # def inspect(inspector: NodeInspector) -> String
6514
6589
  def inspect(inspector = NodeInspector.new)
6515
6590
  inspector << inspector.header(self)
6516
6591
  inspector << "├── name: #{name.inspect}\n"
@@ -6620,6 +6695,7 @@ module Prism
6620
6695
  { name: name, name_loc: name_loc, operator_loc: operator_loc, value: value, operator: operator, location: location }
6621
6696
  end
6622
6697
 
6698
+ # def inspect(inspector: NodeInspector) -> String
6623
6699
  def inspect(inspector = NodeInspector.new)
6624
6700
  inspector << inspector.header(self)
6625
6701
  inspector << "├── name: #{name.inspect}\n"
@@ -6730,6 +6806,7 @@ module Prism
6730
6806
  operator_loc.slice
6731
6807
  end
6732
6808
 
6809
+ # def inspect(inspector: NodeInspector) -> String
6733
6810
  def inspect(inspector = NodeInspector.new)
6734
6811
  inspector << inspector.header(self)
6735
6812
  inspector << "├── name: #{name.inspect}\n"
@@ -6819,6 +6896,7 @@ module Prism
6819
6896
  { name: name, location: location }
6820
6897
  end
6821
6898
 
6899
+ # def inspect(inspector: NodeInspector) -> String
6822
6900
  def inspect(inspector = NodeInspector.new)
6823
6901
  inspector << inspector.header(self)
6824
6902
  inspector << "└── name: #{name.inspect}\n"
@@ -6904,6 +6982,7 @@ module Prism
6904
6982
  { name: name, location: location }
6905
6983
  end
6906
6984
 
6985
+ # def inspect(inspector: NodeInspector) -> String
6907
6986
  def inspect(inspector = NodeInspector.new)
6908
6987
  inspector << inspector.header(self)
6909
6988
  inspector << "└── name: #{name.inspect}\n"
@@ -7009,6 +7088,7 @@ module Prism
7009
7088
  operator_loc.slice
7010
7089
  end
7011
7090
 
7091
+ # def inspect(inspector: NodeInspector) -> String
7012
7092
  def inspect(inspector = NodeInspector.new)
7013
7093
  inspector << inspector.header(self)
7014
7094
  inspector << "├── name: #{name.inspect}\n"
@@ -7118,6 +7198,7 @@ module Prism
7118
7198
  closing_loc.slice
7119
7199
  end
7120
7200
 
7201
+ # def inspect(inspector: NodeInspector) -> String
7121
7202
  def inspect(inspector = NodeInspector.new)
7122
7203
  inspector << inspector.header(self)
7123
7204
  inspector << "├── opening_loc: #{inspector.location(opening_loc)}\n"
@@ -7166,11 +7247,11 @@ module Prism
7166
7247
  # attr_reader constant: Node?
7167
7248
  attr_reader :constant
7168
7249
 
7169
- # attr_reader assocs: Array[Node]
7170
- attr_reader :assocs
7250
+ # attr_reader elements: Array[Node]
7251
+ attr_reader :elements
7171
7252
 
7172
- # attr_reader kwrest: Node?
7173
- attr_reader :kwrest
7253
+ # attr_reader rest: Node?
7254
+ attr_reader :rest
7174
7255
 
7175
7256
  # attr_reader opening_loc: Location?
7176
7257
  attr_reader :opening_loc
@@ -7178,11 +7259,11 @@ module Prism
7178
7259
  # attr_reader closing_loc: Location?
7179
7260
  attr_reader :closing_loc
7180
7261
 
7181
- # def initialize: (constant: Node?, assocs: Array[Node], kwrest: Node?, opening_loc: Location?, closing_loc: Location?, location: Location) -> void
7182
- def initialize(constant, assocs, kwrest, opening_loc, closing_loc, location)
7262
+ # def initialize: (constant: Node?, elements: Array[Node], rest: Node?, opening_loc: Location?, closing_loc: Location?, location: Location) -> void
7263
+ def initialize(constant, elements, rest, opening_loc, closing_loc, location)
7183
7264
  @constant = constant
7184
- @assocs = assocs
7185
- @kwrest = kwrest
7265
+ @elements = elements
7266
+ @rest = rest
7186
7267
  @opening_loc = opening_loc
7187
7268
  @closing_loc = closing_loc
7188
7269
  @location = location
@@ -7195,29 +7276,29 @@ module Prism
7195
7276
 
7196
7277
  # def child_nodes: () -> Array[nil | Node]
7197
7278
  def child_nodes
7198
- [constant, *assocs, kwrest]
7279
+ [constant, *elements, rest]
7199
7280
  end
7200
7281
 
7201
7282
  # def compact_child_nodes: () -> Array[Node]
7202
7283
  def compact_child_nodes
7203
7284
  compact = []
7204
7285
  compact << constant if constant
7205
- compact.concat(assocs)
7206
- compact << kwrest if kwrest
7286
+ compact.concat(elements)
7287
+ compact << rest if rest
7207
7288
  compact
7208
7289
  end
7209
7290
 
7210
7291
  # def comment_targets: () -> Array[Node | Location]
7211
7292
  def comment_targets
7212
- [*constant, *assocs, *kwrest, *opening_loc, *closing_loc]
7293
+ [*constant, *elements, *rest, *opening_loc, *closing_loc]
7213
7294
  end
7214
7295
 
7215
7296
  # def copy: (**params) -> HashPatternNode
7216
7297
  def copy(**params)
7217
7298
  HashPatternNode.new(
7218
7299
  params.fetch(:constant) { constant },
7219
- params.fetch(:assocs) { assocs },
7220
- params.fetch(:kwrest) { kwrest },
7300
+ params.fetch(:elements) { elements },
7301
+ params.fetch(:rest) { rest },
7221
7302
  params.fetch(:opening_loc) { opening_loc },
7222
7303
  params.fetch(:closing_loc) { closing_loc },
7223
7304
  params.fetch(:location) { location },
@@ -7229,7 +7310,7 @@ module Prism
7229
7310
 
7230
7311
  # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
7231
7312
  def deconstruct_keys(keys)
7232
- { constant: constant, assocs: assocs, kwrest: kwrest, opening_loc: opening_loc, closing_loc: closing_loc, location: location }
7313
+ { constant: constant, elements: elements, rest: rest, opening_loc: opening_loc, closing_loc: closing_loc, location: location }
7233
7314
  end
7234
7315
 
7235
7316
  # def opening: () -> String?
@@ -7242,6 +7323,7 @@ module Prism
7242
7323
  closing_loc&.slice
7243
7324
  end
7244
7325
 
7326
+ # def inspect(inspector: NodeInspector) -> String
7245
7327
  def inspect(inspector = NodeInspector.new)
7246
7328
  inspector << inspector.header(self)
7247
7329
  if (constant = self.constant).nil?
@@ -7250,12 +7332,12 @@ module Prism
7250
7332
  inspector << "├── constant:\n"
7251
7333
  inspector << constant.inspect(inspector.child_inspector("│ ")).delete_prefix(inspector.prefix)
7252
7334
  end
7253
- inspector << "├── assocs: #{inspector.list("#{inspector.prefix}│ ", assocs)}"
7254
- if (kwrest = self.kwrest).nil?
7255
- inspector << "├── kwrest: ∅\n"
7335
+ inspector << "├── elements: #{inspector.list("#{inspector.prefix}│ ", elements)}"
7336
+ if (rest = self.rest).nil?
7337
+ inspector << "├── rest: ∅\n"
7256
7338
  else
7257
- inspector << "├── kwrest:\n"
7258
- inspector << kwrest.inspect(inspector.child_inspector("│ ")).delete_prefix(inspector.prefix)
7339
+ inspector << "├── rest:\n"
7340
+ inspector << rest.inspect(inspector.child_inspector("│ ")).delete_prefix(inspector.prefix)
7259
7341
  end
7260
7342
  inspector << "├── opening_loc: #{inspector.location(opening_loc)}\n"
7261
7343
  inspector << "└── closing_loc: #{inspector.location(closing_loc)}\n"
@@ -7329,7 +7411,7 @@ module Prism
7329
7411
  visitor.visit_if_node(self)
7330
7412
  end
7331
7413
 
7332
- def set_newline_flag(newline_marked)
7414
+ def set_newline_flag(newline_marked) # :nodoc:
7333
7415
  predicate.set_newline_flag(newline_marked)
7334
7416
  end
7335
7417
 
@@ -7382,6 +7464,7 @@ module Prism
7382
7464
  end_keyword_loc&.slice
7383
7465
  end
7384
7466
 
7467
+ # def inspect(inspector: NodeInspector) -> String
7385
7468
  def inspect(inspector = NodeInspector.new)
7386
7469
  inspector << inspector.header(self)
7387
7470
  inspector << "├── if_keyword_loc: #{inspector.location(if_keyword_loc)}\n"
@@ -7482,6 +7565,7 @@ module Prism
7482
7565
  { numeric: numeric, location: location }
7483
7566
  end
7484
7567
 
7568
+ # def inspect(inspector: NodeInspector) -> String
7485
7569
  def inspect(inspector = NodeInspector.new)
7486
7570
  inspector << inspector.header(self)
7487
7571
  inspector << "└── numeric:\n"
@@ -7572,6 +7656,7 @@ module Prism
7572
7656
  { value: value, location: location }
7573
7657
  end
7574
7658
 
7659
+ # def inspect(inspector: NodeInspector) -> String
7575
7660
  def inspect(inspector = NodeInspector.new)
7576
7661
  inspector << inspector.header(self)
7577
7662
  inspector << "└── value:\n"
@@ -7686,6 +7771,7 @@ module Prism
7686
7771
  then_loc&.slice
7687
7772
  end
7688
7773
 
7774
+ # def inspect(inspector: NodeInspector) -> String
7689
7775
  def inspect(inspector = NodeInspector.new)
7690
7776
  inspector << inspector.header(self)
7691
7777
  inspector << "├── pattern:\n"
@@ -7855,6 +7941,7 @@ module Prism
7855
7941
  operator_loc.slice
7856
7942
  end
7857
7943
 
7944
+ # def inspect(inspector: NodeInspector) -> String
7858
7945
  def inspect(inspector = NodeInspector.new)
7859
7946
  inspector << inspector.header(self)
7860
7947
  if (receiver = self.receiver).nil?
@@ -8040,6 +8127,7 @@ module Prism
8040
8127
  flags.anybits?(CallNodeFlags::VARIABLE_CALL)
8041
8128
  end
8042
8129
 
8130
+ # def inspect(inspector: NodeInspector) -> String
8043
8131
  def inspect(inspector = NodeInspector.new)
8044
8132
  inspector << inspector.header(self)
8045
8133
  if (receiver = self.receiver).nil?
@@ -8226,6 +8314,7 @@ module Prism
8226
8314
  operator_loc.slice
8227
8315
  end
8228
8316
 
8317
+ # def inspect(inspector: NodeInspector) -> String
8229
8318
  def inspect(inspector = NodeInspector.new)
8230
8319
  inspector << inspector.header(self)
8231
8320
  if (receiver = self.receiver).nil?
@@ -8356,6 +8445,7 @@ module Prism
8356
8445
  operator_loc.slice
8357
8446
  end
8358
8447
 
8448
+ # def inspect(inspector: NodeInspector) -> String
8359
8449
  def inspect(inspector = NodeInspector.new)
8360
8450
  inspector << inspector.header(self)
8361
8451
  inspector << "├── name: #{name.inspect}\n"
@@ -8465,6 +8555,7 @@ module Prism
8465
8555
  { name: name, name_loc: name_loc, operator_loc: operator_loc, value: value, operator: operator, location: location }
8466
8556
  end
8467
8557
 
8558
+ # def inspect(inspector: NodeInspector) -> String
8468
8559
  def inspect(inspector = NodeInspector.new)
8469
8560
  inspector << inspector.header(self)
8470
8561
  inspector << "├── name: #{name.inspect}\n"
@@ -8575,6 +8666,7 @@ module Prism
8575
8666
  operator_loc.slice
8576
8667
  end
8577
8668
 
8669
+ # def inspect(inspector: NodeInspector) -> String
8578
8670
  def inspect(inspector = NodeInspector.new)
8579
8671
  inspector << inspector.header(self)
8580
8672
  inspector << "├── name: #{name.inspect}\n"
@@ -8664,6 +8756,7 @@ module Prism
8664
8756
  { name: name, location: location }
8665
8757
  end
8666
8758
 
8759
+ # def inspect(inspector: NodeInspector) -> String
8667
8760
  def inspect(inspector = NodeInspector.new)
8668
8761
  inspector << inspector.header(self)
8669
8762
  inspector << "└── name: #{name.inspect}\n"
@@ -8749,6 +8842,7 @@ module Prism
8749
8842
  { name: name, location: location }
8750
8843
  end
8751
8844
 
8845
+ # def inspect(inspector: NodeInspector) -> String
8752
8846
  def inspect(inspector = NodeInspector.new)
8753
8847
  inspector << inspector.header(self)
8754
8848
  inspector << "└── name: #{name.inspect}\n"
@@ -8854,6 +8948,7 @@ module Prism
8854
8948
  operator_loc.slice
8855
8949
  end
8856
8950
 
8951
+ # def inspect(inspector: NodeInspector) -> String
8857
8952
  def inspect(inspector = NodeInspector.new)
8858
8953
  inspector << inspector.header(self)
8859
8954
  inspector << "├── name: #{name.inspect}\n"
@@ -8963,6 +9058,7 @@ module Prism
8963
9058
  flags.anybits?(IntegerBaseFlags::HEXADECIMAL)
8964
9059
  end
8965
9060
 
9061
+ # def inspect(inspector: NodeInspector) -> String
8966
9062
  def inspect(inspector = NodeInspector.new)
8967
9063
  inspector << inspector.header(self)
8968
9064
  flags = [("binary" if binary?), ("octal" if octal?), ("decimal" if decimal?), ("hexadecimal" if hexadecimal?)].compact
@@ -9032,7 +9128,7 @@ module Prism
9032
9128
  visitor.visit_interpolated_match_last_line_node(self)
9033
9129
  end
9034
9130
 
9035
- def set_newline_flag(newline_marked)
9131
+ def set_newline_flag(newline_marked) # :nodoc:
9036
9132
  first = parts.first
9037
9133
  first.set_newline_flag(newline_marked) if first
9038
9134
  end
@@ -9121,6 +9217,7 @@ module Prism
9121
9217
  flags.anybits?(RegularExpressionFlags::UTF_8)
9122
9218
  end
9123
9219
 
9220
+ # def inspect(inspector: NodeInspector) -> String
9124
9221
  def inspect(inspector = NodeInspector.new)
9125
9222
  inspector << inspector.header(self)
9126
9223
  inspector << "├── opening_loc: #{inspector.location(opening_loc)}\n"
@@ -9191,7 +9288,7 @@ module Prism
9191
9288
  visitor.visit_interpolated_regular_expression_node(self)
9192
9289
  end
9193
9290
 
9194
- def set_newline_flag(newline_marked)
9291
+ def set_newline_flag(newline_marked) # :nodoc:
9195
9292
  first = parts.first
9196
9293
  first.set_newline_flag(newline_marked) if first
9197
9294
  end
@@ -9280,6 +9377,7 @@ module Prism
9280
9377
  flags.anybits?(RegularExpressionFlags::UTF_8)
9281
9378
  end
9282
9379
 
9380
+ # def inspect(inspector: NodeInspector) -> String
9283
9381
  def inspect(inspector = NodeInspector.new)
9284
9382
  inspector << inspector.header(self)
9285
9383
  inspector << "├── opening_loc: #{inspector.location(opening_loc)}\n"
@@ -9346,7 +9444,7 @@ module Prism
9346
9444
  visitor.visit_interpolated_string_node(self)
9347
9445
  end
9348
9446
 
9349
- def set_newline_flag(newline_marked)
9447
+ def set_newline_flag(newline_marked) # :nodoc:
9350
9448
  first = parts.first
9351
9449
  first.set_newline_flag(newline_marked) if first
9352
9450
  end
@@ -9394,6 +9492,7 @@ module Prism
9394
9492
  closing_loc&.slice
9395
9493
  end
9396
9494
 
9495
+ # def inspect(inspector: NodeInspector) -> String
9397
9496
  def inspect(inspector = NodeInspector.new)
9398
9497
  inspector << inspector.header(self)
9399
9498
  inspector << "├── opening_loc: #{inspector.location(opening_loc)}\n"
@@ -9458,7 +9557,7 @@ module Prism
9458
9557
  visitor.visit_interpolated_symbol_node(self)
9459
9558
  end
9460
9559
 
9461
- def set_newline_flag(newline_marked)
9560
+ def set_newline_flag(newline_marked) # :nodoc:
9462
9561
  first = parts.first
9463
9562
  first.set_newline_flag(newline_marked) if first
9464
9563
  end
@@ -9506,6 +9605,7 @@ module Prism
9506
9605
  closing_loc&.slice
9507
9606
  end
9508
9607
 
9608
+ # def inspect(inspector: NodeInspector) -> String
9509
9609
  def inspect(inspector = NodeInspector.new)
9510
9610
  inspector << inspector.header(self)
9511
9611
  inspector << "├── opening_loc: #{inspector.location(opening_loc)}\n"
@@ -9570,7 +9670,7 @@ module Prism
9570
9670
  visitor.visit_interpolated_x_string_node(self)
9571
9671
  end
9572
9672
 
9573
- def set_newline_flag(newline_marked)
9673
+ def set_newline_flag(newline_marked) # :nodoc:
9574
9674
  first = parts.first
9575
9675
  first.set_newline_flag(newline_marked) if first
9576
9676
  end
@@ -9618,6 +9718,7 @@ module Prism
9618
9718
  closing_loc.slice
9619
9719
  end
9620
9720
 
9721
+ # def inspect(inspector: NodeInspector) -> String
9621
9722
  def inspect(inspector = NodeInspector.new)
9622
9723
  inspector << inspector.header(self)
9623
9724
  inspector << "├── opening_loc: #{inspector.location(opening_loc)}\n"
@@ -9705,6 +9806,7 @@ module Prism
9705
9806
  { elements: elements, location: location }
9706
9807
  end
9707
9808
 
9809
+ # def inspect(inspector: NodeInspector) -> String
9708
9810
  def inspect(inspector = NodeInspector.new)
9709
9811
  inspector << inspector.header(self)
9710
9812
  inspector << "└── elements: #{inspector.list("#{inspector.prefix} ", elements)}"
@@ -9740,115 +9842,6 @@ module Prism
9740
9842
  end
9741
9843
  end
9742
9844
 
9743
- # Represents a keyword parameter to a method, block, or lambda definition.
9744
- #
9745
- # def a(b:)
9746
- # ^^
9747
- # end
9748
- #
9749
- # def a(b: 1)
9750
- # ^^^^
9751
- # end
9752
- class KeywordParameterNode < Node
9753
- # attr_reader name: Symbol
9754
- attr_reader :name
9755
-
9756
- # attr_reader name_loc: Location
9757
- attr_reader :name_loc
9758
-
9759
- # attr_reader value: Node?
9760
- attr_reader :value
9761
-
9762
- # def initialize: (name: Symbol, name_loc: Location, value: Node?, location: Location) -> void
9763
- def initialize(name, name_loc, value, location)
9764
- @name = name
9765
- @name_loc = name_loc
9766
- @value = value
9767
- @location = location
9768
- end
9769
-
9770
- # def accept: (visitor: Visitor) -> void
9771
- def accept(visitor)
9772
- visitor.visit_keyword_parameter_node(self)
9773
- end
9774
-
9775
- # def child_nodes: () -> Array[nil | Node]
9776
- def child_nodes
9777
- [value]
9778
- end
9779
-
9780
- # def compact_child_nodes: () -> Array[Node]
9781
- def compact_child_nodes
9782
- compact = []
9783
- compact << value if value
9784
- compact
9785
- end
9786
-
9787
- # def comment_targets: () -> Array[Node | Location]
9788
- def comment_targets
9789
- [name_loc, *value]
9790
- end
9791
-
9792
- # def copy: (**params) -> KeywordParameterNode
9793
- def copy(**params)
9794
- KeywordParameterNode.new(
9795
- params.fetch(:name) { name },
9796
- params.fetch(:name_loc) { name_loc },
9797
- params.fetch(:value) { value },
9798
- params.fetch(:location) { location },
9799
- )
9800
- end
9801
-
9802
- # def deconstruct: () -> Array[nil | Node]
9803
- alias deconstruct child_nodes
9804
-
9805
- # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
9806
- def deconstruct_keys(keys)
9807
- { name: name, name_loc: name_loc, value: value, location: location }
9808
- end
9809
-
9810
- def inspect(inspector = NodeInspector.new)
9811
- inspector << inspector.header(self)
9812
- inspector << "├── name: #{name.inspect}\n"
9813
- inspector << "├── name_loc: #{inspector.location(name_loc)}\n"
9814
- if (value = self.value).nil?
9815
- inspector << "└── value: ∅\n"
9816
- else
9817
- inspector << "└── value:\n"
9818
- inspector << value.inspect(inspector.child_inspector(" ")).delete_prefix(inspector.prefix)
9819
- end
9820
- inspector.to_str
9821
- end
9822
-
9823
- # Sometimes you want to check an instance of a node against a list of
9824
- # classes to see what kind of behavior to perform. Usually this is done by
9825
- # calling `[cls1, cls2].include?(node.class)` or putting the node into a
9826
- # case statement and doing `case node; when cls1; when cls2; end`. Both of
9827
- # these approaches are relatively slow because of the constant lookups,
9828
- # method calls, and/or array allocations.
9829
- #
9830
- # Instead, you can call #type, which will return to you a symbol that you
9831
- # can use for comparison. This is faster than the other approaches because
9832
- # it uses a single integer comparison, but also because if you're on CRuby
9833
- # you can take advantage of the fact that case statements with all symbol
9834
- # keys will use a jump table.
9835
- #
9836
- # def type: () -> Symbol
9837
- def type
9838
- :keyword_parameter_node
9839
- end
9840
-
9841
- # Similar to #type, this method returns a symbol that you can use for
9842
- # splitting on the type of the node without having to do a long === chain.
9843
- # Note that like #type, it will still be slower than using == for a single
9844
- # class, but should be faster in a case statement or an array comparison.
9845
- #
9846
- # def self.type: () -> Symbol
9847
- def self.type
9848
- :keyword_parameter_node
9849
- end
9850
- end
9851
-
9852
9845
  # Represents a keyword rest parameter to a method, block, or lambda definition.
9853
9846
  #
9854
9847
  # def a(**b)
@@ -9915,9 +9908,14 @@ module Prism
9915
9908
  operator_loc.slice
9916
9909
  end
9917
9910
 
9911
+ # def inspect(inspector: NodeInspector) -> String
9918
9912
  def inspect(inspector = NodeInspector.new)
9919
9913
  inspector << inspector.header(self)
9920
- inspector << "├── name: #{name.inspect}\n"
9914
+ if (name = self.name).nil?
9915
+ inspector << "├── name: ∅\n"
9916
+ else
9917
+ inspector << "├── name: #{name.inspect}\n"
9918
+ end
9921
9919
  inspector << "├── name_loc: #{inspector.location(name_loc)}\n"
9922
9920
  inspector << "└── operator_loc: #{inspector.location(operator_loc)}\n"
9923
9921
  inspector.to_str
@@ -10045,6 +10043,7 @@ module Prism
10045
10043
  closing_loc.slice
10046
10044
  end
10047
10045
 
10046
+ # def inspect(inspector: NodeInspector) -> String
10048
10047
  def inspect(inspector = NodeInspector.new)
10049
10048
  inspector << inspector.header(self)
10050
10049
  inspector << "├── locals: #{locals.inspect}\n"
@@ -10170,6 +10169,7 @@ module Prism
10170
10169
  operator_loc.slice
10171
10170
  end
10172
10171
 
10172
+ # def inspect(inspector: NodeInspector) -> String
10173
10173
  def inspect(inspector = NodeInspector.new)
10174
10174
  inspector << inspector.header(self)
10175
10175
  inspector << "├── name_loc: #{inspector.location(name_loc)}\n"
@@ -10285,6 +10285,7 @@ module Prism
10285
10285
  { name_loc: name_loc, operator_loc: operator_loc, value: value, name: name, operator: operator, depth: depth, location: location }
10286
10286
  end
10287
10287
 
10288
+ # def inspect(inspector: NodeInspector) -> String
10288
10289
  def inspect(inspector = NodeInspector.new)
10289
10290
  inspector << inspector.header(self)
10290
10291
  inspector << "├── name_loc: #{inspector.location(name_loc)}\n"
@@ -10401,6 +10402,7 @@ module Prism
10401
10402
  operator_loc.slice
10402
10403
  end
10403
10404
 
10405
+ # def inspect(inspector: NodeInspector) -> String
10404
10406
  def inspect(inspector = NodeInspector.new)
10405
10407
  inspector << inspector.header(self)
10406
10408
  inspector << "├── name_loc: #{inspector.location(name_loc)}\n"
@@ -10498,6 +10500,7 @@ module Prism
10498
10500
  { name: name, depth: depth, location: location }
10499
10501
  end
10500
10502
 
10503
+ # def inspect(inspector: NodeInspector) -> String
10501
10504
  def inspect(inspector = NodeInspector.new)
10502
10505
  inspector << inspector.header(self)
10503
10506
  inspector << "├── name: #{name.inspect}\n"
@@ -10589,6 +10592,7 @@ module Prism
10589
10592
  { name: name, depth: depth, location: location }
10590
10593
  end
10591
10594
 
10595
+ # def inspect(inspector: NodeInspector) -> String
10592
10596
  def inspect(inspector = NodeInspector.new)
10593
10597
  inspector << inspector.header(self)
10594
10598
  inspector << "├── name: #{name.inspect}\n"
@@ -10700,6 +10704,7 @@ module Prism
10700
10704
  operator_loc.slice
10701
10705
  end
10702
10706
 
10707
+ # def inspect(inspector: NodeInspector) -> String
10703
10708
  def inspect(inspector = NodeInspector.new)
10704
10709
  inspector << inspector.header(self)
10705
10710
  inspector << "├── name: #{name.inspect}\n"
@@ -10867,6 +10872,7 @@ module Prism
10867
10872
  flags.anybits?(RegularExpressionFlags::UTF_8)
10868
10873
  end
10869
10874
 
10875
+ # def inspect(inspector: NodeInspector) -> String
10870
10876
  def inspect(inspector = NodeInspector.new)
10871
10877
  inspector << inspector.header(self)
10872
10878
  inspector << "├── opening_loc: #{inspector.location(opening_loc)}\n"
@@ -10972,6 +10978,7 @@ module Prism
10972
10978
  operator_loc.slice
10973
10979
  end
10974
10980
 
10981
+ # def inspect(inspector: NodeInspector) -> String
10975
10982
  def inspect(inspector = NodeInspector.new)
10976
10983
  inspector << inspector.header(self)
10977
10984
  inspector << "├── value:\n"
@@ -11076,6 +11083,7 @@ module Prism
11076
11083
  operator_loc.slice
11077
11084
  end
11078
11085
 
11086
+ # def inspect(inspector: NodeInspector) -> String
11079
11087
  def inspect(inspector = NodeInspector.new)
11080
11088
  inspector << inspector.header(self)
11081
11089
  inspector << "├── value:\n"
@@ -11171,6 +11179,7 @@ module Prism
11171
11179
  { call: call, locals: locals, location: location }
11172
11180
  end
11173
11181
 
11182
+ # def inspect(inspector: NodeInspector) -> String
11174
11183
  def inspect(inspector = NodeInspector.new)
11175
11184
  inspector << inspector.header(self)
11176
11185
  inspector << "├── call:\n"
@@ -11251,6 +11260,7 @@ module Prism
11251
11260
  { location: location }
11252
11261
  end
11253
11262
 
11263
+ # def inspect(inspector: NodeInspector) -> String
11254
11264
  def inspect(inspector = NodeInspector.new)
11255
11265
  inspector << inspector.header(self)
11256
11266
  inspector.to_str
@@ -11373,6 +11383,7 @@ module Prism
11373
11383
  end_keyword_loc.slice
11374
11384
  end
11375
11385
 
11386
+ # def inspect(inspector: NodeInspector) -> String
11376
11387
  def inspect(inspector = NodeInspector.new)
11377
11388
  inspector << inspector.header(self)
11378
11389
  inspector << "├── locals: #{locals.inspect}\n"
@@ -11421,11 +11432,17 @@ module Prism
11421
11432
 
11422
11433
  # Represents a multi-target expression.
11423
11434
  #
11424
- # a, b, c = 1, 2, 3
11425
- # ^^^^^^^
11435
+ # a, (b, c) = 1, 2, 3
11436
+ # ^^^^^^
11426
11437
  class MultiTargetNode < Node
11427
- # attr_reader targets: Array[Node]
11428
- attr_reader :targets
11438
+ # attr_reader lefts: Array[Node]
11439
+ attr_reader :lefts
11440
+
11441
+ # attr_reader rest: Node?
11442
+ attr_reader :rest
11443
+
11444
+ # attr_reader rights: Array[Node]
11445
+ attr_reader :rights
11429
11446
 
11430
11447
  # attr_reader lparen_loc: Location?
11431
11448
  attr_reader :lparen_loc
@@ -11433,9 +11450,11 @@ module Prism
11433
11450
  # attr_reader rparen_loc: Location?
11434
11451
  attr_reader :rparen_loc
11435
11452
 
11436
- # def initialize: (targets: Array[Node], lparen_loc: Location?, rparen_loc: Location?, location: Location) -> void
11437
- def initialize(targets, lparen_loc, rparen_loc, location)
11438
- @targets = targets
11453
+ # def initialize: (lefts: Array[Node], rest: Node?, rights: Array[Node], lparen_loc: Location?, rparen_loc: Location?, location: Location) -> void
11454
+ def initialize(lefts, rest, rights, lparen_loc, rparen_loc, location)
11455
+ @lefts = lefts
11456
+ @rest = rest
11457
+ @rights = rights
11439
11458
  @lparen_loc = lparen_loc
11440
11459
  @rparen_loc = rparen_loc
11441
11460
  @location = location
@@ -11448,23 +11467,29 @@ module Prism
11448
11467
 
11449
11468
  # def child_nodes: () -> Array[nil | Node]
11450
11469
  def child_nodes
11451
- [*targets]
11470
+ [*lefts, rest, *rights]
11452
11471
  end
11453
11472
 
11454
11473
  # def compact_child_nodes: () -> Array[Node]
11455
11474
  def compact_child_nodes
11456
- [*targets]
11475
+ compact = []
11476
+ compact.concat(lefts)
11477
+ compact << rest if rest
11478
+ compact.concat(rights)
11479
+ compact
11457
11480
  end
11458
11481
 
11459
11482
  # def comment_targets: () -> Array[Node | Location]
11460
11483
  def comment_targets
11461
- [*targets, *lparen_loc, *rparen_loc]
11484
+ [*lefts, *rest, *rights, *lparen_loc, *rparen_loc]
11462
11485
  end
11463
11486
 
11464
11487
  # def copy: (**params) -> MultiTargetNode
11465
11488
  def copy(**params)
11466
11489
  MultiTargetNode.new(
11467
- params.fetch(:targets) { targets },
11490
+ params.fetch(:lefts) { lefts },
11491
+ params.fetch(:rest) { rest },
11492
+ params.fetch(:rights) { rights },
11468
11493
  params.fetch(:lparen_loc) { lparen_loc },
11469
11494
  params.fetch(:rparen_loc) { rparen_loc },
11470
11495
  params.fetch(:location) { location },
@@ -11476,7 +11501,7 @@ module Prism
11476
11501
 
11477
11502
  # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
11478
11503
  def deconstruct_keys(keys)
11479
- { targets: targets, lparen_loc: lparen_loc, rparen_loc: rparen_loc, location: location }
11504
+ { lefts: lefts, rest: rest, rights: rights, lparen_loc: lparen_loc, rparen_loc: rparen_loc, location: location }
11480
11505
  end
11481
11506
 
11482
11507
  # def lparen: () -> String?
@@ -11489,9 +11514,17 @@ module Prism
11489
11514
  rparen_loc&.slice
11490
11515
  end
11491
11516
 
11517
+ # def inspect(inspector: NodeInspector) -> String
11492
11518
  def inspect(inspector = NodeInspector.new)
11493
11519
  inspector << inspector.header(self)
11494
- inspector << "├── targets: #{inspector.list("#{inspector.prefix}│ ", targets)}"
11520
+ inspector << "├── lefts: #{inspector.list("#{inspector.prefix}│ ", lefts)}"
11521
+ if (rest = self.rest).nil?
11522
+ inspector << "├── rest: ∅\n"
11523
+ else
11524
+ inspector << "├── rest:\n"
11525
+ inspector << rest.inspect(inspector.child_inspector("│ ")).delete_prefix(inspector.prefix)
11526
+ end
11527
+ inspector << "├── rights: #{inspector.list("#{inspector.prefix}│ ", rights)}"
11495
11528
  inspector << "├── lparen_loc: #{inspector.location(lparen_loc)}\n"
11496
11529
  inspector << "└── rparen_loc: #{inspector.location(rparen_loc)}\n"
11497
11530
  inspector.to_str
@@ -11531,8 +11564,14 @@ module Prism
11531
11564
  # a, b, c = 1, 2, 3
11532
11565
  # ^^^^^^^^^^^^^^^^^
11533
11566
  class MultiWriteNode < Node
11534
- # attr_reader targets: Array[Node]
11535
- attr_reader :targets
11567
+ # attr_reader lefts: Array[Node]
11568
+ attr_reader :lefts
11569
+
11570
+ # attr_reader rest: Node?
11571
+ attr_reader :rest
11572
+
11573
+ # attr_reader rights: Array[Node]
11574
+ attr_reader :rights
11536
11575
 
11537
11576
  # attr_reader lparen_loc: Location?
11538
11577
  attr_reader :lparen_loc
@@ -11546,9 +11585,11 @@ module Prism
11546
11585
  # attr_reader value: Node
11547
11586
  attr_reader :value
11548
11587
 
11549
- # def initialize: (targets: Array[Node], lparen_loc: Location?, rparen_loc: Location?, operator_loc: Location, value: Node, location: Location) -> void
11550
- def initialize(targets, lparen_loc, rparen_loc, operator_loc, value, location)
11551
- @targets = targets
11588
+ # def initialize: (lefts: Array[Node], rest: Node?, rights: Array[Node], lparen_loc: Location?, rparen_loc: Location?, operator_loc: Location, value: Node, location: Location) -> void
11589
+ def initialize(lefts, rest, rights, lparen_loc, rparen_loc, operator_loc, value, location)
11590
+ @lefts = lefts
11591
+ @rest = rest
11592
+ @rights = rights
11552
11593
  @lparen_loc = lparen_loc
11553
11594
  @rparen_loc = rparen_loc
11554
11595
  @operator_loc = operator_loc
@@ -11563,23 +11604,30 @@ module Prism
11563
11604
 
11564
11605
  # def child_nodes: () -> Array[nil | Node]
11565
11606
  def child_nodes
11566
- [*targets, value]
11607
+ [*lefts, rest, *rights, value]
11567
11608
  end
11568
11609
 
11569
11610
  # def compact_child_nodes: () -> Array[Node]
11570
11611
  def compact_child_nodes
11571
- [*targets, value]
11612
+ compact = []
11613
+ compact.concat(lefts)
11614
+ compact << rest if rest
11615
+ compact.concat(rights)
11616
+ compact << value
11617
+ compact
11572
11618
  end
11573
11619
 
11574
11620
  # def comment_targets: () -> Array[Node | Location]
11575
11621
  def comment_targets
11576
- [*targets, *lparen_loc, *rparen_loc, operator_loc, value]
11622
+ [*lefts, *rest, *rights, *lparen_loc, *rparen_loc, operator_loc, value]
11577
11623
  end
11578
11624
 
11579
11625
  # def copy: (**params) -> MultiWriteNode
11580
11626
  def copy(**params)
11581
11627
  MultiWriteNode.new(
11582
- params.fetch(:targets) { targets },
11628
+ params.fetch(:lefts) { lefts },
11629
+ params.fetch(:rest) { rest },
11630
+ params.fetch(:rights) { rights },
11583
11631
  params.fetch(:lparen_loc) { lparen_loc },
11584
11632
  params.fetch(:rparen_loc) { rparen_loc },
11585
11633
  params.fetch(:operator_loc) { operator_loc },
@@ -11593,7 +11641,7 @@ module Prism
11593
11641
 
11594
11642
  # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
11595
11643
  def deconstruct_keys(keys)
11596
- { targets: targets, lparen_loc: lparen_loc, rparen_loc: rparen_loc, operator_loc: operator_loc, value: value, location: location }
11644
+ { lefts: lefts, rest: rest, rights: rights, lparen_loc: lparen_loc, rparen_loc: rparen_loc, operator_loc: operator_loc, value: value, location: location }
11597
11645
  end
11598
11646
 
11599
11647
  # def lparen: () -> String?
@@ -11611,9 +11659,17 @@ module Prism
11611
11659
  operator_loc.slice
11612
11660
  end
11613
11661
 
11662
+ # def inspect(inspector: NodeInspector) -> String
11614
11663
  def inspect(inspector = NodeInspector.new)
11615
11664
  inspector << inspector.header(self)
11616
- inspector << "├── targets: #{inspector.list("#{inspector.prefix}│ ", targets)}"
11665
+ inspector << "├── lefts: #{inspector.list("#{inspector.prefix}│ ", lefts)}"
11666
+ if (rest = self.rest).nil?
11667
+ inspector << "├── rest: ∅\n"
11668
+ else
11669
+ inspector << "├── rest:\n"
11670
+ inspector << rest.inspect(inspector.child_inspector("│ ")).delete_prefix(inspector.prefix)
11671
+ end
11672
+ inspector << "├── rights: #{inspector.list("#{inspector.prefix}│ ", rights)}"
11617
11673
  inspector << "├── lparen_loc: #{inspector.location(lparen_loc)}\n"
11618
11674
  inspector << "├── rparen_loc: #{inspector.location(rparen_loc)}\n"
11619
11675
  inspector << "├── operator_loc: #{inspector.location(operator_loc)}\n"
@@ -11713,6 +11769,7 @@ module Prism
11713
11769
  keyword_loc.slice
11714
11770
  end
11715
11771
 
11772
+ # def inspect(inspector: NodeInspector) -> String
11716
11773
  def inspect(inspector = NodeInspector.new)
11717
11774
  inspector << inspector.header(self)
11718
11775
  if (arguments = self.arguments).nil?
@@ -11799,6 +11856,7 @@ module Prism
11799
11856
  { location: location }
11800
11857
  end
11801
11858
 
11859
+ # def inspect(inspector: NodeInspector) -> String
11802
11860
  def inspect(inspector = NodeInspector.new)
11803
11861
  inspector << inspector.header(self)
11804
11862
  inspector.to_str
@@ -11899,6 +11957,7 @@ module Prism
11899
11957
  keyword_loc.slice
11900
11958
  end
11901
11959
 
11960
+ # def inspect(inspector: NodeInspector) -> String
11902
11961
  def inspect(inspector = NodeInspector.new)
11903
11962
  inspector << inspector.header(self)
11904
11963
  inspector << "├── operator_loc: #{inspector.location(operator_loc)}\n"
@@ -11985,6 +12044,7 @@ module Prism
11985
12044
  { number: number, location: location }
11986
12045
  end
11987
12046
 
12047
+ # def inspect(inspector: NodeInspector) -> String
11988
12048
  def inspect(inspector = NodeInspector.new)
11989
12049
  inspector << inspector.header(self)
11990
12050
  inspector << "└── number: #{number.inspect}\n"
@@ -12020,6 +12080,106 @@ module Prism
12020
12080
  end
12021
12081
  end
12022
12082
 
12083
+ # Represents an optional keyword parameter to a method, block, or lambda definition.
12084
+ #
12085
+ # def a(b: 1)
12086
+ # ^^^^
12087
+ # end
12088
+ class OptionalKeywordParameterNode < Node
12089
+ # attr_reader name: Symbol
12090
+ attr_reader :name
12091
+
12092
+ # attr_reader name_loc: Location
12093
+ attr_reader :name_loc
12094
+
12095
+ # attr_reader value: Node
12096
+ attr_reader :value
12097
+
12098
+ # def initialize: (name: Symbol, name_loc: Location, value: Node, location: Location) -> void
12099
+ def initialize(name, name_loc, value, location)
12100
+ @name = name
12101
+ @name_loc = name_loc
12102
+ @value = value
12103
+ @location = location
12104
+ end
12105
+
12106
+ # def accept: (visitor: Visitor) -> void
12107
+ def accept(visitor)
12108
+ visitor.visit_optional_keyword_parameter_node(self)
12109
+ end
12110
+
12111
+ # def child_nodes: () -> Array[nil | Node]
12112
+ def child_nodes
12113
+ [value]
12114
+ end
12115
+
12116
+ # def compact_child_nodes: () -> Array[Node]
12117
+ def compact_child_nodes
12118
+ [value]
12119
+ end
12120
+
12121
+ # def comment_targets: () -> Array[Node | Location]
12122
+ def comment_targets
12123
+ [name_loc, value]
12124
+ end
12125
+
12126
+ # def copy: (**params) -> OptionalKeywordParameterNode
12127
+ def copy(**params)
12128
+ OptionalKeywordParameterNode.new(
12129
+ params.fetch(:name) { name },
12130
+ params.fetch(:name_loc) { name_loc },
12131
+ params.fetch(:value) { value },
12132
+ params.fetch(:location) { location },
12133
+ )
12134
+ end
12135
+
12136
+ # def deconstruct: () -> Array[nil | Node]
12137
+ alias deconstruct child_nodes
12138
+
12139
+ # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
12140
+ def deconstruct_keys(keys)
12141
+ { name: name, name_loc: name_loc, value: value, location: location }
12142
+ end
12143
+
12144
+ # def inspect(inspector: NodeInspector) -> String
12145
+ def inspect(inspector = NodeInspector.new)
12146
+ inspector << inspector.header(self)
12147
+ inspector << "├── name: #{name.inspect}\n"
12148
+ inspector << "├── name_loc: #{inspector.location(name_loc)}\n"
12149
+ inspector << "└── value:\n"
12150
+ inspector << inspector.child_node(value, " ")
12151
+ inspector.to_str
12152
+ end
12153
+
12154
+ # Sometimes you want to check an instance of a node against a list of
12155
+ # classes to see what kind of behavior to perform. Usually this is done by
12156
+ # calling `[cls1, cls2].include?(node.class)` or putting the node into a
12157
+ # case statement and doing `case node; when cls1; when cls2; end`. Both of
12158
+ # these approaches are relatively slow because of the constant lookups,
12159
+ # method calls, and/or array allocations.
12160
+ #
12161
+ # Instead, you can call #type, which will return to you a symbol that you
12162
+ # can use for comparison. This is faster than the other approaches because
12163
+ # it uses a single integer comparison, but also because if you're on CRuby
12164
+ # you can take advantage of the fact that case statements with all symbol
12165
+ # keys will use a jump table.
12166
+ #
12167
+ # def type: () -> Symbol
12168
+ def type
12169
+ :optional_keyword_parameter_node
12170
+ end
12171
+
12172
+ # Similar to #type, this method returns a symbol that you can use for
12173
+ # splitting on the type of the node without having to do a long === chain.
12174
+ # Note that like #type, it will still be slower than using == for a single
12175
+ # class, but should be faster in a case statement or an array comparison.
12176
+ #
12177
+ # def self.type: () -> Symbol
12178
+ def self.type
12179
+ :optional_keyword_parameter_node
12180
+ end
12181
+ end
12182
+
12023
12183
  # Represents an optional parameter to a method, block, or lambda definition.
12024
12184
  #
12025
12185
  # def a(b = 1)
@@ -12091,6 +12251,7 @@ module Prism
12091
12251
  operator_loc.slice
12092
12252
  end
12093
12253
 
12254
+ # def inspect(inspector: NodeInspector) -> String
12094
12255
  def inspect(inspector = NodeInspector.new)
12095
12256
  inspector << inspector.header(self)
12096
12257
  inspector << "├── name: #{name.inspect}\n"
@@ -12195,6 +12356,7 @@ module Prism
12195
12356
  operator_loc.slice
12196
12357
  end
12197
12358
 
12359
+ # def inspect(inspector: NodeInspector) -> String
12198
12360
  def inspect(inspector = NodeInspector.new)
12199
12361
  inspector << inspector.header(self)
12200
12362
  inspector << "├── left:\n"
@@ -12323,6 +12485,7 @@ module Prism
12323
12485
  { requireds: requireds, optionals: optionals, rest: rest, posts: posts, keywords: keywords, keyword_rest: keyword_rest, block: block, location: location }
12324
12486
  end
12325
12487
 
12488
+ # def inspect(inspector: NodeInspector) -> String
12326
12489
  def inspect(inspector = NodeInspector.new)
12327
12490
  inspector << inspector.header(self)
12328
12491
  inspector << "├── requireds: #{inspector.list("#{inspector.prefix}│ ", requireds)}"
@@ -12406,7 +12569,7 @@ module Prism
12406
12569
  visitor.visit_parentheses_node(self)
12407
12570
  end
12408
12571
 
12409
- def set_newline_flag(newline_marked)
12572
+ def set_newline_flag(newline_marked) # :nodoc:
12410
12573
  # Never mark ParenthesesNode with a newline flag, mark children instead
12411
12574
  end
12412
12575
 
@@ -12455,6 +12618,7 @@ module Prism
12455
12618
  closing_loc.slice
12456
12619
  end
12457
12620
 
12621
+ # def inspect(inspector: NodeInspector) -> String
12458
12622
  def inspect(inspector = NodeInspector.new)
12459
12623
  inspector << inspector.header(self)
12460
12624
  if (body = self.body).nil?
@@ -12578,6 +12742,7 @@ module Prism
12578
12742
  rparen_loc.slice
12579
12743
  end
12580
12744
 
12745
+ # def inspect(inspector: NodeInspector) -> String
12581
12746
  def inspect(inspector = NodeInspector.new)
12582
12747
  inspector << inspector.header(self)
12583
12748
  inspector << "├── expression:\n"
@@ -12678,6 +12843,7 @@ module Prism
12678
12843
  operator_loc.slice
12679
12844
  end
12680
12845
 
12846
+ # def inspect(inspector: NodeInspector) -> String
12681
12847
  def inspect(inspector = NodeInspector.new)
12682
12848
  inspector << inspector.header(self)
12683
12849
  inspector << "├── variable:\n"
@@ -12797,6 +12963,7 @@ module Prism
12797
12963
  closing_loc.slice
12798
12964
  end
12799
12965
 
12966
+ # def inspect(inspector: NodeInspector) -> String
12800
12967
  def inspect(inspector = NodeInspector.new)
12801
12968
  inspector << inspector.header(self)
12802
12969
  if (statements = self.statements).nil?
@@ -12922,6 +13089,7 @@ module Prism
12922
13089
  closing_loc.slice
12923
13090
  end
12924
13091
 
13092
+ # def inspect(inspector: NodeInspector) -> String
12925
13093
  def inspect(inspector = NodeInspector.new)
12926
13094
  inspector << inspector.header(self)
12927
13095
  if (statements = self.statements).nil?
@@ -13017,6 +13185,7 @@ module Prism
13017
13185
  { locals: locals, statements: statements, location: location }
13018
13186
  end
13019
13187
 
13188
+ # def inspect(inspector: NodeInspector) -> String
13020
13189
  def inspect(inspector = NodeInspector.new)
13021
13190
  inspector << inspector.header(self)
13022
13191
  inspector << "├── locals: #{locals.inspect}\n"
@@ -13135,6 +13304,7 @@ module Prism
13135
13304
  flags.anybits?(RangeFlags::EXCLUDE_END)
13136
13305
  end
13137
13306
 
13307
+ # def inspect(inspector: NodeInspector) -> String
13138
13308
  def inspect(inspector = NodeInspector.new)
13139
13309
  inspector << inspector.header(self)
13140
13310
  if (left = self.left).nil?
@@ -13234,6 +13404,7 @@ module Prism
13234
13404
  { numeric: numeric, location: location }
13235
13405
  end
13236
13406
 
13407
+ # def inspect(inspector: NodeInspector) -> String
13237
13408
  def inspect(inspector = NodeInspector.new)
13238
13409
  inspector << inspector.header(self)
13239
13410
  inspector << "└── numeric:\n"
@@ -13315,6 +13486,7 @@ module Prism
13315
13486
  { location: location }
13316
13487
  end
13317
13488
 
13489
+ # def inspect(inspector: NodeInspector) -> String
13318
13490
  def inspect(inspector = NodeInspector.new)
13319
13491
  inspector << inspector.header(self)
13320
13492
  inspector.to_str
@@ -13474,6 +13646,7 @@ module Prism
13474
13646
  flags.anybits?(RegularExpressionFlags::UTF_8)
13475
13647
  end
13476
13648
 
13649
+ # def inspect(inspector: NodeInspector) -> String
13477
13650
  def inspect(inspector = NodeInspector.new)
13478
13651
  inspector << inspector.header(self)
13479
13652
  inspector << "├── opening_loc: #{inspector.location(opening_loc)}\n"
@@ -13514,55 +13687,50 @@ module Prism
13514
13687
  end
13515
13688
  end
13516
13689
 
13517
- # Represents a destructured required parameter node.
13690
+ # Represents a required keyword parameter to a method, block, or lambda definition.
13518
13691
  #
13519
- # def foo((bar, baz))
13520
- # ^^^^^^^^^^
13692
+ # def a(b: )
13693
+ # ^^
13521
13694
  # end
13522
- class RequiredDestructuredParameterNode < Node
13523
- # attr_reader parameters: Array[Node]
13524
- attr_reader :parameters
13525
-
13526
- # attr_reader opening_loc: Location
13527
- attr_reader :opening_loc
13695
+ class RequiredKeywordParameterNode < Node
13696
+ # attr_reader name: Symbol
13697
+ attr_reader :name
13528
13698
 
13529
- # attr_reader closing_loc: Location
13530
- attr_reader :closing_loc
13699
+ # attr_reader name_loc: Location
13700
+ attr_reader :name_loc
13531
13701
 
13532
- # def initialize: (parameters: Array[Node], opening_loc: Location, closing_loc: Location, location: Location) -> void
13533
- def initialize(parameters, opening_loc, closing_loc, location)
13534
- @parameters = parameters
13535
- @opening_loc = opening_loc
13536
- @closing_loc = closing_loc
13702
+ # def initialize: (name: Symbol, name_loc: Location, location: Location) -> void
13703
+ def initialize(name, name_loc, location)
13704
+ @name = name
13705
+ @name_loc = name_loc
13537
13706
  @location = location
13538
13707
  end
13539
13708
 
13540
13709
  # def accept: (visitor: Visitor) -> void
13541
13710
  def accept(visitor)
13542
- visitor.visit_required_destructured_parameter_node(self)
13711
+ visitor.visit_required_keyword_parameter_node(self)
13543
13712
  end
13544
13713
 
13545
13714
  # def child_nodes: () -> Array[nil | Node]
13546
13715
  def child_nodes
13547
- [*parameters]
13716
+ []
13548
13717
  end
13549
13718
 
13550
13719
  # def compact_child_nodes: () -> Array[Node]
13551
13720
  def compact_child_nodes
13552
- [*parameters]
13721
+ []
13553
13722
  end
13554
13723
 
13555
13724
  # def comment_targets: () -> Array[Node | Location]
13556
13725
  def comment_targets
13557
- [*parameters, opening_loc, closing_loc]
13726
+ [name_loc]
13558
13727
  end
13559
13728
 
13560
- # def copy: (**params) -> RequiredDestructuredParameterNode
13729
+ # def copy: (**params) -> RequiredKeywordParameterNode
13561
13730
  def copy(**params)
13562
- RequiredDestructuredParameterNode.new(
13563
- params.fetch(:parameters) { parameters },
13564
- params.fetch(:opening_loc) { opening_loc },
13565
- params.fetch(:closing_loc) { closing_loc },
13731
+ RequiredKeywordParameterNode.new(
13732
+ params.fetch(:name) { name },
13733
+ params.fetch(:name_loc) { name_loc },
13566
13734
  params.fetch(:location) { location },
13567
13735
  )
13568
13736
  end
@@ -13572,24 +13740,14 @@ module Prism
13572
13740
 
13573
13741
  # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
13574
13742
  def deconstruct_keys(keys)
13575
- { parameters: parameters, opening_loc: opening_loc, closing_loc: closing_loc, location: location }
13576
- end
13577
-
13578
- # def opening: () -> String
13579
- def opening
13580
- opening_loc.slice
13581
- end
13582
-
13583
- # def closing: () -> String
13584
- def closing
13585
- closing_loc.slice
13743
+ { name: name, name_loc: name_loc, location: location }
13586
13744
  end
13587
13745
 
13746
+ # def inspect(inspector: NodeInspector) -> String
13588
13747
  def inspect(inspector = NodeInspector.new)
13589
13748
  inspector << inspector.header(self)
13590
- inspector << "├── parameters: #{inspector.list("#{inspector.prefix}", parameters)}"
13591
- inspector << "├── opening_loc: #{inspector.location(opening_loc)}\n"
13592
- inspector << "└── closing_loc: #{inspector.location(closing_loc)}\n"
13749
+ inspector << "├── name: #{name.inspect}\n"
13750
+ inspector << "└── name_loc: #{inspector.location(name_loc)}\n"
13593
13751
  inspector.to_str
13594
13752
  end
13595
13753
 
@@ -13608,7 +13766,7 @@ module Prism
13608
13766
  #
13609
13767
  # def type: () -> Symbol
13610
13768
  def type
13611
- :required_destructured_parameter_node
13769
+ :required_keyword_parameter_node
13612
13770
  end
13613
13771
 
13614
13772
  # Similar to #type, this method returns a symbol that you can use for
@@ -13618,7 +13776,7 @@ module Prism
13618
13776
  #
13619
13777
  # def self.type: () -> Symbol
13620
13778
  def self.type
13621
- :required_destructured_parameter_node
13779
+ :required_keyword_parameter_node
13622
13780
  end
13623
13781
  end
13624
13782
 
@@ -13673,6 +13831,7 @@ module Prism
13673
13831
  { name: name, location: location }
13674
13832
  end
13675
13833
 
13834
+ # def inspect(inspector: NodeInspector) -> String
13676
13835
  def inspect(inspector = NodeInspector.new)
13677
13836
  inspector << inspector.header(self)
13678
13837
  inspector << "└── name: #{name.inspect}\n"
@@ -13710,8 +13869,8 @@ module Prism
13710
13869
 
13711
13870
  # Represents an expression modified with a rescue.
13712
13871
  #
13713
- # foo rescue nil
13714
- # ^^^^^^^^^^^^^^
13872
+ # foo rescue nil
13873
+ # ^^^^^^^^^^^^^^
13715
13874
  class RescueModifierNode < Node
13716
13875
  # attr_reader expression: Node
13717
13876
  attr_reader :expression
@@ -13735,7 +13894,7 @@ module Prism
13735
13894
  visitor.visit_rescue_modifier_node(self)
13736
13895
  end
13737
13896
 
13738
- def set_newline_flag(newline_marked)
13897
+ def set_newline_flag(newline_marked) # :nodoc:
13739
13898
  expression.set_newline_flag(newline_marked)
13740
13899
  end
13741
13900
 
@@ -13777,6 +13936,7 @@ module Prism
13777
13936
  keyword_loc.slice
13778
13937
  end
13779
13938
 
13939
+ # def inspect(inspector: NodeInspector) -> String
13780
13940
  def inspect(inspector = NodeInspector.new)
13781
13941
  inspector << inspector.header(self)
13782
13942
  inspector << "├── expression:\n"
@@ -13820,8 +13980,8 @@ module Prism
13820
13980
  #
13821
13981
  # begin
13822
13982
  # rescue Foo, *splat, Bar => ex
13823
- # ^^^^^^
13824
13983
  # foo
13984
+ # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
13825
13985
  # end
13826
13986
  #
13827
13987
  # `Foo, *splat, Bar` are in the `exceptions` field.
@@ -13912,6 +14072,7 @@ module Prism
13912
14072
  operator_loc&.slice
13913
14073
  end
13914
14074
 
14075
+ # def inspect(inspector: NodeInspector) -> String
13915
14076
  def inspect(inspector = NodeInspector.new)
13916
14077
  inspector << inspector.header(self)
13917
14078
  inspector << "├── keyword_loc: #{inspector.location(keyword_loc)}\n"
@@ -14033,9 +14194,14 @@ module Prism
14033
14194
  operator_loc.slice
14034
14195
  end
14035
14196
 
14197
+ # def inspect(inspector: NodeInspector) -> String
14036
14198
  def inspect(inspector = NodeInspector.new)
14037
14199
  inspector << inspector.header(self)
14038
- inspector << "├── name: #{name.inspect}\n"
14200
+ if (name = self.name).nil?
14201
+ inspector << "├── name: ∅\n"
14202
+ else
14203
+ inspector << "├── name: #{name.inspect}\n"
14204
+ end
14039
14205
  inspector << "├── name_loc: #{inspector.location(name_loc)}\n"
14040
14206
  inspector << "└── operator_loc: #{inspector.location(operator_loc)}\n"
14041
14207
  inspector.to_str
@@ -14115,6 +14281,7 @@ module Prism
14115
14281
  { location: location }
14116
14282
  end
14117
14283
 
14284
+ # def inspect(inspector: NodeInspector) -> String
14118
14285
  def inspect(inspector = NodeInspector.new)
14119
14286
  inspector << inspector.header(self)
14120
14287
  inspector.to_str
@@ -14211,6 +14378,7 @@ module Prism
14211
14378
  keyword_loc.slice
14212
14379
  end
14213
14380
 
14381
+ # def inspect(inspector: NodeInspector) -> String
14214
14382
  def inspect(inspector = NodeInspector.new)
14215
14383
  inspector << inspector.header(self)
14216
14384
  inspector << "├── keyword_loc: #{inspector.location(keyword_loc)}\n"
@@ -14297,6 +14465,7 @@ module Prism
14297
14465
  { location: location }
14298
14466
  end
14299
14467
 
14468
+ # def inspect(inspector: NodeInspector) -> String
14300
14469
  def inspect(inspector = NodeInspector.new)
14301
14470
  inspector << inspector.header(self)
14302
14471
  inspector.to_str
@@ -14424,6 +14593,7 @@ module Prism
14424
14593
  end_keyword_loc.slice
14425
14594
  end
14426
14595
 
14596
+ # def inspect(inspector: NodeInspector) -> String
14427
14597
  def inspect(inspector = NodeInspector.new)
14428
14598
  inspector << inspector.header(self)
14429
14599
  inspector << "├── locals: #{locals.inspect}\n"
@@ -14515,6 +14685,7 @@ module Prism
14515
14685
  { location: location }
14516
14686
  end
14517
14687
 
14688
+ # def inspect(inspector: NodeInspector) -> String
14518
14689
  def inspect(inspector = NodeInspector.new)
14519
14690
  inspector << inspector.header(self)
14520
14691
  inspector.to_str
@@ -14599,6 +14770,7 @@ module Prism
14599
14770
  { filepath: filepath, location: location }
14600
14771
  end
14601
14772
 
14773
+ # def inspect(inspector: NodeInspector) -> String
14602
14774
  def inspect(inspector = NodeInspector.new)
14603
14775
  inspector << inspector.header(self)
14604
14776
  inspector << "└── filepath: #{filepath.inspect}\n"
@@ -14679,6 +14851,7 @@ module Prism
14679
14851
  { location: location }
14680
14852
  end
14681
14853
 
14854
+ # def inspect(inspector: NodeInspector) -> String
14682
14855
  def inspect(inspector = NodeInspector.new)
14683
14856
  inspector << inspector.header(self)
14684
14857
  inspector.to_str
@@ -14775,6 +14948,7 @@ module Prism
14775
14948
  operator_loc.slice
14776
14949
  end
14777
14950
 
14951
+ # def inspect(inspector: NodeInspector) -> String
14778
14952
  def inspect(inspector = NodeInspector.new)
14779
14953
  inspector << inspector.header(self)
14780
14954
  inspector << "├── operator_loc: #{inspector.location(operator_loc)}\n"
@@ -14866,6 +15040,7 @@ module Prism
14866
15040
  { body: body, location: location }
14867
15041
  end
14868
15042
 
15043
+ # def inspect(inspector: NodeInspector) -> String
14869
15044
  def inspect(inspector = NodeInspector.new)
14870
15045
  inspector << inspector.header(self)
14871
15046
  inspector << "└── body: #{inspector.list("#{inspector.prefix} ", body)}"
@@ -14956,6 +15131,7 @@ module Prism
14956
15131
  { left: left, right: right, location: location }
14957
15132
  end
14958
15133
 
15134
+ # def inspect(inspector: NodeInspector) -> String
14959
15135
  def inspect(inspector = NodeInspector.new)
14960
15136
  inspector << inspector.header(self)
14961
15137
  inspector << "├── left:\n"
@@ -15091,6 +15267,7 @@ module Prism
15091
15267
  closing_loc&.slice
15092
15268
  end
15093
15269
 
15270
+ # def inspect(inspector: NodeInspector) -> String
15094
15271
  def inspect(inspector = NodeInspector.new)
15095
15272
  inspector << inspector.header(self)
15096
15273
  flags = [("frozen" if frozen?)].compact
@@ -15222,6 +15399,7 @@ module Prism
15222
15399
  rparen_loc&.slice
15223
15400
  end
15224
15401
 
15402
+ # def inspect(inspector: NodeInspector) -> String
15225
15403
  def inspect(inspector = NodeInspector.new)
15226
15404
  inspector << inspector.header(self)
15227
15405
  inspector << "├── keyword_loc: #{inspector.location(keyword_loc)}\n"
@@ -15354,6 +15532,7 @@ module Prism
15354
15532
  closing_loc&.slice
15355
15533
  end
15356
15534
 
15535
+ # def inspect(inspector: NodeInspector) -> String
15357
15536
  def inspect(inspector = NodeInspector.new)
15358
15537
  inspector << inspector.header(self)
15359
15538
  inspector << "├── opening_loc: #{inspector.location(opening_loc)}\n"
@@ -15437,6 +15616,7 @@ module Prism
15437
15616
  { location: location }
15438
15617
  end
15439
15618
 
15619
+ # def inspect(inspector: NodeInspector) -> String
15440
15620
  def inspect(inspector = NodeInspector.new)
15441
15621
  inspector << inspector.header(self)
15442
15622
  inspector.to_str
@@ -15531,6 +15711,7 @@ module Prism
15531
15711
  keyword_loc.slice
15532
15712
  end
15533
15713
 
15714
+ # def inspect(inspector: NodeInspector) -> String
15534
15715
  def inspect(inspector = NodeInspector.new)
15535
15716
  inspector << inspector.header(self)
15536
15717
  inspector << "├── names: #{inspector.list("#{inspector.prefix}│ ", names)}"
@@ -15605,7 +15786,7 @@ module Prism
15605
15786
  visitor.visit_unless_node(self)
15606
15787
  end
15607
15788
 
15608
- def set_newline_flag(newline_marked)
15789
+ def set_newline_flag(newline_marked) # :nodoc:
15609
15790
  predicate.set_newline_flag(newline_marked)
15610
15791
  end
15611
15792
 
@@ -15658,6 +15839,7 @@ module Prism
15658
15839
  end_keyword_loc&.slice
15659
15840
  end
15660
15841
 
15842
+ # def inspect(inspector: NodeInspector) -> String
15661
15843
  def inspect(inspector = NodeInspector.new)
15662
15844
  inspector << inspector.header(self)
15663
15845
  inspector << "├── keyword_loc: #{inspector.location(keyword_loc)}\n"
@@ -15746,7 +15928,7 @@ module Prism
15746
15928
  visitor.visit_until_node(self)
15747
15929
  end
15748
15930
 
15749
- def set_newline_flag(newline_marked)
15931
+ def set_newline_flag(newline_marked) # :nodoc:
15750
15932
  predicate.set_newline_flag(newline_marked)
15751
15933
  end
15752
15934
 
@@ -15803,6 +15985,7 @@ module Prism
15803
15985
  flags.anybits?(LoopFlags::BEGIN_MODIFIER)
15804
15986
  end
15805
15987
 
15988
+ # def inspect(inspector: NodeInspector) -> String
15806
15989
  def inspect(inspector = NodeInspector.new)
15807
15990
  inspector << inspector.header(self)
15808
15991
  inspector << "├── keyword_loc: #{inspector.location(keyword_loc)}\n"
@@ -15919,6 +16102,7 @@ module Prism
15919
16102
  keyword_loc.slice
15920
16103
  end
15921
16104
 
16105
+ # def inspect(inspector: NodeInspector) -> String
15922
16106
  def inspect(inspector = NodeInspector.new)
15923
16107
  inspector << inspector.header(self)
15924
16108
  inspector << "├── keyword_loc: #{inspector.location(keyword_loc)}\n"
@@ -15999,7 +16183,7 @@ module Prism
15999
16183
  visitor.visit_while_node(self)
16000
16184
  end
16001
16185
 
16002
- def set_newline_flag(newline_marked)
16186
+ def set_newline_flag(newline_marked) # :nodoc:
16003
16187
  predicate.set_newline_flag(newline_marked)
16004
16188
  end
16005
16189
 
@@ -16056,6 +16240,7 @@ module Prism
16056
16240
  flags.anybits?(LoopFlags::BEGIN_MODIFIER)
16057
16241
  end
16058
16242
 
16243
+ # def inspect(inspector: NodeInspector) -> String
16059
16244
  def inspect(inspector = NodeInspector.new)
16060
16245
  inspector << inspector.header(self)
16061
16246
  inspector << "├── keyword_loc: #{inspector.location(keyword_loc)}\n"
@@ -16182,6 +16367,7 @@ module Prism
16182
16367
  closing_loc.slice
16183
16368
  end
16184
16369
 
16370
+ # def inspect(inspector: NodeInspector) -> String
16185
16371
  def inspect(inspector = NodeInspector.new)
16186
16372
  inspector << inspector.header(self)
16187
16373
  inspector << "├── opening_loc: #{inspector.location(opening_loc)}\n"
@@ -16302,6 +16488,7 @@ module Prism
16302
16488
  rparen_loc&.slice
16303
16489
  end
16304
16490
 
16491
+ # def inspect(inspector: NodeInspector) -> String
16305
16492
  def inspect(inspector = NodeInspector.new)
16306
16493
  inspector << inspector.header(self)
16307
16494
  inspector << "├── keyword_loc: #{inspector.location(keyword_loc)}\n"
@@ -16345,6 +16532,13 @@ module Prism
16345
16532
  end
16346
16533
  end
16347
16534
 
16535
+ # Flags for arguments nodes.
16536
+ module ArgumentsNodeFlags
16537
+ # if arguments contain keyword splat
16538
+ KEYWORD_SPLAT = 1 << 0
16539
+ end
16540
+
16541
+ # Flags for call nodes.
16348
16542
  module CallNodeFlags
16349
16543
  # &. operator
16350
16544
  SAFE_NAVIGATION = 1 << 0
@@ -16353,6 +16547,7 @@ module Prism
16353
16547
  VARIABLE_CALL = 1 << 1
16354
16548
  end
16355
16549
 
16550
+ # Flags for integer nodes that correspond to the base of the integer.
16356
16551
  module IntegerBaseFlags
16357
16552
  # 0b prefix
16358
16553
  BINARY = 1 << 0
@@ -16367,16 +16562,19 @@ module Prism
16367
16562
  HEXADECIMAL = 1 << 3
16368
16563
  end
16369
16564
 
16565
+ # Flags for while and until loop nodes.
16370
16566
  module LoopFlags
16371
16567
  # a loop after a begin statement, so the body is executed first before the condition
16372
16568
  BEGIN_MODIFIER = 1 << 0
16373
16569
  end
16374
16570
 
16571
+ # Flags for range and flip-flop nodes.
16375
16572
  module RangeFlags
16376
16573
  # ... operator
16377
16574
  EXCLUDE_END = 1 << 0
16378
16575
  end
16379
16576
 
16577
+ # Flags for regular expression and match last line nodes.
16380
16578
  module RegularExpressionFlags
16381
16579
  # i - ignores the case of characters when matching
16382
16580
  IGNORE_CASE = 1 << 0
@@ -16403,6 +16601,7 @@ module Prism
16403
16601
  UTF_8 = 1 << 7
16404
16602
  end
16405
16603
 
16604
+ # Flags for string nodes.
16406
16605
  module StringFlags
16407
16606
  # frozen by virtue of a `frozen_string_literal` comment
16408
16607
  FROZEN = 1 << 0