prism 1.2.0 → 1.4.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 (68) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +46 -1
  3. data/Makefile +1 -1
  4. data/config.yml +429 -2
  5. data/docs/build_system.md +8 -11
  6. data/docs/releasing.md +1 -1
  7. data/docs/relocation.md +34 -0
  8. data/docs/ruby_api.md +1 -1
  9. data/ext/prism/api_node.c +1824 -1305
  10. data/ext/prism/extconf.rb +13 -36
  11. data/ext/prism/extension.c +298 -109
  12. data/ext/prism/extension.h +4 -4
  13. data/include/prism/ast.h +442 -2
  14. data/include/prism/defines.h +26 -8
  15. data/include/prism/options.h +47 -1
  16. data/include/prism/util/pm_buffer.h +10 -0
  17. data/include/prism/version.h +2 -2
  18. data/include/prism.h +51 -4
  19. data/lib/prism/dot_visitor.rb +26 -0
  20. data/lib/prism/dsl.rb +14 -6
  21. data/lib/prism/ffi.rb +93 -28
  22. data/lib/prism/inspect_visitor.rb +4 -1
  23. data/lib/prism/node.rb +1886 -105
  24. data/lib/prism/parse_result/errors.rb +1 -1
  25. data/lib/prism/parse_result/newlines.rb +1 -1
  26. data/lib/prism/parse_result.rb +54 -2
  27. data/lib/prism/polyfill/append_as_bytes.rb +15 -0
  28. data/lib/prism/reflection.rb +4 -4
  29. data/lib/prism/relocation.rb +504 -0
  30. data/lib/prism/serialize.rb +1252 -765
  31. data/lib/prism/string_query.rb +30 -0
  32. data/lib/prism/translation/parser/builder.rb +61 -0
  33. data/lib/prism/translation/parser/compiler.rb +228 -162
  34. data/lib/prism/translation/parser/lexer.rb +435 -61
  35. data/lib/prism/translation/parser.rb +51 -3
  36. data/lib/prism/translation/parser35.rb +12 -0
  37. data/lib/prism/translation/ripper.rb +13 -3
  38. data/lib/prism/translation/ruby_parser.rb +17 -7
  39. data/lib/prism/translation.rb +1 -0
  40. data/lib/prism.rb +9 -7
  41. data/prism.gemspec +11 -1
  42. data/rbi/prism/dsl.rbi +10 -7
  43. data/rbi/prism/node.rbi +44 -17
  44. data/rbi/prism/parse_result.rbi +17 -0
  45. data/rbi/prism/string_query.rbi +12 -0
  46. data/rbi/prism/translation/parser35.rbi +6 -0
  47. data/rbi/prism.rbi +39 -36
  48. data/sig/prism/dsl.rbs +6 -4
  49. data/sig/prism/node.rbs +29 -15
  50. data/sig/prism/parse_result.rbs +10 -0
  51. data/sig/prism/relocation.rbs +185 -0
  52. data/sig/prism/serialize.rbs +4 -2
  53. data/sig/prism/string_query.rbs +11 -0
  54. data/sig/prism.rbs +22 -1
  55. data/src/diagnostic.c +2 -2
  56. data/src/node.c +39 -0
  57. data/src/options.c +31 -0
  58. data/src/prettyprint.c +62 -0
  59. data/src/prism.c +738 -199
  60. data/src/regexp.c +7 -3
  61. data/src/serialize.c +18 -0
  62. data/src/static_literals.c +1 -1
  63. data/src/util/pm_buffer.c +40 -0
  64. data/src/util/pm_char.c +1 -1
  65. data/src/util/pm_constant_pool.c +6 -2
  66. data/src/util/pm_string.c +1 -0
  67. data/src/util/pm_strncasecmp.c +13 -1
  68. metadata +13 -7
data/lib/prism/node.rb CHANGED
@@ -20,6 +20,11 @@ module Prism
20
20
  # will be consistent across multiple parses of the same source code.
21
21
  attr_reader :node_id
22
22
 
23
+ # Save this node using a saved source so that it can be retrieved later.
24
+ def save(repository)
25
+ repository.enter(node_id, :itself)
26
+ end
27
+
23
28
  # A Location instance that represents the location of this node in the
24
29
  # source.
25
30
  def location
@@ -28,6 +33,21 @@ module Prism
28
33
  @location = Location.new(source, location >> 32, location & 0xFFFFFFFF)
29
34
  end
30
35
 
36
+ # Save the location using a saved source so that it can be retrieved later.
37
+ def save_location(repository)
38
+ repository.enter(node_id, :location)
39
+ end
40
+
41
+ # Delegates to the start_line of the associated location object.
42
+ def start_line
43
+ location.start_line
44
+ end
45
+
46
+ # Delegates to the end_line of the associated location object.
47
+ def end_line
48
+ location.end_line
49
+ end
50
+
31
51
  # The start offset of the node in the source. This method is effectively a
32
52
  # delegate method to the location object.
33
53
  def start_offset
@@ -42,6 +62,75 @@ module Prism
42
62
  location.is_a?(Location) ? location.end_offset : ((location >> 32) + (location & 0xFFFFFFFF))
43
63
  end
44
64
 
65
+ # Delegates to the start_character_offset of the associated location object.
66
+ def start_character_offset
67
+ location.start_character_offset
68
+ end
69
+
70
+ # Delegates to the end_character_offset of the associated location object.
71
+ def end_character_offset
72
+ location.end_character_offset
73
+ end
74
+
75
+ # Delegates to the cached_start_code_units_offset of the associated location
76
+ # object.
77
+ def cached_start_code_units_offset(cache)
78
+ location.cached_start_code_units_offset(cache)
79
+ end
80
+
81
+ # Delegates to the cached_end_code_units_offset of the associated location
82
+ # object.
83
+ def cached_end_code_units_offset(cache)
84
+ location.cached_end_code_units_offset(cache)
85
+ end
86
+
87
+ # Delegates to the start_column of the associated location object.
88
+ def start_column
89
+ location.start_column
90
+ end
91
+
92
+ # Delegates to the end_column of the associated location object.
93
+ def end_column
94
+ location.end_column
95
+ end
96
+
97
+ # Delegates to the start_character_column of the associated location object.
98
+ def start_character_column
99
+ location.start_character_column
100
+ end
101
+
102
+ # Delegates to the end_character_column of the associated location object.
103
+ def end_character_column
104
+ location.end_character_column
105
+ end
106
+
107
+ # Delegates to the cached_start_code_units_column of the associated location
108
+ # object.
109
+ def cached_start_code_units_column(cache)
110
+ location.cached_start_code_units_column(cache)
111
+ end
112
+
113
+ # Delegates to the cached_end_code_units_column of the associated location
114
+ # object.
115
+ def cached_end_code_units_column(cache)
116
+ location.cached_end_code_units_column(cache)
117
+ end
118
+
119
+ # Delegates to the leading_comments of the associated location object.
120
+ def leading_comments
121
+ location.leading_comments
122
+ end
123
+
124
+ # Delegates to the trailing_comments of the associated location object.
125
+ def trailing_comments
126
+ location.trailing_comments
127
+ end
128
+
129
+ # Delegates to the comments of the associated location object.
130
+ def comments
131
+ location.comments
132
+ end
133
+
45
134
  # Returns all of the lines of the source code associated with this node.
46
135
  def source_lines
47
136
  location.source_lines
@@ -101,7 +190,7 @@ module Prism
101
190
  # bytes, as opposed to characters or code units.
102
191
  def tunnel(line, column)
103
192
  queue = [self] #: Array[Prism::node]
104
- result = []
193
+ result = [] #: Array[Prism::node]
105
194
 
106
195
  while (node = queue.shift)
107
196
  result << node
@@ -291,6 +380,12 @@ module Prism
291
380
  @keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
292
381
  end
293
382
 
383
+ # Save the keyword_loc location using the given saved source so that
384
+ # it can be retrieved later.
385
+ def save_keyword_loc(repository)
386
+ repository.enter(node_id, :keyword_loc)
387
+ end
388
+
294
389
  # def keyword: () -> String
295
390
  def keyword
296
391
  keyword_loc.slice
@@ -394,13 +489,22 @@ module Prism
394
489
  # ^^^^^^^^^
395
490
  attr_reader :old_name
396
491
 
397
- # attr_reader keyword_loc: Location
492
+ # Represents the location of the `alias` keyword.
493
+ #
494
+ # alias foo bar
495
+ # ^^^^^
398
496
  def keyword_loc
399
497
  location = @keyword_loc
400
498
  return location if location.is_a?(Location)
401
499
  @keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
402
500
  end
403
501
 
502
+ # Save the keyword_loc location using the given saved source so that
503
+ # it can be retrieved later.
504
+ def save_keyword_loc(repository)
505
+ repository.enter(node_id, :keyword_loc)
506
+ end
507
+
404
508
  # def keyword: () -> String
405
509
  def keyword
406
510
  keyword_loc.slice
@@ -502,6 +606,12 @@ module Prism
502
606
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
503
607
  end
504
608
 
609
+ # Save the operator_loc location using the given saved source so that
610
+ # it can be retrieved later.
611
+ def save_operator_loc(repository)
612
+ repository.enter(node_id, :operator_loc)
613
+ end
614
+
505
615
  # def operator: () -> String
506
616
  def operator
507
617
  operator_loc.slice
@@ -609,6 +719,12 @@ module Prism
609
719
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
610
720
  end
611
721
 
722
+ # Save the operator_loc location using the given saved source so that
723
+ # it can be retrieved later.
724
+ def save_operator_loc(repository)
725
+ repository.enter(node_id, :operator_loc)
726
+ end
727
+
612
728
  # def operator: () -> String
613
729
  def operator
614
730
  operator_loc.slice
@@ -711,7 +827,10 @@ module Prism
711
827
  flags.anybits?(ArgumentsNodeFlags::CONTAINS_MULTIPLE_SPLATS)
712
828
  end
713
829
 
714
- # attr_reader arguments: Array[Prism::node]
830
+ # The list of arguments, if present. These can be any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
831
+ #
832
+ # foo(bar, baz)
833
+ # ^^^^^^^^
715
834
  attr_reader :arguments
716
835
 
717
836
  # def inspect -> String
@@ -814,6 +933,12 @@ module Prism
814
933
  end
815
934
  end
816
935
 
936
+ # Save the opening_loc location using the given saved source so that
937
+ # it can be retrieved later.
938
+ def save_opening_loc(repository)
939
+ repository.enter(node_id, :opening_loc) unless @opening_loc.nil?
940
+ end
941
+
817
942
  # Represents the optional source location for the closing token.
818
943
  #
819
944
  # [1,2,3] # "]"
@@ -832,6 +957,12 @@ module Prism
832
957
  end
833
958
  end
834
959
 
960
+ # Save the closing_loc location using the given saved source so that
961
+ # it can be retrieved later.
962
+ def save_closing_loc(repository)
963
+ repository.enter(node_id, :closing_loc) unless @closing_loc.nil?
964
+ end
965
+
835
966
  # def opening: () -> String?
836
967
  def opening
837
968
  opening_loc&.slice
@@ -877,8 +1008,8 @@ module Prism
877
1008
  # foo in [1, 2]
878
1009
  # ^^^^^^^^^^^^^
879
1010
  #
880
- # foo in *1
881
- # ^^^^^^^^^
1011
+ # foo in *bar
1012
+ # ^^^^^^^^^^^
882
1013
  #
883
1014
  # foo in Bar[]
884
1015
  # ^^^^^^^^^^^^
@@ -941,16 +1072,28 @@ module Prism
941
1072
  # attr_reader constant: ConstantReadNode | ConstantPathNode | nil
942
1073
  attr_reader :constant
943
1074
 
944
- # attr_reader requireds: Array[Prism::node]
1075
+ # Represents the required elements of the array pattern.
1076
+ #
1077
+ # foo in [1, 2]
1078
+ # ^ ^
945
1079
  attr_reader :requireds
946
1080
 
947
- # attr_reader rest: Prism::node?
1081
+ # Represents the rest element of the array pattern.
1082
+ #
1083
+ # foo in *bar
1084
+ # ^^^^
948
1085
  attr_reader :rest
949
1086
 
950
- # attr_reader posts: Array[Prism::node]
1087
+ # Represents the elements after the rest element of the array pattern.
1088
+ #
1089
+ # foo in *bar, baz
1090
+ # ^^^
951
1091
  attr_reader :posts
952
1092
 
953
- # attr_reader opening_loc: Location?
1093
+ # Represents the opening location of the array pattern.
1094
+ #
1095
+ # foo in [1, 2]
1096
+ # ^
954
1097
  def opening_loc
955
1098
  location = @opening_loc
956
1099
  case location
@@ -963,7 +1106,16 @@ module Prism
963
1106
  end
964
1107
  end
965
1108
 
966
- # attr_reader closing_loc: Location?
1109
+ # Save the opening_loc location using the given saved source so that
1110
+ # it can be retrieved later.
1111
+ def save_opening_loc(repository)
1112
+ repository.enter(node_id, :opening_loc) unless @opening_loc.nil?
1113
+ end
1114
+
1115
+ # Represents the closing location of the array pattern.
1116
+ #
1117
+ # foo in [1, 2]
1118
+ # ^
967
1119
  def closing_loc
968
1120
  location = @closing_loc
969
1121
  case location
@@ -976,6 +1128,12 @@ module Prism
976
1128
  end
977
1129
  end
978
1130
 
1131
+ # Save the closing_loc location using the given saved source so that
1132
+ # it can be retrieved later.
1133
+ def save_closing_loc(repository)
1134
+ repository.enter(node_id, :closing_loc) unless @closing_loc.nil?
1135
+ end
1136
+
979
1137
  # def opening: () -> String?
980
1138
  def opening
981
1139
  opening_loc&.slice
@@ -1102,6 +1260,12 @@ module Prism
1102
1260
  end
1103
1261
  end
1104
1262
 
1263
+ # Save the operator_loc location using the given saved source so that
1264
+ # it can be retrieved later.
1265
+ def save_operator_loc(repository)
1266
+ repository.enter(node_id, :operator_loc) unless @operator_loc.nil?
1267
+ end
1268
+
1105
1269
  # def operator: () -> String?
1106
1270
  def operator
1107
1271
  operator_loc&.slice
@@ -1198,6 +1362,12 @@ module Prism
1198
1362
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
1199
1363
  end
1200
1364
 
1365
+ # Save the operator_loc location using the given saved source so that
1366
+ # it can be retrieved later.
1367
+ def save_operator_loc(repository)
1368
+ repository.enter(node_id, :operator_loc)
1369
+ end
1370
+
1201
1371
  # def operator: () -> String
1202
1372
  def operator
1203
1373
  operator_loc.slice
@@ -1363,7 +1533,10 @@ module Prism
1363
1533
  { node_id: node_id, location: location, begin_keyword_loc: begin_keyword_loc, statements: statements, rescue_clause: rescue_clause, else_clause: else_clause, ensure_clause: ensure_clause, end_keyword_loc: end_keyword_loc }
1364
1534
  end
1365
1535
 
1366
- # attr_reader begin_keyword_loc: Location?
1536
+ # Represents the location of the `begin` keyword.
1537
+ #
1538
+ # begin x end
1539
+ # ^^^^^
1367
1540
  def begin_keyword_loc
1368
1541
  location = @begin_keyword_loc
1369
1542
  case location
@@ -1376,19 +1549,40 @@ module Prism
1376
1549
  end
1377
1550
  end
1378
1551
 
1379
- # attr_reader statements: StatementsNode?
1552
+ # Save the begin_keyword_loc location using the given saved source so that
1553
+ # it can be retrieved later.
1554
+ def save_begin_keyword_loc(repository)
1555
+ repository.enter(node_id, :begin_keyword_loc) unless @begin_keyword_loc.nil?
1556
+ end
1557
+
1558
+ # Represents the statements within the begin block.
1559
+ #
1560
+ # begin x end
1561
+ # ^
1380
1562
  attr_reader :statements
1381
1563
 
1382
- # attr_reader rescue_clause: RescueNode?
1564
+ # Represents the rescue clause within the begin block.
1565
+ #
1566
+ # begin x; rescue y; end
1567
+ # ^^^^^^^^
1383
1568
  attr_reader :rescue_clause
1384
1569
 
1385
- # attr_reader else_clause: ElseNode?
1570
+ # Represents the else clause within the begin block.
1571
+ #
1572
+ # begin x; rescue y; else z; end
1573
+ # ^^^^^^
1386
1574
  attr_reader :else_clause
1387
1575
 
1388
- # attr_reader ensure_clause: EnsureNode?
1576
+ # Represents the ensure clause within the begin block.
1577
+ #
1578
+ # begin x; ensure y; end
1579
+ # ^^^^^^^^
1389
1580
  attr_reader :ensure_clause
1390
1581
 
1391
- # attr_reader end_keyword_loc: Location?
1582
+ # Represents the location of the `end` keyword.
1583
+ #
1584
+ # begin x end
1585
+ # ^^^
1392
1586
  def end_keyword_loc
1393
1587
  location = @end_keyword_loc
1394
1588
  case location
@@ -1401,6 +1595,12 @@ module Prism
1401
1595
  end
1402
1596
  end
1403
1597
 
1598
+ # Save the end_keyword_loc location using the given saved source so that
1599
+ # it can be retrieved later.
1600
+ def save_end_keyword_loc(repository)
1601
+ repository.enter(node_id, :end_keyword_loc) unless @end_keyword_loc.nil?
1602
+ end
1603
+
1404
1604
  # def begin_keyword: () -> String?
1405
1605
  def begin_keyword
1406
1606
  begin_keyword_loc&.slice
@@ -1489,16 +1689,28 @@ module Prism
1489
1689
  { node_id: node_id, location: location, expression: expression, operator_loc: operator_loc }
1490
1690
  end
1491
1691
 
1492
- # attr_reader expression: Prism::node?
1692
+ # The expression that is being passed as a block argument. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
1693
+ #
1694
+ # foo(&args)
1695
+ # ^^^^^
1493
1696
  attr_reader :expression
1494
1697
 
1495
- # attr_reader operator_loc: Location
1698
+ # Represents the location of the `&` operator.
1699
+ #
1700
+ # foo(&args)
1701
+ # ^
1496
1702
  def operator_loc
1497
1703
  location = @operator_loc
1498
1704
  return location if location.is_a?(Location)
1499
1705
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
1500
1706
  end
1501
1707
 
1708
+ # Save the operator_loc location using the given saved source so that
1709
+ # it can be retrieved later.
1710
+ def save_operator_loc(repository)
1711
+ repository.enter(node_id, :operator_loc)
1712
+ end
1713
+
1502
1714
  # def operator: () -> String
1503
1715
  def operator
1504
1716
  operator_loc.slice
@@ -1580,7 +1792,10 @@ module Prism
1580
1792
  flags.anybits?(ParameterFlags::REPEATED_PARAMETER)
1581
1793
  end
1582
1794
 
1583
- # attr_reader name: Symbol
1795
+ # The name of the block local variable.
1796
+ #
1797
+ # a { |; b| } # name `:b`
1798
+ # ^
1584
1799
  attr_reader :name
1585
1800
 
1586
1801
  # def inspect -> String
@@ -1661,29 +1876,60 @@ module Prism
1661
1876
  { node_id: node_id, location: location, locals: locals, parameters: parameters, body: body, opening_loc: opening_loc, closing_loc: closing_loc }
1662
1877
  end
1663
1878
 
1664
- # attr_reader locals: Array[Symbol]
1879
+ # The local variables declared in the block.
1880
+ #
1881
+ # [1, 2, 3].each { |i| puts x } # locals: [:i]
1882
+ # ^
1665
1883
  attr_reader :locals
1666
1884
 
1667
- # attr_reader parameters: BlockParametersNode | NumberedParametersNode | ItParametersNode | nil
1885
+ # The parameters of the block.
1886
+ #
1887
+ # [1, 2, 3].each { |i| puts x }
1888
+ # ^^^
1889
+ # [1, 2, 3].each { puts _1 }
1890
+ # ^^^^^^^^^^^
1891
+ # [1, 2, 3].each { puts it }
1892
+ # ^^^^^^^^^^^
1668
1893
  attr_reader :parameters
1669
1894
 
1670
- # attr_reader body: StatementsNode | BeginNode | nil
1895
+ # The body of the block.
1896
+ #
1897
+ # [1, 2, 3].each { |i| puts x }
1898
+ # ^^^^^^
1671
1899
  attr_reader :body
1672
1900
 
1673
- # attr_reader opening_loc: Location
1901
+ # Represents the location of the opening `|`.
1902
+ #
1903
+ # [1, 2, 3].each { |i| puts x }
1904
+ # ^
1674
1905
  def opening_loc
1675
1906
  location = @opening_loc
1676
1907
  return location if location.is_a?(Location)
1677
1908
  @opening_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
1678
1909
  end
1679
1910
 
1680
- # attr_reader closing_loc: Location
1911
+ # Save the opening_loc location using the given saved source so that
1912
+ # it can be retrieved later.
1913
+ def save_opening_loc(repository)
1914
+ repository.enter(node_id, :opening_loc)
1915
+ end
1916
+
1917
+ # Represents the location of the closing `|`.
1918
+ #
1919
+ # [1, 2, 3].each { |i| puts x }
1920
+ # ^
1681
1921
  def closing_loc
1682
1922
  location = @closing_loc
1683
1923
  return location if location.is_a?(Location)
1684
1924
  @closing_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
1685
1925
  end
1686
1926
 
1927
+ # Save the closing_loc location using the given saved source so that
1928
+ # it can be retrieved later.
1929
+ def save_closing_loc(repository)
1930
+ repository.enter(node_id, :closing_loc)
1931
+ end
1932
+
1687
1933
  # def opening: () -> String
1688
1934
  def opening
1689
1935
  opening_loc.slice
@@ -1777,10 +2023,17 @@ module Prism
1777
2023
  flags.anybits?(ParameterFlags::REPEATED_PARAMETER)
1778
2024
  end
1779
2025
 
1780
- # attr_reader name: Symbol?
2026
+ # The name of the block parameter.
2027
+ #
2028
+ # def a(&b) # name `:b`
2029
+ # ^
2030
+ # end
1781
2031
  attr_reader :name
1782
2032
 
1783
- # attr_reader name_loc: Location?
2033
+ # Represents the location of the block parameter name.
2034
+ #
2035
+ # def a(&b)
2036
+ # ^
1784
2037
  def name_loc
1785
2038
  location = @name_loc
1786
2039
  case location
@@ -1793,13 +2046,29 @@ module Prism
1793
2046
  end
1794
2047
  end
1795
2048
 
1796
- # attr_reader operator_loc: Location
2049
+ # Save the name_loc location using the given saved source so that
2050
+ # it can be retrieved later.
2051
+ def save_name_loc(repository)
2052
+ repository.enter(node_id, :name_loc) unless @name_loc.nil?
2053
+ end
2054
+
2055
+ # Represents the location of the `&` operator.
2056
+ #
2057
+ # def a(&b)
2058
+ # ^
2059
+ # end
1797
2060
  def operator_loc
1798
2061
  location = @operator_loc
1799
2062
  return location if location.is_a?(Location)
1800
2063
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
1801
2064
  end
1802
2065
 
2066
+ # Save the operator_loc location using the given saved source so that
2067
+ # it can be retrieved later.
2068
+ def save_operator_loc(repository)
2069
+ repository.enter(node_id, :operator_loc)
2070
+ end
2071
+
1803
2072
  # def operator: () -> String
1804
2073
  def operator
1805
2074
  operator_loc.slice
@@ -1888,13 +2157,34 @@ module Prism
1888
2157
  { node_id: node_id, location: location, parameters: parameters, locals: locals, opening_loc: opening_loc, closing_loc: closing_loc }
1889
2158
  end
1890
2159
 
1891
- # attr_reader parameters: ParametersNode?
2160
+ # Represents the parameters of the block.
2161
+ #
2162
+ # -> (a, b = 1; local) { }
2163
+ # ^^^^^^^^
2164
+ #
2165
+ # foo do |a, b = 1; local|
2166
+ # ^^^^^^^^
2167
+ # end
1892
2168
  attr_reader :parameters
1893
2169
 
1894
- # attr_reader locals: Array[BlockLocalVariableNode]
2170
+ # Represents the local variables of the block.
2171
+ #
2172
+ # -> (a, b = 1; local) { }
2173
+ # ^^^^^
2174
+ #
2175
+ # foo do |a, b = 1; local|
2176
+ # ^^^^^
2177
+ # end
1895
2178
  attr_reader :locals
1896
2179
 
1897
- # attr_reader opening_loc: Location?
2180
+ # Represents the opening location of the block parameters.
2181
+ #
2182
+ # -> (a, b = 1; local) { }
2183
+ # ^
2184
+ #
2185
+ # foo do |a, b = 1; local|
2186
+ # ^
2187
+ # end
1898
2188
  def opening_loc
1899
2189
  location = @opening_loc
1900
2190
  case location
@@ -1907,7 +2197,20 @@ module Prism
1907
2197
  end
1908
2198
  end
1909
2199
 
1910
- # attr_reader closing_loc: Location?
2200
+ # Save the opening_loc location using the given saved source so that
2201
+ # it can be retrieved later.
2202
+ def save_opening_loc(repository)
2203
+ repository.enter(node_id, :opening_loc) unless @opening_loc.nil?
2204
+ end
2205
+
2206
+ # Represents the closing location of the block parameters.
2207
+ #
2208
+ # -> (a, b = 1; local) { }
2209
+ # ^
2210
+ #
2211
+ # foo do |a, b = 1; local|
2212
+ # ^
2213
+ # end
1911
2214
  def closing_loc
1912
2215
  location = @closing_loc
1913
2216
  case location
@@ -1920,6 +2223,12 @@ module Prism
1920
2223
  end
1921
2224
  end
1922
2225
 
2226
+ # Save the closing_loc location using the given saved source so that
2227
+ # it can be retrieved later.
2228
+ def save_closing_loc(repository)
2229
+ repository.enter(node_id, :closing_loc) unless @closing_loc.nil?
2230
+ end
2231
+
1923
2232
  # def opening: () -> String?
1924
2233
  def opening
1925
2234
  opening_loc&.slice
@@ -2023,6 +2332,12 @@ module Prism
2023
2332
  @keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
2024
2333
  end
2025
2334
 
2335
+ # Save the keyword_loc location using the given saved source so that
2336
+ # it can be retrieved later.
2337
+ def save_keyword_loc(repository)
2338
+ repository.enter(node_id, :keyword_loc)
2339
+ end
2340
+
2026
2341
  # def keyword: () -> String
2027
2342
  def keyword
2028
2343
  keyword_loc.slice
@@ -2128,10 +2443,16 @@ module Prism
2128
2443
  flags.anybits?(CallNodeFlags::IGNORE_VISIBILITY)
2129
2444
  end
2130
2445
 
2131
- # attr_reader receiver: Prism::node?
2446
+ # The object that the method is being called on. This can be either `nil` or any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
2447
+ #
2448
+ # foo.bar &&= value
2449
+ # ^^^
2132
2450
  attr_reader :receiver
2133
2451
 
2134
- # attr_reader call_operator_loc: Location?
2452
+ # Represents the location of the call operator.
2453
+ #
2454
+ # foo.bar &&= value
2455
+ # ^
2135
2456
  def call_operator_loc
2136
2457
  location = @call_operator_loc
2137
2458
  case location
@@ -2144,7 +2465,16 @@ module Prism
2144
2465
  end
2145
2466
  end
2146
2467
 
2147
- # attr_reader message_loc: Location?
2468
+ # Save the call_operator_loc location using the given saved source so that
2469
+ # it can be retrieved later.
2470
+ def save_call_operator_loc(repository)
2471
+ repository.enter(node_id, :call_operator_loc) unless @call_operator_loc.nil?
2472
+ end
2473
+
2474
+ # Represents the location of the message.
2475
+ #
2476
+ # foo.bar &&= value
2477
+ # ^^^
2148
2478
  def message_loc
2149
2479
  location = @message_loc
2150
2480
  case location
@@ -2157,20 +2487,44 @@ module Prism
2157
2487
  end
2158
2488
  end
2159
2489
 
2160
- # attr_reader read_name: Symbol
2490
+ # Save the message_loc location using the given saved source so that
2491
+ # it can be retrieved later.
2492
+ def save_message_loc(repository)
2493
+ repository.enter(node_id, :message_loc) unless @message_loc.nil?
2494
+ end
2495
+
2496
+ # Represents the name of the method being called.
2497
+ #
2498
+ # foo.bar &&= value # read_name `:bar`
2499
+ # ^^^
2161
2500
  attr_reader :read_name
2162
2501
 
2163
- # attr_reader write_name: Symbol
2502
+ # Represents the name of the method being written to.
2503
+ #
2504
+ # foo.bar &&= value # write_name `:bar=`
2505
+ # ^^^
2164
2506
  attr_reader :write_name
2165
2507
 
2166
- # attr_reader operator_loc: Location
2508
+ # Represents the location of the operator.
2509
+ #
2510
+ # foo.bar &&= value
2511
+ # ^^^
2167
2512
  def operator_loc
2168
2513
  location = @operator_loc
2169
2514
  return location if location.is_a?(Location)
2170
2515
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
2171
2516
  end
2172
2517
 
2173
- # attr_reader value: Prism::node
2518
+ # Save the operator_loc location using the given saved source so that
2519
+ # it can be retrieved later.
2520
+ def save_operator_loc(repository)
2521
+ repository.enter(node_id, :operator_loc)
2522
+ end
2523
+
2524
+ # Represents the value being assigned.
2525
+ #
2526
+ # foo.bar &&= value
2527
+ # ^^^^^
2174
2528
  attr_reader :value
2175
2529
 
2176
2530
  # def call_operator: () -> String?
@@ -2323,7 +2677,13 @@ module Prism
2323
2677
  # ^^^
2324
2678
  attr_reader :receiver
2325
2679
 
2326
- # attr_reader call_operator_loc: Location?
2680
+ # Represents the location of the call operator.
2681
+ #
2682
+ # foo.bar
2683
+ # ^
2684
+ #
2685
+ # foo&.bar
2686
+ # ^^
2327
2687
  def call_operator_loc
2328
2688
  location = @call_operator_loc
2329
2689
  case location
@@ -2336,10 +2696,22 @@ module Prism
2336
2696
  end
2337
2697
  end
2338
2698
 
2339
- # attr_reader name: Symbol
2699
+ # Save the call_operator_loc location using the given saved source so that
2700
+ # it can be retrieved later.
2701
+ def save_call_operator_loc(repository)
2702
+ repository.enter(node_id, :call_operator_loc) unless @call_operator_loc.nil?
2703
+ end
2704
+
2705
+ # Represents the name of the method being called.
2706
+ #
2707
+ # foo.bar # name `:foo`
2708
+ # ^^^
2340
2709
  attr_reader :name
2341
2710
 
2342
- # attr_reader message_loc: Location?
2711
+ # Represents the location of the message.
2712
+ #
2713
+ # foo.bar
2714
+ # ^^^
2343
2715
  def message_loc
2344
2716
  location = @message_loc
2345
2717
  case location
@@ -2352,7 +2724,15 @@ module Prism
2352
2724
  end
2353
2725
  end
2354
2726
 
2355
- # attr_reader opening_loc: Location?
2727
+ # Save the message_loc location using the given saved source so that
2728
+ # it can be retrieved later.
2729
+ def save_message_loc(repository)
2730
+ repository.enter(node_id, :message_loc) unless @message_loc.nil?
2731
+ end
2732
+
2733
+ # Represents the location of the left parenthesis.
2734
+ # foo(bar)
2735
+ # ^
2356
2736
  def opening_loc
2357
2737
  location = @opening_loc
2358
2738
  case location
@@ -2365,10 +2745,22 @@ module Prism
2365
2745
  end
2366
2746
  end
2367
2747
 
2368
- # attr_reader arguments: ArgumentsNode?
2748
+ # Save the opening_loc location using the given saved source so that
2749
+ # it can be retrieved later.
2750
+ def save_opening_loc(repository)
2751
+ repository.enter(node_id, :opening_loc) unless @opening_loc.nil?
2752
+ end
2753
+
2754
+ # Represents the arguments to the method call. These can be any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
2755
+ #
2756
+ # foo(bar)
2757
+ # ^^^
2369
2758
  attr_reader :arguments
2370
2759
 
2371
- # attr_reader closing_loc: Location?
2760
+ # Represents the location of the right parenthesis.
2761
+ #
2762
+ # foo(bar)
2763
+ # ^
2372
2764
  def closing_loc
2373
2765
  location = @closing_loc
2374
2766
  case location
@@ -2381,7 +2773,16 @@ module Prism
2381
2773
  end
2382
2774
  end
2383
2775
 
2384
- # attr_reader block: BlockNode | BlockArgumentNode | nil
2776
+ # Save the closing_loc location using the given saved source so that
2777
+ # it can be retrieved later.
2778
+ def save_closing_loc(repository)
2779
+ repository.enter(node_id, :closing_loc) unless @closing_loc.nil?
2780
+ end
2781
+
2782
+ # Represents the block that is being passed to the method.
2783
+ #
2784
+ # foo { |a| a }
2785
+ # ^^^^^^^^^
2385
2786
  attr_reader :block
2386
2787
 
2387
2788
  # def call_operator: () -> String?
@@ -2512,10 +2913,16 @@ module Prism
2512
2913
  flags.anybits?(CallNodeFlags::IGNORE_VISIBILITY)
2513
2914
  end
2514
2915
 
2515
- # attr_reader receiver: Prism::node?
2916
+ # The object that the method is being called on. This can be either `nil` or any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
2917
+ #
2918
+ # foo.bar += value
2919
+ # ^^^
2516
2920
  attr_reader :receiver
2517
2921
 
2518
- # attr_reader call_operator_loc: Location?
2922
+ # Represents the location of the call operator.
2923
+ #
2924
+ # foo.bar += value
2925
+ # ^
2519
2926
  def call_operator_loc
2520
2927
  location = @call_operator_loc
2521
2928
  case location
@@ -2528,7 +2935,16 @@ module Prism
2528
2935
  end
2529
2936
  end
2530
2937
 
2531
- # attr_reader message_loc: Location?
2938
+ # Save the call_operator_loc location using the given saved source so that
2939
+ # it can be retrieved later.
2940
+ def save_call_operator_loc(repository)
2941
+ repository.enter(node_id, :call_operator_loc) unless @call_operator_loc.nil?
2942
+ end
2943
+
2944
+ # Represents the location of the message.
2945
+ #
2946
+ # foo.bar += value
2947
+ # ^^^
2532
2948
  def message_loc
2533
2949
  location = @message_loc
2534
2950
  case location
@@ -2541,23 +2957,50 @@ module Prism
2541
2957
  end
2542
2958
  end
2543
2959
 
2544
- # attr_reader read_name: Symbol
2960
+ # Save the message_loc location using the given saved source so that
2961
+ # it can be retrieved later.
2962
+ def save_message_loc(repository)
2963
+ repository.enter(node_id, :message_loc) unless @message_loc.nil?
2964
+ end
2965
+
2966
+ # Represents the name of the method being called.
2967
+ #
2968
+ # foo.bar += value # read_name `:bar`
2969
+ # ^^^
2545
2970
  attr_reader :read_name
2546
2971
 
2547
- # attr_reader write_name: Symbol
2972
+ # Represents the name of the method being written to.
2973
+ #
2974
+ # foo.bar += value # write_name `:bar=`
2975
+ # ^^^
2548
2976
  attr_reader :write_name
2549
2977
 
2550
- # attr_reader binary_operator: Symbol
2978
+ # Represents the binary operator being used.
2979
+ #
2980
+ # foo.bar += value # binary_operator `:+`
2981
+ # ^
2551
2982
  attr_reader :binary_operator
2552
2983
 
2553
- # attr_reader binary_operator_loc: Location
2984
+ # Represents the location of the binary operator.
2985
+ #
2986
+ # foo.bar += value
2987
+ # ^^
2554
2988
  def binary_operator_loc
2555
2989
  location = @binary_operator_loc
2556
2990
  return location if location.is_a?(Location)
2557
2991
  @binary_operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
2558
2992
  end
2559
2993
 
2560
- # attr_reader value: Prism::node
2994
+ # Save the binary_operator_loc location using the given saved source so that
2995
+ # it can be retrieved later.
2996
+ def save_binary_operator_loc(repository)
2997
+ repository.enter(node_id, :binary_operator_loc)
2998
+ end
2999
+
3000
+ # Represents the value being assigned.
3001
+ #
3002
+ # foo.bar += value
3003
+ # ^^^^^
2561
3004
  attr_reader :value
2562
3005
 
2563
3006
  # def call_operator: () -> String?
@@ -2677,10 +3120,16 @@ module Prism
2677
3120
  flags.anybits?(CallNodeFlags::IGNORE_VISIBILITY)
2678
3121
  end
2679
3122
 
2680
- # attr_reader receiver: Prism::node?
3123
+ # The object that the method is being called on. This can be either `nil` or any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
3124
+ #
3125
+ # foo.bar ||= value
3126
+ # ^^^
2681
3127
  attr_reader :receiver
2682
3128
 
2683
- # attr_reader call_operator_loc: Location?
3129
+ # Represents the location of the call operator.
3130
+ #
3131
+ # foo.bar ||= value
3132
+ # ^
2684
3133
  def call_operator_loc
2685
3134
  location = @call_operator_loc
2686
3135
  case location
@@ -2693,7 +3142,16 @@ module Prism
2693
3142
  end
2694
3143
  end
2695
3144
 
2696
- # attr_reader message_loc: Location?
3145
+ # Save the call_operator_loc location using the given saved source so that
3146
+ # it can be retrieved later.
3147
+ def save_call_operator_loc(repository)
3148
+ repository.enter(node_id, :call_operator_loc) unless @call_operator_loc.nil?
3149
+ end
3150
+
3151
+ # Represents the location of the message.
3152
+ #
3153
+ # foo.bar ||= value
3154
+ # ^^^
2697
3155
  def message_loc
2698
3156
  location = @message_loc
2699
3157
  case location
@@ -2706,20 +3164,44 @@ module Prism
2706
3164
  end
2707
3165
  end
2708
3166
 
2709
- # attr_reader read_name: Symbol
3167
+ # Save the message_loc location using the given saved source so that
3168
+ # it can be retrieved later.
3169
+ def save_message_loc(repository)
3170
+ repository.enter(node_id, :message_loc) unless @message_loc.nil?
3171
+ end
3172
+
3173
+ # Represents the name of the method being called.
3174
+ #
3175
+ # foo.bar ||= value # read_name `:bar`
3176
+ # ^^^
2710
3177
  attr_reader :read_name
2711
3178
 
2712
- # attr_reader write_name: Symbol
3179
+ # Represents the name of the method being written to.
3180
+ #
3181
+ # foo.bar ||= value # write_name `:bar=`
3182
+ # ^^^
2713
3183
  attr_reader :write_name
2714
3184
 
2715
- # attr_reader operator_loc: Location
3185
+ # Represents the location of the operator.
3186
+ #
3187
+ # foo.bar ||= value
3188
+ # ^^^
2716
3189
  def operator_loc
2717
3190
  location = @operator_loc
2718
3191
  return location if location.is_a?(Location)
2719
3192
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
2720
3193
  end
2721
3194
 
2722
- # attr_reader value: Prism::node
3195
+ # Save the operator_loc location using the given saved source so that
3196
+ # it can be retrieved later.
3197
+ def save_operator_loc(repository)
3198
+ repository.enter(node_id, :operator_loc)
3199
+ end
3200
+
3201
+ # Represents the value being assigned.
3202
+ #
3203
+ # foo.bar ||= value
3204
+ # ^^^^^
2723
3205
  attr_reader :value
2724
3206
 
2725
3207
  # def call_operator: () -> String?
@@ -2845,26 +3327,50 @@ module Prism
2845
3327
  flags.anybits?(CallNodeFlags::IGNORE_VISIBILITY)
2846
3328
  end
2847
3329
 
2848
- # attr_reader receiver: Prism::node
3330
+ # The object that the method is being called on. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
3331
+ #
3332
+ # foo.bar = 1
3333
+ # ^^^
2849
3334
  attr_reader :receiver
2850
3335
 
2851
- # attr_reader call_operator_loc: Location
3336
+ # Represents the location of the call operator.
3337
+ #
3338
+ # foo.bar = 1
3339
+ # ^
2852
3340
  def call_operator_loc
2853
3341
  location = @call_operator_loc
2854
3342
  return location if location.is_a?(Location)
2855
3343
  @call_operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
2856
3344
  end
2857
3345
 
2858
- # attr_reader name: Symbol
3346
+ # Save the call_operator_loc location using the given saved source so that
3347
+ # it can be retrieved later.
3348
+ def save_call_operator_loc(repository)
3349
+ repository.enter(node_id, :call_operator_loc)
3350
+ end
3351
+
3352
+ # Represents the name of the method being called.
3353
+ #
3354
+ # foo.bar = 1 # name `:foo`
3355
+ # ^^^
2859
3356
  attr_reader :name
2860
3357
 
2861
- # attr_reader message_loc: Location
3358
+ # Represents the location of the message.
3359
+ #
3360
+ # foo.bar = 1
3361
+ # ^^^
2862
3362
  def message_loc
2863
3363
  location = @message_loc
2864
3364
  return location if location.is_a?(Location)
2865
3365
  @message_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
2866
3366
  end
2867
3367
 
3368
+ # Save the message_loc location using the given saved source so that
3369
+ # it can be retrieved later.
3370
+ def save_message_loc(repository)
3371
+ repository.enter(node_id, :message_loc)
3372
+ end
3373
+
2868
3374
  # def call_operator: () -> String
2869
3375
  def call_operator
2870
3376
  call_operator_loc.slice
@@ -2951,19 +3457,34 @@ module Prism
2951
3457
  { node_id: node_id, location: location, value: value, target: target, operator_loc: operator_loc }
2952
3458
  end
2953
3459
 
2954
- # attr_reader value: Prism::node
3460
+ # Represents the value to capture.
3461
+ #
3462
+ # foo => bar
3463
+ # ^^^
2955
3464
  attr_reader :value
2956
3465
 
2957
- # attr_reader target: LocalVariableTargetNode
3466
+ # Represents the target of the capture.
3467
+ #
3468
+ # foo => bar
3469
+ # ^^^
2958
3470
  attr_reader :target
2959
3471
 
2960
- # attr_reader operator_loc: Location
3472
+ # Represents the location of the `=>` operator.
3473
+ #
3474
+ # foo => bar
3475
+ # ^^
2961
3476
  def operator_loc
2962
3477
  location = @operator_loc
2963
3478
  return location if location.is_a?(Location)
2964
3479
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
2965
3480
  end
2966
3481
 
3482
+ # Save the operator_loc location using the given saved source so that
3483
+ # it can be retrieved later.
3484
+ def save_operator_loc(repository)
3485
+ repository.enter(node_id, :operator_loc)
3486
+ end
3487
+
2967
3488
  # def operator: () -> String
2968
3489
  def operator
2969
3490
  operator_loc.slice
@@ -3051,29 +3572,56 @@ module Prism
3051
3572
  { node_id: node_id, location: location, predicate: predicate, conditions: conditions, else_clause: else_clause, case_keyword_loc: case_keyword_loc, end_keyword_loc: end_keyword_loc }
3052
3573
  end
3053
3574
 
3054
- # attr_reader predicate: Prism::node?
3575
+ # Represents the predicate of the case match. This can be either `nil` or any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
3576
+ #
3577
+ # case true; in false; end
3578
+ # ^^^^
3055
3579
  attr_reader :predicate
3056
3580
 
3057
- # attr_reader conditions: Array[InNode]
3581
+ # Represents the conditions of the case match.
3582
+ #
3583
+ # case true; in false; end
3584
+ # ^^^^^^^^
3058
3585
  attr_reader :conditions
3059
3586
 
3060
- # attr_reader else_clause: ElseNode?
3587
+ # Represents the else clause of the case match.
3588
+ #
3589
+ # case true; in false; else; end
3590
+ # ^^^^
3061
3591
  attr_reader :else_clause
3062
3592
 
3063
- # attr_reader case_keyword_loc: Location
3593
+ # Represents the location of the `case` keyword.
3594
+ #
3595
+ # case true; in false; end
3596
+ # ^^^^
3064
3597
  def case_keyword_loc
3065
3598
  location = @case_keyword_loc
3066
3599
  return location if location.is_a?(Location)
3067
3600
  @case_keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
3068
3601
  end
3069
3602
 
3070
- # attr_reader end_keyword_loc: Location
3603
+ # Save the case_keyword_loc location using the given saved source so that
3604
+ # it can be retrieved later.
3605
+ def save_case_keyword_loc(repository)
3606
+ repository.enter(node_id, :case_keyword_loc)
3607
+ end
3608
+
3609
+ # Represents the location of the `end` keyword.
3610
+ #
3611
+ # case true; in false; end
3612
+ # ^^^
3071
3613
  def end_keyword_loc
3072
3614
  location = @end_keyword_loc
3073
3615
  return location if location.is_a?(Location)
3074
3616
  @end_keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
3075
3617
  end
3076
3618
 
3619
+ # Save the end_keyword_loc location using the given saved source so that
3620
+ # it can be retrieved later.
3621
+ def save_end_keyword_loc(repository)
3622
+ repository.enter(node_id, :end_keyword_loc)
3623
+ end
3624
+
3077
3625
  # def case_keyword: () -> String
3078
3626
  def case_keyword
3079
3627
  case_keyword_loc.slice
@@ -3169,29 +3717,56 @@ module Prism
3169
3717
  { node_id: node_id, location: location, predicate: predicate, conditions: conditions, else_clause: else_clause, case_keyword_loc: case_keyword_loc, end_keyword_loc: end_keyword_loc }
3170
3718
  end
3171
3719
 
3172
- # attr_reader predicate: Prism::node?
3720
+ # Represents the predicate of the case statement. This can be either `nil` or any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
3721
+ #
3722
+ # case true; when false; end
3723
+ # ^^^^
3173
3724
  attr_reader :predicate
3174
3725
 
3175
- # attr_reader conditions: Array[WhenNode]
3726
+ # Represents the conditions of the case statement.
3727
+ #
3728
+ # case true; when false; end
3729
+ # ^^^^^^^^^^
3176
3730
  attr_reader :conditions
3177
3731
 
3178
- # attr_reader else_clause: ElseNode?
3732
+ # Represents the else clause of the case statement.
3733
+ #
3734
+ # case true; when false; else; end
3735
+ # ^^^^
3179
3736
  attr_reader :else_clause
3180
3737
 
3181
- # attr_reader case_keyword_loc: Location
3738
+ # Represents the location of the `case` keyword.
3739
+ #
3740
+ # case true; when false; end
3741
+ # ^^^^
3182
3742
  def case_keyword_loc
3183
3743
  location = @case_keyword_loc
3184
3744
  return location if location.is_a?(Location)
3185
3745
  @case_keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
3186
3746
  end
3187
3747
 
3188
- # attr_reader end_keyword_loc: Location
3748
+ # Save the case_keyword_loc location using the given saved source so that
3749
+ # it can be retrieved later.
3750
+ def save_case_keyword_loc(repository)
3751
+ repository.enter(node_id, :case_keyword_loc)
3752
+ end
3753
+
3754
+ # Represents the location of the `end` keyword.
3755
+ #
3756
+ # case true; when false; end
3757
+ # ^^^
3189
3758
  def end_keyword_loc
3190
3759
  location = @end_keyword_loc
3191
3760
  return location if location.is_a?(Location)
3192
3761
  @end_keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
3193
3762
  end
3194
3763
 
3764
+ # Save the end_keyword_loc location using the given saved source so that
3765
+ # it can be retrieved later.
3766
+ def save_end_keyword_loc(repository)
3767
+ repository.enter(node_id, :end_keyword_loc)
3768
+ end
3769
+
3195
3770
  # def case_keyword: () -> String
3196
3771
  def case_keyword
3197
3772
  case_keyword_loc.slice
@@ -3298,6 +3873,12 @@ module Prism
3298
3873
  @class_keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
3299
3874
  end
3300
3875
 
3876
+ # Save the class_keyword_loc location using the given saved source so that
3877
+ # it can be retrieved later.
3878
+ def save_class_keyword_loc(repository)
3879
+ repository.enter(node_id, :class_keyword_loc)
3880
+ end
3881
+
3301
3882
  # attr_reader constant_path: ConstantReadNode | ConstantPathNode | CallNode
3302
3883
  attr_reader :constant_path
3303
3884
 
@@ -3314,6 +3895,12 @@ module Prism
3314
3895
  end
3315
3896
  end
3316
3897
 
3898
+ # Save the inheritance_operator_loc location using the given saved source so that
3899
+ # it can be retrieved later.
3900
+ def save_inheritance_operator_loc(repository)
3901
+ repository.enter(node_id, :inheritance_operator_loc) unless @inheritance_operator_loc.nil?
3902
+ end
3903
+
3317
3904
  # attr_reader superclass: Prism::node?
3318
3905
  attr_reader :superclass
3319
3906
 
@@ -3327,6 +3914,12 @@ module Prism
3327
3914
  @end_keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
3328
3915
  end
3329
3916
 
3917
+ # Save the end_keyword_loc location using the given saved source so that
3918
+ # it can be retrieved later.
3919
+ def save_end_keyword_loc(repository)
3920
+ repository.enter(node_id, :end_keyword_loc)
3921
+ end
3922
+
3330
3923
  # attr_reader name: Symbol
3331
3924
  attr_reader :name
3332
3925
 
@@ -3426,24 +4019,48 @@ module Prism
3426
4019
  { node_id: node_id, location: location, name: name, name_loc: name_loc, operator_loc: operator_loc, value: value }
3427
4020
  end
3428
4021
 
3429
- # attr_reader name: Symbol
4022
+ # The name of the class variable, which is a `@@` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers).
4023
+ #
4024
+ # @@target &&= value # name `:@@target`
4025
+ # ^^^^^^^^
3430
4026
  attr_reader :name
3431
4027
 
3432
- # attr_reader name_loc: Location
4028
+ # Represents the location of the variable name.
4029
+ #
4030
+ # @@target &&= value
4031
+ # ^^^^^^^^
3433
4032
  def name_loc
3434
4033
  location = @name_loc
3435
4034
  return location if location.is_a?(Location)
3436
4035
  @name_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
3437
4036
  end
3438
4037
 
3439
- # attr_reader operator_loc: Location
4038
+ # Save the name_loc location using the given saved source so that
4039
+ # it can be retrieved later.
4040
+ def save_name_loc(repository)
4041
+ repository.enter(node_id, :name_loc)
4042
+ end
4043
+
4044
+ # Represents the location of the `&&=` operator.
4045
+ #
4046
+ # @@target &&= value
4047
+ # ^^^
3440
4048
  def operator_loc
3441
4049
  location = @operator_loc
3442
4050
  return location if location.is_a?(Location)
3443
4051
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
3444
4052
  end
3445
4053
 
3446
- # attr_reader value: Prism::node
4054
+ # Save the operator_loc location using the given saved source so that
4055
+ # it can be retrieved later.
4056
+ def save_operator_loc(repository)
4057
+ repository.enter(node_id, :operator_loc)
4058
+ end
4059
+
4060
+ # Represents the value being assigned. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
4061
+ #
4062
+ # @@target &&= value
4063
+ # ^^^^^
3447
4064
  attr_reader :value
3448
4065
 
3449
4066
  # def operator: () -> String
@@ -3538,6 +4155,12 @@ module Prism
3538
4155
  @name_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
3539
4156
  end
3540
4157
 
4158
+ # Save the name_loc location using the given saved source so that
4159
+ # it can be retrieved later.
4160
+ def save_name_loc(repository)
4161
+ repository.enter(node_id, :name_loc)
4162
+ end
4163
+
3541
4164
  # attr_reader binary_operator_loc: Location
3542
4165
  def binary_operator_loc
3543
4166
  location = @binary_operator_loc
@@ -3545,6 +4168,12 @@ module Prism
3545
4168
  @binary_operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
3546
4169
  end
3547
4170
 
4171
+ # Save the binary_operator_loc location using the given saved source so that
4172
+ # it can be retrieved later.
4173
+ def save_binary_operator_loc(repository)
4174
+ repository.enter(node_id, :binary_operator_loc)
4175
+ end
4176
+
3548
4177
  # attr_reader value: Prism::node
3549
4178
  attr_reader :value
3550
4179
 
@@ -3638,6 +4267,12 @@ module Prism
3638
4267
  @name_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
3639
4268
  end
3640
4269
 
4270
+ # Save the name_loc location using the given saved source so that
4271
+ # it can be retrieved later.
4272
+ def save_name_loc(repository)
4273
+ repository.enter(node_id, :name_loc)
4274
+ end
4275
+
3641
4276
  # attr_reader operator_loc: Location
3642
4277
  def operator_loc
3643
4278
  location = @operator_loc
@@ -3645,6 +4280,12 @@ module Prism
3645
4280
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
3646
4281
  end
3647
4282
 
4283
+ # Save the operator_loc location using the given saved source so that
4284
+ # it can be retrieved later.
4285
+ def save_operator_loc(repository)
4286
+ repository.enter(node_id, :operator_loc)
4287
+ end
4288
+
3648
4289
  # attr_reader value: Prism::node
3649
4290
  attr_reader :value
3650
4291
 
@@ -3896,6 +4537,12 @@ module Prism
3896
4537
  @name_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
3897
4538
  end
3898
4539
 
4540
+ # Save the name_loc location using the given saved source so that
4541
+ # it can be retrieved later.
4542
+ def save_name_loc(repository)
4543
+ repository.enter(node_id, :name_loc)
4544
+ end
4545
+
3899
4546
  # The value to write to the class variable. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
3900
4547
  #
3901
4548
  # @@foo = :bar
@@ -3915,6 +4562,12 @@ module Prism
3915
4562
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
3916
4563
  end
3917
4564
 
4565
+ # Save the operator_loc location using the given saved source so that
4566
+ # it can be retrieved later.
4567
+ def save_operator_loc(repository)
4568
+ repository.enter(node_id, :operator_loc)
4569
+ end
4570
+
3918
4571
  # def operator: () -> String
3919
4572
  def operator
3920
4573
  operator_loc.slice
@@ -4006,6 +4659,12 @@ module Prism
4006
4659
  @name_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
4007
4660
  end
4008
4661
 
4662
+ # Save the name_loc location using the given saved source so that
4663
+ # it can be retrieved later.
4664
+ def save_name_loc(repository)
4665
+ repository.enter(node_id, :name_loc)
4666
+ end
4667
+
4009
4668
  # attr_reader operator_loc: Location
4010
4669
  def operator_loc
4011
4670
  location = @operator_loc
@@ -4013,6 +4672,12 @@ module Prism
4013
4672
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
4014
4673
  end
4015
4674
 
4675
+ # Save the operator_loc location using the given saved source so that
4676
+ # it can be retrieved later.
4677
+ def save_operator_loc(repository)
4678
+ repository.enter(node_id, :operator_loc)
4679
+ end
4680
+
4016
4681
  # attr_reader value: Prism::node
4017
4682
  attr_reader :value
4018
4683
 
@@ -4108,6 +4773,12 @@ module Prism
4108
4773
  @name_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
4109
4774
  end
4110
4775
 
4776
+ # Save the name_loc location using the given saved source so that
4777
+ # it can be retrieved later.
4778
+ def save_name_loc(repository)
4779
+ repository.enter(node_id, :name_loc)
4780
+ end
4781
+
4111
4782
  # attr_reader binary_operator_loc: Location
4112
4783
  def binary_operator_loc
4113
4784
  location = @binary_operator_loc
@@ -4115,6 +4786,12 @@ module Prism
4115
4786
  @binary_operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
4116
4787
  end
4117
4788
 
4789
+ # Save the binary_operator_loc location using the given saved source so that
4790
+ # it can be retrieved later.
4791
+ def save_binary_operator_loc(repository)
4792
+ repository.enter(node_id, :binary_operator_loc)
4793
+ end
4794
+
4118
4795
  # attr_reader value: Prism::node
4119
4796
  attr_reader :value
4120
4797
 
@@ -4208,6 +4885,12 @@ module Prism
4208
4885
  @name_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
4209
4886
  end
4210
4887
 
4888
+ # Save the name_loc location using the given saved source so that
4889
+ # it can be retrieved later.
4890
+ def save_name_loc(repository)
4891
+ repository.enter(node_id, :name_loc)
4892
+ end
4893
+
4211
4894
  # attr_reader operator_loc: Location
4212
4895
  def operator_loc
4213
4896
  location = @operator_loc
@@ -4215,6 +4898,12 @@ module Prism
4215
4898
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
4216
4899
  end
4217
4900
 
4901
+ # Save the operator_loc location using the given saved source so that
4902
+ # it can be retrieved later.
4903
+ def save_operator_loc(repository)
4904
+ repository.enter(node_id, :operator_loc)
4905
+ end
4906
+
4218
4907
  # attr_reader value: Prism::node
4219
4908
  attr_reader :value
4220
4909
 
@@ -4308,6 +4997,12 @@ module Prism
4308
4997
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
4309
4998
  end
4310
4999
 
5000
+ # Save the operator_loc location using the given saved source so that
5001
+ # it can be retrieved later.
5002
+ def save_operator_loc(repository)
5003
+ repository.enter(node_id, :operator_loc)
5004
+ end
5005
+
4311
5006
  # attr_reader value: Prism::node
4312
5007
  attr_reader :value
4313
5008
 
@@ -4421,6 +5116,12 @@ module Prism
4421
5116
  @delimiter_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
4422
5117
  end
4423
5118
 
5119
+ # Save the delimiter_loc location using the given saved source so that
5120
+ # it can be retrieved later.
5121
+ def save_delimiter_loc(repository)
5122
+ repository.enter(node_id, :delimiter_loc)
5123
+ end
5124
+
4424
5125
  # The location of the name of the constant.
4425
5126
  #
4426
5127
  # ::Foo
@@ -4434,6 +5135,12 @@ module Prism
4434
5135
  @name_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
4435
5136
  end
4436
5137
 
5138
+ # Save the name_loc location using the given saved source so that
5139
+ # it can be retrieved later.
5140
+ def save_name_loc(repository)
5141
+ repository.enter(node_id, :name_loc)
5142
+ end
5143
+
4437
5144
  # def delimiter: () -> String
4438
5145
  def delimiter
4439
5146
  delimiter_loc.slice
@@ -4525,6 +5232,12 @@ module Prism
4525
5232
  @binary_operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
4526
5233
  end
4527
5234
 
5235
+ # Save the binary_operator_loc location using the given saved source so that
5236
+ # it can be retrieved later.
5237
+ def save_binary_operator_loc(repository)
5238
+ repository.enter(node_id, :binary_operator_loc)
5239
+ end
5240
+
4528
5241
  # attr_reader value: Prism::node
4529
5242
  attr_reader :value
4530
5243
 
@@ -4616,6 +5329,12 @@ module Prism
4616
5329
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
4617
5330
  end
4618
5331
 
5332
+ # Save the operator_loc location using the given saved source so that
5333
+ # it can be retrieved later.
5334
+ def save_operator_loc(repository)
5335
+ repository.enter(node_id, :operator_loc)
5336
+ end
5337
+
4619
5338
  # attr_reader value: Prism::node
4620
5339
  attr_reader :value
4621
5340
 
@@ -4714,6 +5433,12 @@ module Prism
4714
5433
  @delimiter_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
4715
5434
  end
4716
5435
 
5436
+ # Save the delimiter_loc location using the given saved source so that
5437
+ # it can be retrieved later.
5438
+ def save_delimiter_loc(repository)
5439
+ repository.enter(node_id, :delimiter_loc)
5440
+ end
5441
+
4717
5442
  # attr_reader name_loc: Location
4718
5443
  def name_loc
4719
5444
  location = @name_loc
@@ -4721,6 +5446,12 @@ module Prism
4721
5446
  @name_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
4722
5447
  end
4723
5448
 
5449
+ # Save the name_loc location using the given saved source so that
5450
+ # it can be retrieved later.
5451
+ def save_name_loc(repository)
5452
+ repository.enter(node_id, :name_loc)
5453
+ end
5454
+
4724
5455
  # def delimiter: () -> String
4725
5456
  def delimiter
4726
5457
  delimiter_loc.slice
@@ -4826,6 +5557,12 @@ module Prism
4826
5557
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
4827
5558
  end
4828
5559
 
5560
+ # Save the operator_loc location using the given saved source so that
5561
+ # it can be retrieved later.
5562
+ def save_operator_loc(repository)
5563
+ repository.enter(node_id, :operator_loc)
5564
+ end
5565
+
4829
5566
  # The value to write to the constant path. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
4830
5567
  #
4831
5568
  # FOO::BAR = :abc
@@ -5079,6 +5816,12 @@ module Prism
5079
5816
  @name_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
5080
5817
  end
5081
5818
 
5819
+ # Save the name_loc location using the given saved source so that
5820
+ # it can be retrieved later.
5821
+ def save_name_loc(repository)
5822
+ repository.enter(node_id, :name_loc)
5823
+ end
5824
+
5082
5825
  # The value to write to the constant. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
5083
5826
  #
5084
5827
  # FOO = :bar
@@ -5098,6 +5841,12 @@ module Prism
5098
5841
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
5099
5842
  end
5100
5843
 
5844
+ # Save the operator_loc location using the given saved source so that
5845
+ # it can be retrieved later.
5846
+ def save_operator_loc(repository)
5847
+ repository.enter(node_id, :operator_loc)
5848
+ end
5849
+
5101
5850
  # def operator: () -> String
5102
5851
  def operator
5103
5852
  operator_loc.slice
@@ -5202,6 +5951,12 @@ module Prism
5202
5951
  @name_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
5203
5952
  end
5204
5953
 
5954
+ # Save the name_loc location using the given saved source so that
5955
+ # it can be retrieved later.
5956
+ def save_name_loc(repository)
5957
+ repository.enter(node_id, :name_loc)
5958
+ end
5959
+
5205
5960
  # attr_reader receiver: Prism::node?
5206
5961
  attr_reader :receiver
5207
5962
 
@@ -5221,6 +5976,12 @@ module Prism
5221
5976
  @def_keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
5222
5977
  end
5223
5978
 
5979
+ # Save the def_keyword_loc location using the given saved source so that
5980
+ # it can be retrieved later.
5981
+ def save_def_keyword_loc(repository)
5982
+ repository.enter(node_id, :def_keyword_loc)
5983
+ end
5984
+
5224
5985
  # attr_reader operator_loc: Location?
5225
5986
  def operator_loc
5226
5987
  location = @operator_loc
@@ -5234,6 +5995,12 @@ module Prism
5234
5995
  end
5235
5996
  end
5236
5997
 
5998
+ # Save the operator_loc location using the given saved source so that
5999
+ # it can be retrieved later.
6000
+ def save_operator_loc(repository)
6001
+ repository.enter(node_id, :operator_loc) unless @operator_loc.nil?
6002
+ end
6003
+
5237
6004
  # attr_reader lparen_loc: Location?
5238
6005
  def lparen_loc
5239
6006
  location = @lparen_loc
@@ -5247,6 +6014,12 @@ module Prism
5247
6014
  end
5248
6015
  end
5249
6016
 
6017
+ # Save the lparen_loc location using the given saved source so that
6018
+ # it can be retrieved later.
6019
+ def save_lparen_loc(repository)
6020
+ repository.enter(node_id, :lparen_loc) unless @lparen_loc.nil?
6021
+ end
6022
+
5250
6023
  # attr_reader rparen_loc: Location?
5251
6024
  def rparen_loc
5252
6025
  location = @rparen_loc
@@ -5260,6 +6033,12 @@ module Prism
5260
6033
  end
5261
6034
  end
5262
6035
 
6036
+ # Save the rparen_loc location using the given saved source so that
6037
+ # it can be retrieved later.
6038
+ def save_rparen_loc(repository)
6039
+ repository.enter(node_id, :rparen_loc) unless @rparen_loc.nil?
6040
+ end
6041
+
5263
6042
  # attr_reader equal_loc: Location?
5264
6043
  def equal_loc
5265
6044
  location = @equal_loc
@@ -5273,6 +6052,12 @@ module Prism
5273
6052
  end
5274
6053
  end
5275
6054
 
6055
+ # Save the equal_loc location using the given saved source so that
6056
+ # it can be retrieved later.
6057
+ def save_equal_loc(repository)
6058
+ repository.enter(node_id, :equal_loc) unless @equal_loc.nil?
6059
+ end
6060
+
5276
6061
  # attr_reader end_keyword_loc: Location?
5277
6062
  def end_keyword_loc
5278
6063
  location = @end_keyword_loc
@@ -5286,6 +6071,12 @@ module Prism
5286
6071
  end
5287
6072
  end
5288
6073
 
6074
+ # Save the end_keyword_loc location using the given saved source so that
6075
+ # it can be retrieved later.
6076
+ def save_end_keyword_loc(repository)
6077
+ repository.enter(node_id, :end_keyword_loc) unless @end_keyword_loc.nil?
6078
+ end
6079
+
5289
6080
  # def def_keyword: () -> String
5290
6081
  def def_keyword
5291
6082
  def_keyword_loc.slice
@@ -5414,6 +6205,12 @@ module Prism
5414
6205
  end
5415
6206
  end
5416
6207
 
6208
+ # Save the lparen_loc location using the given saved source so that
6209
+ # it can be retrieved later.
6210
+ def save_lparen_loc(repository)
6211
+ repository.enter(node_id, :lparen_loc) unless @lparen_loc.nil?
6212
+ end
6213
+
5417
6214
  # attr_reader value: Prism::node
5418
6215
  attr_reader :value
5419
6216
 
@@ -5430,6 +6227,12 @@ module Prism
5430
6227
  end
5431
6228
  end
5432
6229
 
6230
+ # Save the rparen_loc location using the given saved source so that
6231
+ # it can be retrieved later.
6232
+ def save_rparen_loc(repository)
6233
+ repository.enter(node_id, :rparen_loc) unless @rparen_loc.nil?
6234
+ end
6235
+
5433
6236
  # attr_reader keyword_loc: Location
5434
6237
  def keyword_loc
5435
6238
  location = @keyword_loc
@@ -5437,6 +6240,12 @@ module Prism
5437
6240
  @keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
5438
6241
  end
5439
6242
 
6243
+ # Save the keyword_loc location using the given saved source so that
6244
+ # it can be retrieved later.
6245
+ def save_keyword_loc(repository)
6246
+ repository.enter(node_id, :keyword_loc)
6247
+ end
6248
+
5440
6249
  # def lparen: () -> String?
5441
6250
  def lparen
5442
6251
  lparen_loc&.slice
@@ -5536,6 +6345,12 @@ module Prism
5536
6345
  @else_keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
5537
6346
  end
5538
6347
 
6348
+ # Save the else_keyword_loc location using the given saved source so that
6349
+ # it can be retrieved later.
6350
+ def save_else_keyword_loc(repository)
6351
+ repository.enter(node_id, :else_keyword_loc)
6352
+ end
6353
+
5539
6354
  # attr_reader statements: StatementsNode?
5540
6355
  attr_reader :statements
5541
6356
 
@@ -5552,6 +6367,12 @@ module Prism
5552
6367
  end
5553
6368
  end
5554
6369
 
6370
+ # Save the end_keyword_loc location using the given saved source so that
6371
+ # it can be retrieved later.
6372
+ def save_end_keyword_loc(repository)
6373
+ repository.enter(node_id, :end_keyword_loc) unless @end_keyword_loc.nil?
6374
+ end
6375
+
5555
6376
  # def else_keyword: () -> String
5556
6377
  def else_keyword
5557
6378
  else_keyword_loc.slice
@@ -5645,6 +6466,12 @@ module Prism
5645
6466
  @opening_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
5646
6467
  end
5647
6468
 
6469
+ # Save the opening_loc location using the given saved source so that
6470
+ # it can be retrieved later.
6471
+ def save_opening_loc(repository)
6472
+ repository.enter(node_id, :opening_loc)
6473
+ end
6474
+
5648
6475
  # attr_reader statements: StatementsNode?
5649
6476
  attr_reader :statements
5650
6477
 
@@ -5655,6 +6482,12 @@ module Prism
5655
6482
  @closing_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
5656
6483
  end
5657
6484
 
6485
+ # Save the closing_loc location using the given saved source so that
6486
+ # it can be retrieved later.
6487
+ def save_closing_loc(repository)
6488
+ repository.enter(node_id, :closing_loc)
6489
+ end
6490
+
5658
6491
  # def opening: () -> String
5659
6492
  def opening
5660
6493
  opening_loc.slice
@@ -5745,6 +6578,12 @@ module Prism
5745
6578
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
5746
6579
  end
5747
6580
 
6581
+ # Save the operator_loc location using the given saved source so that
6582
+ # it can be retrieved later.
6583
+ def save_operator_loc(repository)
6584
+ repository.enter(node_id, :operator_loc)
6585
+ end
6586
+
5748
6587
  # attr_reader variable: InstanceVariableReadNode | ClassVariableReadNode | GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode
5749
6588
  attr_reader :variable
5750
6589
 
@@ -5839,6 +6678,12 @@ module Prism
5839
6678
  @ensure_keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
5840
6679
  end
5841
6680
 
6681
+ # Save the ensure_keyword_loc location using the given saved source so that
6682
+ # it can be retrieved later.
6683
+ def save_ensure_keyword_loc(repository)
6684
+ repository.enter(node_id, :ensure_keyword_loc)
6685
+ end
6686
+
5842
6687
  # attr_reader statements: StatementsNode?
5843
6688
  attr_reader :statements
5844
6689
 
@@ -5849,6 +6694,12 @@ module Prism
5849
6694
  @end_keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
5850
6695
  end
5851
6696
 
6697
+ # Save the end_keyword_loc location using the given saved source so that
6698
+ # it can be retrieved later.
6699
+ def save_end_keyword_loc(repository)
6700
+ repository.enter(node_id, :end_keyword_loc)
6701
+ end
6702
+
5852
6703
  # def ensure_keyword: () -> String
5853
6704
  def ensure_keyword
5854
6705
  ensure_keyword_loc.slice
@@ -6040,6 +6891,12 @@ module Prism
6040
6891
  end
6041
6892
  end
6042
6893
 
6894
+ # Save the opening_loc location using the given saved source so that
6895
+ # it can be retrieved later.
6896
+ def save_opening_loc(repository)
6897
+ repository.enter(node_id, :opening_loc) unless @opening_loc.nil?
6898
+ end
6899
+
6043
6900
  # attr_reader closing_loc: Location?
6044
6901
  def closing_loc
6045
6902
  location = @closing_loc
@@ -6053,6 +6910,12 @@ module Prism
6053
6910
  end
6054
6911
  end
6055
6912
 
6913
+ # Save the closing_loc location using the given saved source so that
6914
+ # it can be retrieved later.
6915
+ def save_closing_loc(repository)
6916
+ repository.enter(node_id, :closing_loc) unless @closing_loc.nil?
6917
+ end
6918
+
6056
6919
  # def opening: () -> String?
6057
6920
  def opening
6058
6921
  opening_loc&.slice
@@ -6162,6 +7025,12 @@ module Prism
6162
7025
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
6163
7026
  end
6164
7027
 
7028
+ # Save the operator_loc location using the given saved source so that
7029
+ # it can be retrieved later.
7030
+ def save_operator_loc(repository)
7031
+ repository.enter(node_id, :operator_loc)
7032
+ end
7033
+
6165
7034
  # def operator: () -> String
6166
7035
  def operator
6167
7036
  operator_loc.slice
@@ -6353,6 +7222,12 @@ module Prism
6353
7222
  @for_keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
6354
7223
  end
6355
7224
 
7225
+ # Save the for_keyword_loc location using the given saved source so that
7226
+ # it can be retrieved later.
7227
+ def save_for_keyword_loc(repository)
7228
+ repository.enter(node_id, :for_keyword_loc)
7229
+ end
7230
+
6356
7231
  # The location of the `in` keyword.
6357
7232
  #
6358
7233
  # for i in a end
@@ -6363,6 +7238,12 @@ module Prism
6363
7238
  @in_keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
6364
7239
  end
6365
7240
 
7241
+ # Save the in_keyword_loc location using the given saved source so that
7242
+ # it can be retrieved later.
7243
+ def save_in_keyword_loc(repository)
7244
+ repository.enter(node_id, :in_keyword_loc)
7245
+ end
7246
+
6366
7247
  # The location of the `do` keyword, if present.
6367
7248
  #
6368
7249
  # for i in a do end
@@ -6379,6 +7260,12 @@ module Prism
6379
7260
  end
6380
7261
  end
6381
7262
 
7263
+ # Save the do_keyword_loc location using the given saved source so that
7264
+ # it can be retrieved later.
7265
+ def save_do_keyword_loc(repository)
7266
+ repository.enter(node_id, :do_keyword_loc) unless @do_keyword_loc.nil?
7267
+ end
7268
+
6382
7269
  # The location of the `end` keyword.
6383
7270
  #
6384
7271
  # for i in a end
@@ -6389,6 +7276,12 @@ module Prism
6389
7276
  @end_keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
6390
7277
  end
6391
7278
 
7279
+ # Save the end_keyword_loc location using the given saved source so that
7280
+ # it can be retrieved later.
7281
+ def save_end_keyword_loc(repository)
7282
+ repository.enter(node_id, :end_keyword_loc)
7283
+ end
7284
+
6392
7285
  # def for_keyword: () -> String
6393
7286
  def for_keyword
6394
7287
  for_keyword_loc.slice
@@ -6712,6 +7605,12 @@ module Prism
6712
7605
  @name_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
6713
7606
  end
6714
7607
 
7608
+ # Save the name_loc location using the given saved source so that
7609
+ # it can be retrieved later.
7610
+ def save_name_loc(repository)
7611
+ repository.enter(node_id, :name_loc)
7612
+ end
7613
+
6715
7614
  # attr_reader operator_loc: Location
6716
7615
  def operator_loc
6717
7616
  location = @operator_loc
@@ -6719,6 +7618,12 @@ module Prism
6719
7618
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
6720
7619
  end
6721
7620
 
7621
+ # Save the operator_loc location using the given saved source so that
7622
+ # it can be retrieved later.
7623
+ def save_operator_loc(repository)
7624
+ repository.enter(node_id, :operator_loc)
7625
+ end
7626
+
6722
7627
  # attr_reader value: Prism::node
6723
7628
  attr_reader :value
6724
7629
 
@@ -6814,6 +7719,12 @@ module Prism
6814
7719
  @name_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
6815
7720
  end
6816
7721
 
7722
+ # Save the name_loc location using the given saved source so that
7723
+ # it can be retrieved later.
7724
+ def save_name_loc(repository)
7725
+ repository.enter(node_id, :name_loc)
7726
+ end
7727
+
6817
7728
  # attr_reader binary_operator_loc: Location
6818
7729
  def binary_operator_loc
6819
7730
  location = @binary_operator_loc
@@ -6821,6 +7732,12 @@ module Prism
6821
7732
  @binary_operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
6822
7733
  end
6823
7734
 
7735
+ # Save the binary_operator_loc location using the given saved source so that
7736
+ # it can be retrieved later.
7737
+ def save_binary_operator_loc(repository)
7738
+ repository.enter(node_id, :binary_operator_loc)
7739
+ end
7740
+
6824
7741
  # attr_reader value: Prism::node
6825
7742
  attr_reader :value
6826
7743
 
@@ -6914,6 +7831,12 @@ module Prism
6914
7831
  @name_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
6915
7832
  end
6916
7833
 
7834
+ # Save the name_loc location using the given saved source so that
7835
+ # it can be retrieved later.
7836
+ def save_name_loc(repository)
7837
+ repository.enter(node_id, :name_loc)
7838
+ end
7839
+
6917
7840
  # attr_reader operator_loc: Location
6918
7841
  def operator_loc
6919
7842
  location = @operator_loc
@@ -6921,6 +7844,12 @@ module Prism
6921
7844
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
6922
7845
  end
6923
7846
 
7847
+ # Save the operator_loc location using the given saved source so that
7848
+ # it can be retrieved later.
7849
+ def save_operator_loc(repository)
7850
+ repository.enter(node_id, :operator_loc)
7851
+ end
7852
+
6924
7853
  # attr_reader value: Prism::node
6925
7854
  attr_reader :value
6926
7855
 
@@ -7172,6 +8101,12 @@ module Prism
7172
8101
  @name_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
7173
8102
  end
7174
8103
 
8104
+ # Save the name_loc location using the given saved source so that
8105
+ # it can be retrieved later.
8106
+ def save_name_loc(repository)
8107
+ repository.enter(node_id, :name_loc)
8108
+ end
8109
+
7175
8110
  # The value to write to the global variable. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
7176
8111
  #
7177
8112
  # $foo = :bar
@@ -7191,6 +8126,12 @@ module Prism
7191
8126
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
7192
8127
  end
7193
8128
 
8129
+ # Save the operator_loc location using the given saved source so that
8130
+ # it can be retrieved later.
8131
+ def save_operator_loc(repository)
8132
+ repository.enter(node_id, :operator_loc)
8133
+ end
8134
+
7194
8135
  # def operator: () -> String
7195
8136
  def operator
7196
8137
  operator_loc.slice
@@ -7281,6 +8222,12 @@ module Prism
7281
8222
  @opening_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
7282
8223
  end
7283
8224
 
8225
+ # Save the opening_loc location using the given saved source so that
8226
+ # it can be retrieved later.
8227
+ def save_opening_loc(repository)
8228
+ repository.enter(node_id, :opening_loc)
8229
+ end
8230
+
7284
8231
  # The elements of the hash. These can be either `AssocNode`s or `AssocSplatNode`s.
7285
8232
  #
7286
8233
  # { a: b }
@@ -7300,6 +8247,12 @@ module Prism
7300
8247
  @closing_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
7301
8248
  end
7302
8249
 
8250
+ # Save the closing_loc location using the given saved source so that
8251
+ # it can be retrieved later.
8252
+ def save_closing_loc(repository)
8253
+ repository.enter(node_id, :closing_loc)
8254
+ end
8255
+
7303
8256
  # def opening: () -> String
7304
8257
  def opening
7305
8258
  opening_loc.slice
@@ -7416,6 +8369,12 @@ module Prism
7416
8369
  end
7417
8370
  end
7418
8371
 
8372
+ # Save the opening_loc location using the given saved source so that
8373
+ # it can be retrieved later.
8374
+ def save_opening_loc(repository)
8375
+ repository.enter(node_id, :opening_loc) unless @opening_loc.nil?
8376
+ end
8377
+
7419
8378
  # attr_reader closing_loc: Location?
7420
8379
  def closing_loc
7421
8380
  location = @closing_loc
@@ -7429,6 +8388,12 @@ module Prism
7429
8388
  end
7430
8389
  end
7431
8390
 
8391
+ # Save the closing_loc location using the given saved source so that
8392
+ # it can be retrieved later.
8393
+ def save_closing_loc(repository)
8394
+ repository.enter(node_id, :closing_loc) unless @closing_loc.nil?
8395
+ end
8396
+
7432
8397
  # def opening: () -> String?
7433
8398
  def opening
7434
8399
  opening_loc&.slice
@@ -7547,6 +8512,12 @@ module Prism
7547
8512
  end
7548
8513
  end
7549
8514
 
8515
+ # Save the if_keyword_loc location using the given saved source so that
8516
+ # it can be retrieved later.
8517
+ def save_if_keyword_loc(repository)
8518
+ repository.enter(node_id, :if_keyword_loc) unless @if_keyword_loc.nil?
8519
+ end
8520
+
7550
8521
  # The node for the condition the `IfNode` is testing.
7551
8522
  #
7552
8523
  # if foo
@@ -7580,6 +8551,12 @@ module Prism
7580
8551
  end
7581
8552
  end
7582
8553
 
8554
+ # Save the then_keyword_loc location using the given saved source so that
8555
+ # it can be retrieved later.
8556
+ def save_then_keyword_loc(repository)
8557
+ repository.enter(node_id, :then_keyword_loc) unless @then_keyword_loc.nil?
8558
+ end
8559
+
7583
8560
  # Represents the body of statements that will be executed when the predicate is evaluated as truthy. Will be `nil` when no body is provided.
7584
8561
  #
7585
8562
  # if foo
@@ -7623,6 +8600,12 @@ module Prism
7623
8600
  end
7624
8601
  end
7625
8602
 
8603
+ # Save the end_keyword_loc location using the given saved source so that
8604
+ # it can be retrieved later.
8605
+ def save_end_keyword_loc(repository)
8606
+ repository.enter(node_id, :end_keyword_loc) unless @end_keyword_loc.nil?
8607
+ end
8608
+
7626
8609
  # def if_keyword: () -> String?
7627
8610
  def if_keyword
7628
8611
  if_keyword_loc&.slice
@@ -7961,6 +8944,12 @@ module Prism
7961
8944
  @in_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
7962
8945
  end
7963
8946
 
8947
+ # Save the in_loc location using the given saved source so that
8948
+ # it can be retrieved later.
8949
+ def save_in_loc(repository)
8950
+ repository.enter(node_id, :in_loc)
8951
+ end
8952
+
7964
8953
  # attr_reader then_loc: Location?
7965
8954
  def then_loc
7966
8955
  location = @then_loc
@@ -7974,6 +8963,12 @@ module Prism
7974
8963
  end
7975
8964
  end
7976
8965
 
8966
+ # Save the then_loc location using the given saved source so that
8967
+ # it can be retrieved later.
8968
+ def save_then_loc(repository)
8969
+ repository.enter(node_id, :then_loc) unless @then_loc.nil?
8970
+ end
8971
+
7977
8972
  # def in: () -> String
7978
8973
  def in
7979
8974
  in_loc.slice
@@ -8105,6 +9100,12 @@ module Prism
8105
9100
  end
8106
9101
  end
8107
9102
 
9103
+ # Save the call_operator_loc location using the given saved source so that
9104
+ # it can be retrieved later.
9105
+ def save_call_operator_loc(repository)
9106
+ repository.enter(node_id, :call_operator_loc) unless @call_operator_loc.nil?
9107
+ end
9108
+
8108
9109
  # attr_reader opening_loc: Location
8109
9110
  def opening_loc
8110
9111
  location = @opening_loc
@@ -8112,6 +9113,12 @@ module Prism
8112
9113
  @opening_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
8113
9114
  end
8114
9115
 
9116
+ # Save the opening_loc location using the given saved source so that
9117
+ # it can be retrieved later.
9118
+ def save_opening_loc(repository)
9119
+ repository.enter(node_id, :opening_loc)
9120
+ end
9121
+
8115
9122
  # attr_reader arguments: ArgumentsNode?
8116
9123
  attr_reader :arguments
8117
9124
 
@@ -8122,6 +9129,12 @@ module Prism
8122
9129
  @closing_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
8123
9130
  end
8124
9131
 
9132
+ # Save the closing_loc location using the given saved source so that
9133
+ # it can be retrieved later.
9134
+ def save_closing_loc(repository)
9135
+ repository.enter(node_id, :closing_loc)
9136
+ end
9137
+
8125
9138
  # attr_reader block: BlockArgumentNode?
8126
9139
  attr_reader :block
8127
9140
 
@@ -8132,6 +9145,12 @@ module Prism
8132
9145
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
8133
9146
  end
8134
9147
 
9148
+ # Save the operator_loc location using the given saved source so that
9149
+ # it can be retrieved later.
9150
+ def save_operator_loc(repository)
9151
+ repository.enter(node_id, :operator_loc)
9152
+ end
9153
+
8135
9154
  # attr_reader value: Prism::node
8136
9155
  attr_reader :value
8137
9156
 
@@ -8282,6 +9301,12 @@ module Prism
8282
9301
  end
8283
9302
  end
8284
9303
 
9304
+ # Save the call_operator_loc location using the given saved source so that
9305
+ # it can be retrieved later.
9306
+ def save_call_operator_loc(repository)
9307
+ repository.enter(node_id, :call_operator_loc) unless @call_operator_loc.nil?
9308
+ end
9309
+
8285
9310
  # attr_reader opening_loc: Location
8286
9311
  def opening_loc
8287
9312
  location = @opening_loc
@@ -8289,6 +9314,12 @@ module Prism
8289
9314
  @opening_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
8290
9315
  end
8291
9316
 
9317
+ # Save the opening_loc location using the given saved source so that
9318
+ # it can be retrieved later.
9319
+ def save_opening_loc(repository)
9320
+ repository.enter(node_id, :opening_loc)
9321
+ end
9322
+
8292
9323
  # attr_reader arguments: ArgumentsNode?
8293
9324
  attr_reader :arguments
8294
9325
 
@@ -8299,6 +9330,12 @@ module Prism
8299
9330
  @closing_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
8300
9331
  end
8301
9332
 
9333
+ # Save the closing_loc location using the given saved source so that
9334
+ # it can be retrieved later.
9335
+ def save_closing_loc(repository)
9336
+ repository.enter(node_id, :closing_loc)
9337
+ end
9338
+
8302
9339
  # attr_reader block: BlockArgumentNode?
8303
9340
  attr_reader :block
8304
9341
 
@@ -8312,6 +9349,12 @@ module Prism
8312
9349
  @binary_operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
8313
9350
  end
8314
9351
 
9352
+ # Save the binary_operator_loc location using the given saved source so that
9353
+ # it can be retrieved later.
9354
+ def save_binary_operator_loc(repository)
9355
+ repository.enter(node_id, :binary_operator_loc)
9356
+ end
9357
+
8315
9358
  # attr_reader value: Prism::node
8316
9359
  attr_reader :value
8317
9360
 
@@ -8457,6 +9500,12 @@ module Prism
8457
9500
  end
8458
9501
  end
8459
9502
 
9503
+ # Save the call_operator_loc location using the given saved source so that
9504
+ # it can be retrieved later.
9505
+ def save_call_operator_loc(repository)
9506
+ repository.enter(node_id, :call_operator_loc) unless @call_operator_loc.nil?
9507
+ end
9508
+
8460
9509
  # attr_reader opening_loc: Location
8461
9510
  def opening_loc
8462
9511
  location = @opening_loc
@@ -8464,6 +9513,12 @@ module Prism
8464
9513
  @opening_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
8465
9514
  end
8466
9515
 
9516
+ # Save the opening_loc location using the given saved source so that
9517
+ # it can be retrieved later.
9518
+ def save_opening_loc(repository)
9519
+ repository.enter(node_id, :opening_loc)
9520
+ end
9521
+
8467
9522
  # attr_reader arguments: ArgumentsNode?
8468
9523
  attr_reader :arguments
8469
9524
 
@@ -8474,6 +9529,12 @@ module Prism
8474
9529
  @closing_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
8475
9530
  end
8476
9531
 
9532
+ # Save the closing_loc location using the given saved source so that
9533
+ # it can be retrieved later.
9534
+ def save_closing_loc(repository)
9535
+ repository.enter(node_id, :closing_loc)
9536
+ end
9537
+
8477
9538
  # attr_reader block: BlockArgumentNode?
8478
9539
  attr_reader :block
8479
9540
 
@@ -8484,6 +9545,12 @@ module Prism
8484
9545
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
8485
9546
  end
8486
9547
 
9548
+ # Save the operator_loc location using the given saved source so that
9549
+ # it can be retrieved later.
9550
+ def save_operator_loc(repository)
9551
+ repository.enter(node_id, :operator_loc)
9552
+ end
9553
+
8487
9554
  # attr_reader value: Prism::node
8488
9555
  attr_reader :value
8489
9556
 
@@ -8631,6 +9698,12 @@ module Prism
8631
9698
  @opening_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
8632
9699
  end
8633
9700
 
9701
+ # Save the opening_loc location using the given saved source so that
9702
+ # it can be retrieved later.
9703
+ def save_opening_loc(repository)
9704
+ repository.enter(node_id, :opening_loc)
9705
+ end
9706
+
8634
9707
  # attr_reader arguments: ArgumentsNode?
8635
9708
  attr_reader :arguments
8636
9709
 
@@ -8641,6 +9714,12 @@ module Prism
8641
9714
  @closing_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
8642
9715
  end
8643
9716
 
9717
+ # Save the closing_loc location using the given saved source so that
9718
+ # it can be retrieved later.
9719
+ def save_closing_loc(repository)
9720
+ repository.enter(node_id, :closing_loc)
9721
+ end
9722
+
8644
9723
  # attr_reader block: BlockArgumentNode?
8645
9724
  attr_reader :block
8646
9725
 
@@ -8742,6 +9821,12 @@ module Prism
8742
9821
  @name_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
8743
9822
  end
8744
9823
 
9824
+ # Save the name_loc location using the given saved source so that
9825
+ # it can be retrieved later.
9826
+ def save_name_loc(repository)
9827
+ repository.enter(node_id, :name_loc)
9828
+ end
9829
+
8745
9830
  # attr_reader operator_loc: Location
8746
9831
  def operator_loc
8747
9832
  location = @operator_loc
@@ -8749,6 +9834,12 @@ module Prism
8749
9834
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
8750
9835
  end
8751
9836
 
9837
+ # Save the operator_loc location using the given saved source so that
9838
+ # it can be retrieved later.
9839
+ def save_operator_loc(repository)
9840
+ repository.enter(node_id, :operator_loc)
9841
+ end
9842
+
8752
9843
  # attr_reader value: Prism::node
8753
9844
  attr_reader :value
8754
9845
 
@@ -8844,6 +9935,12 @@ module Prism
8844
9935
  @name_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
8845
9936
  end
8846
9937
 
9938
+ # Save the name_loc location using the given saved source so that
9939
+ # it can be retrieved later.
9940
+ def save_name_loc(repository)
9941
+ repository.enter(node_id, :name_loc)
9942
+ end
9943
+
8847
9944
  # attr_reader binary_operator_loc: Location
8848
9945
  def binary_operator_loc
8849
9946
  location = @binary_operator_loc
@@ -8851,6 +9948,12 @@ module Prism
8851
9948
  @binary_operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
8852
9949
  end
8853
9950
 
9951
+ # Save the binary_operator_loc location using the given saved source so that
9952
+ # it can be retrieved later.
9953
+ def save_binary_operator_loc(repository)
9954
+ repository.enter(node_id, :binary_operator_loc)
9955
+ end
9956
+
8854
9957
  # attr_reader value: Prism::node
8855
9958
  attr_reader :value
8856
9959
 
@@ -8944,6 +10047,12 @@ module Prism
8944
10047
  @name_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
8945
10048
  end
8946
10049
 
10050
+ # Save the name_loc location using the given saved source so that
10051
+ # it can be retrieved later.
10052
+ def save_name_loc(repository)
10053
+ repository.enter(node_id, :name_loc)
10054
+ end
10055
+
8947
10056
  # attr_reader operator_loc: Location
8948
10057
  def operator_loc
8949
10058
  location = @operator_loc
@@ -8951,6 +10060,12 @@ module Prism
8951
10060
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
8952
10061
  end
8953
10062
 
10063
+ # Save the operator_loc location using the given saved source so that
10064
+ # it can be retrieved later.
10065
+ def save_operator_loc(repository)
10066
+ repository.enter(node_id, :operator_loc)
10067
+ end
10068
+
8954
10069
  # attr_reader value: Prism::node
8955
10070
  attr_reader :value
8956
10071
 
@@ -9202,6 +10317,12 @@ module Prism
9202
10317
  @name_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
9203
10318
  end
9204
10319
 
10320
+ # Save the name_loc location using the given saved source so that
10321
+ # it can be retrieved later.
10322
+ def save_name_loc(repository)
10323
+ repository.enter(node_id, :name_loc)
10324
+ end
10325
+
9205
10326
  # The value to write to the instance variable. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
9206
10327
  #
9207
10328
  # @foo = :bar
@@ -9221,6 +10342,12 @@ module Prism
9221
10342
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
9222
10343
  end
9223
10344
 
10345
+ # Save the operator_loc location using the given saved source so that
10346
+ # it can be retrieved later.
10347
+ def save_operator_loc(repository)
10348
+ repository.enter(node_id, :operator_loc)
10349
+ end
10350
+
9224
10351
  # def operator: () -> String
9225
10352
  def operator
9226
10353
  operator_loc.slice
@@ -9457,6 +10584,12 @@ module Prism
9457
10584
  @opening_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
9458
10585
  end
9459
10586
 
10587
+ # Save the opening_loc location using the given saved source so that
10588
+ # it can be retrieved later.
10589
+ def save_opening_loc(repository)
10590
+ repository.enter(node_id, :opening_loc)
10591
+ end
10592
+
9460
10593
  # attr_reader parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode]
9461
10594
  attr_reader :parts
9462
10595
 
@@ -9467,6 +10600,12 @@ module Prism
9467
10600
  @closing_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
9468
10601
  end
9469
10602
 
10603
+ # Save the closing_loc location using the given saved source so that
10604
+ # it can be retrieved later.
10605
+ def save_closing_loc(repository)
10606
+ repository.enter(node_id, :closing_loc)
10607
+ end
10608
+
9470
10609
  # def opening: () -> String
9471
10610
  def opening
9472
10611
  opening_loc.slice
@@ -9615,6 +10754,12 @@ module Prism
9615
10754
  @opening_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
9616
10755
  end
9617
10756
 
10757
+ # Save the opening_loc location using the given saved source so that
10758
+ # it can be retrieved later.
10759
+ def save_opening_loc(repository)
10760
+ repository.enter(node_id, :opening_loc)
10761
+ end
10762
+
9618
10763
  # attr_reader parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode]
9619
10764
  attr_reader :parts
9620
10765
 
@@ -9625,6 +10770,12 @@ module Prism
9625
10770
  @closing_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
9626
10771
  end
9627
10772
 
10773
+ # Save the closing_loc location using the given saved source so that
10774
+ # it can be retrieved later.
10775
+ def save_closing_loc(repository)
10776
+ repository.enter(node_id, :closing_loc)
10777
+ end
10778
+
9628
10779
  # def opening: () -> String
9629
10780
  def opening
9630
10781
  opening_loc.slice
@@ -9698,7 +10849,7 @@ module Prism
9698
10849
  [*opening_loc, *parts, *closing_loc] #: Array[Prism::node | Location]
9699
10850
  end
9700
10851
 
9701
- # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location?, ?parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode | InterpolatedStringNode], ?closing_loc: Location?) -> InterpolatedStringNode
10852
+ # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location?, ?parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode | InterpolatedStringNode | XStringNode], ?closing_loc: Location?) -> InterpolatedStringNode
9702
10853
  def copy(node_id: self.node_id, location: self.location, flags: self.flags, opening_loc: self.opening_loc, parts: self.parts, closing_loc: self.closing_loc)
9703
10854
  InterpolatedStringNode.new(source, node_id, location, flags, opening_loc, parts, closing_loc)
9704
10855
  end
@@ -9706,7 +10857,7 @@ module Prism
9706
10857
  # def deconstruct: () -> Array[nil | Node]
9707
10858
  alias deconstruct child_nodes
9708
10859
 
9709
- # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, opening_loc: Location?, parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode | InterpolatedStringNode], closing_loc: Location? }
10860
+ # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, opening_loc: Location?, parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode | InterpolatedStringNode | XStringNode], closing_loc: Location? }
9710
10861
  def deconstruct_keys(keys)
9711
10862
  { node_id: node_id, location: location, opening_loc: opening_loc, parts: parts, closing_loc: closing_loc }
9712
10863
  end
@@ -9734,7 +10885,13 @@ module Prism
9734
10885
  end
9735
10886
  end
9736
10887
 
9737
- # attr_reader parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode | InterpolatedStringNode]
10888
+ # Save the opening_loc location using the given saved source so that
10889
+ # it can be retrieved later.
10890
+ def save_opening_loc(repository)
10891
+ repository.enter(node_id, :opening_loc) unless @opening_loc.nil?
10892
+ end
10893
+
10894
+ # attr_reader parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode | InterpolatedStringNode | XStringNode]
9738
10895
  attr_reader :parts
9739
10896
 
9740
10897
  # attr_reader closing_loc: Location?
@@ -9750,6 +10907,12 @@ module Prism
9750
10907
  end
9751
10908
  end
9752
10909
 
10910
+ # Save the closing_loc location using the given saved source so that
10911
+ # it can be retrieved later.
10912
+ def save_closing_loc(repository)
10913
+ repository.enter(node_id, :closing_loc) unless @closing_loc.nil?
10914
+ end
10915
+
9753
10916
  # def opening: () -> String?
9754
10917
  def opening
9755
10918
  opening_loc&.slice
@@ -9849,6 +11012,12 @@ module Prism
9849
11012
  end
9850
11013
  end
9851
11014
 
11015
+ # Save the opening_loc location using the given saved source so that
11016
+ # it can be retrieved later.
11017
+ def save_opening_loc(repository)
11018
+ repository.enter(node_id, :opening_loc) unless @opening_loc.nil?
11019
+ end
11020
+
9852
11021
  # attr_reader parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode]
9853
11022
  attr_reader :parts
9854
11023
 
@@ -9865,6 +11034,12 @@ module Prism
9865
11034
  end
9866
11035
  end
9867
11036
 
11037
+ # Save the closing_loc location using the given saved source so that
11038
+ # it can be retrieved later.
11039
+ def save_closing_loc(repository)
11040
+ repository.enter(node_id, :closing_loc) unless @closing_loc.nil?
11041
+ end
11042
+
9868
11043
  # def opening: () -> String?
9869
11044
  def opening
9870
11045
  opening_loc&.slice
@@ -9957,6 +11132,12 @@ module Prism
9957
11132
  @opening_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
9958
11133
  end
9959
11134
 
11135
+ # Save the opening_loc location using the given saved source so that
11136
+ # it can be retrieved later.
11137
+ def save_opening_loc(repository)
11138
+ repository.enter(node_id, :opening_loc)
11139
+ end
11140
+
9960
11141
  # attr_reader parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode]
9961
11142
  attr_reader :parts
9962
11143
 
@@ -9967,6 +11148,12 @@ module Prism
9967
11148
  @closing_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
9968
11149
  end
9969
11150
 
11151
+ # Save the closing_loc location using the given saved source so that
11152
+ # it can be retrieved later.
11153
+ def save_closing_loc(repository)
11154
+ repository.enter(node_id, :closing_loc)
11155
+ end
11156
+
9970
11157
  # def opening: () -> String
9971
11158
  def opening
9972
11159
  opening_loc.slice
@@ -10290,6 +11477,12 @@ module Prism
10290
11477
  end
10291
11478
  end
10292
11479
 
11480
+ # Save the name_loc location using the given saved source so that
11481
+ # it can be retrieved later.
11482
+ def save_name_loc(repository)
11483
+ repository.enter(node_id, :name_loc) unless @name_loc.nil?
11484
+ end
11485
+
10293
11486
  # attr_reader operator_loc: Location
10294
11487
  def operator_loc
10295
11488
  location = @operator_loc
@@ -10297,6 +11490,12 @@ module Prism
10297
11490
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
10298
11491
  end
10299
11492
 
11493
+ # Save the operator_loc location using the given saved source so that
11494
+ # it can be retrieved later.
11495
+ def save_operator_loc(repository)
11496
+ repository.enter(node_id, :operator_loc)
11497
+ end
11498
+
10300
11499
  # def operator: () -> String
10301
11500
  def operator
10302
11501
  operator_loc.slice
@@ -10393,6 +11592,12 @@ module Prism
10393
11592
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
10394
11593
  end
10395
11594
 
11595
+ # Save the operator_loc location using the given saved source so that
11596
+ # it can be retrieved later.
11597
+ def save_operator_loc(repository)
11598
+ repository.enter(node_id, :operator_loc)
11599
+ end
11600
+
10396
11601
  # attr_reader opening_loc: Location
10397
11602
  def opening_loc
10398
11603
  location = @opening_loc
@@ -10400,6 +11605,12 @@ module Prism
10400
11605
  @opening_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
10401
11606
  end
10402
11607
 
11608
+ # Save the opening_loc location using the given saved source so that
11609
+ # it can be retrieved later.
11610
+ def save_opening_loc(repository)
11611
+ repository.enter(node_id, :opening_loc)
11612
+ end
11613
+
10403
11614
  # attr_reader closing_loc: Location
10404
11615
  def closing_loc
10405
11616
  location = @closing_loc
@@ -10407,6 +11618,12 @@ module Prism
10407
11618
  @closing_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
10408
11619
  end
10409
11620
 
11621
+ # Save the closing_loc location using the given saved source so that
11622
+ # it can be retrieved later.
11623
+ def save_closing_loc(repository)
11624
+ repository.enter(node_id, :closing_loc)
11625
+ end
11626
+
10410
11627
  # attr_reader parameters: BlockParametersNode | NumberedParametersNode | ItParametersNode | nil
10411
11628
  attr_reader :parameters
10412
11629
 
@@ -10515,6 +11732,12 @@ module Prism
10515
11732
  @name_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
10516
11733
  end
10517
11734
 
11735
+ # Save the name_loc location using the given saved source so that
11736
+ # it can be retrieved later.
11737
+ def save_name_loc(repository)
11738
+ repository.enter(node_id, :name_loc)
11739
+ end
11740
+
10518
11741
  # attr_reader operator_loc: Location
10519
11742
  def operator_loc
10520
11743
  location = @operator_loc
@@ -10522,6 +11745,12 @@ module Prism
10522
11745
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
10523
11746
  end
10524
11747
 
11748
+ # Save the operator_loc location using the given saved source so that
11749
+ # it can be retrieved later.
11750
+ def save_operator_loc(repository)
11751
+ repository.enter(node_id, :operator_loc)
11752
+ end
11753
+
10525
11754
  # attr_reader value: Prism::node
10526
11755
  attr_reader :value
10527
11756
 
@@ -10622,6 +11851,12 @@ module Prism
10622
11851
  @name_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
10623
11852
  end
10624
11853
 
11854
+ # Save the name_loc location using the given saved source so that
11855
+ # it can be retrieved later.
11856
+ def save_name_loc(repository)
11857
+ repository.enter(node_id, :name_loc)
11858
+ end
11859
+
10625
11860
  # attr_reader binary_operator_loc: Location
10626
11861
  def binary_operator_loc
10627
11862
  location = @binary_operator_loc
@@ -10629,6 +11864,12 @@ module Prism
10629
11864
  @binary_operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
10630
11865
  end
10631
11866
 
11867
+ # Save the binary_operator_loc location using the given saved source so that
11868
+ # it can be retrieved later.
11869
+ def save_binary_operator_loc(repository)
11870
+ repository.enter(node_id, :binary_operator_loc)
11871
+ end
11872
+
10632
11873
  # attr_reader value: Prism::node
10633
11874
  attr_reader :value
10634
11875
 
@@ -10727,6 +11968,12 @@ module Prism
10727
11968
  @name_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
10728
11969
  end
10729
11970
 
11971
+ # Save the name_loc location using the given saved source so that
11972
+ # it can be retrieved later.
11973
+ def save_name_loc(repository)
11974
+ repository.enter(node_id, :name_loc)
11975
+ end
11976
+
10730
11977
  # attr_reader operator_loc: Location
10731
11978
  def operator_loc
10732
11979
  location = @operator_loc
@@ -10734,6 +11981,12 @@ module Prism
10734
11981
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
10735
11982
  end
10736
11983
 
11984
+ # Save the operator_loc location using the given saved source so that
11985
+ # it can be retrieved later.
11986
+ def save_operator_loc(repository)
11987
+ repository.enter(node_id, :operator_loc)
11988
+ end
11989
+
10737
11990
  # attr_reader value: Prism::node
10738
11991
  attr_reader :value
10739
11992
 
@@ -11022,6 +12275,12 @@ module Prism
11022
12275
  @name_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
11023
12276
  end
11024
12277
 
12278
+ # Save the name_loc location using the given saved source so that
12279
+ # it can be retrieved later.
12280
+ def save_name_loc(repository)
12281
+ repository.enter(node_id, :name_loc)
12282
+ end
12283
+
11025
12284
  # The value to write to the local variable. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
11026
12285
  #
11027
12286
  # foo = :bar
@@ -11045,6 +12304,12 @@ module Prism
11045
12304
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
11046
12305
  end
11047
12306
 
12307
+ # Save the operator_loc location using the given saved source so that
12308
+ # it can be retrieved later.
12309
+ def save_operator_loc(repository)
12310
+ repository.enter(node_id, :operator_loc)
12311
+ end
12312
+
11048
12313
  # def operator: () -> String
11049
12314
  def operator
11050
12315
  operator_loc.slice
@@ -11189,6 +12454,12 @@ module Prism
11189
12454
  @opening_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
11190
12455
  end
11191
12456
 
12457
+ # Save the opening_loc location using the given saved source so that
12458
+ # it can be retrieved later.
12459
+ def save_opening_loc(repository)
12460
+ repository.enter(node_id, :opening_loc)
12461
+ end
12462
+
11192
12463
  # attr_reader content_loc: Location
11193
12464
  def content_loc
11194
12465
  location = @content_loc
@@ -11196,6 +12467,12 @@ module Prism
11196
12467
  @content_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
11197
12468
  end
11198
12469
 
12470
+ # Save the content_loc location using the given saved source so that
12471
+ # it can be retrieved later.
12472
+ def save_content_loc(repository)
12473
+ repository.enter(node_id, :content_loc)
12474
+ end
12475
+
11199
12476
  # attr_reader closing_loc: Location
11200
12477
  def closing_loc
11201
12478
  location = @closing_loc
@@ -11203,6 +12480,12 @@ module Prism
11203
12480
  @closing_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
11204
12481
  end
11205
12482
 
12483
+ # Save the closing_loc location using the given saved source so that
12484
+ # it can be retrieved later.
12485
+ def save_closing_loc(repository)
12486
+ repository.enter(node_id, :closing_loc)
12487
+ end
12488
+
11206
12489
  # attr_reader unescaped: String
11207
12490
  attr_reader :unescaped
11208
12491
 
@@ -11310,6 +12593,12 @@ module Prism
11310
12593
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
11311
12594
  end
11312
12595
 
12596
+ # Save the operator_loc location using the given saved source so that
12597
+ # it can be retrieved later.
12598
+ def save_operator_loc(repository)
12599
+ repository.enter(node_id, :operator_loc)
12600
+ end
12601
+
11313
12602
  # def operator: () -> String
11314
12603
  def operator
11315
12604
  operator_loc.slice
@@ -11402,6 +12691,12 @@ module Prism
11402
12691
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
11403
12692
  end
11404
12693
 
12694
+ # Save the operator_loc location using the given saved source so that
12695
+ # it can be retrieved later.
12696
+ def save_operator_loc(repository)
12697
+ repository.enter(node_id, :operator_loc)
12698
+ end
12699
+
11405
12700
  # def operator: () -> String
11406
12701
  def operator
11407
12702
  operator_loc.slice
@@ -11641,6 +12936,12 @@ module Prism
11641
12936
  @module_keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
11642
12937
  end
11643
12938
 
12939
+ # Save the module_keyword_loc location using the given saved source so that
12940
+ # it can be retrieved later.
12941
+ def save_module_keyword_loc(repository)
12942
+ repository.enter(node_id, :module_keyword_loc)
12943
+ end
12944
+
11644
12945
  # attr_reader constant_path: ConstantReadNode | ConstantPathNode | MissingNode
11645
12946
  attr_reader :constant_path
11646
12947
 
@@ -11654,6 +12955,12 @@ module Prism
11654
12955
  @end_keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
11655
12956
  end
11656
12957
 
12958
+ # Save the end_keyword_loc location using the given saved source so that
12959
+ # it can be retrieved later.
12960
+ def save_end_keyword_loc(repository)
12961
+ repository.enter(node_id, :end_keyword_loc)
12962
+ end
12963
+
11657
12964
  # attr_reader name: Symbol
11658
12965
  attr_reader :name
11659
12966
 
@@ -11805,6 +13112,12 @@ module Prism
11805
13112
  end
11806
13113
  end
11807
13114
 
13115
+ # Save the lparen_loc location using the given saved source so that
13116
+ # it can be retrieved later.
13117
+ def save_lparen_loc(repository)
13118
+ repository.enter(node_id, :lparen_loc) unless @lparen_loc.nil?
13119
+ end
13120
+
11808
13121
  # The location of the closing parenthesis.
11809
13122
  #
11810
13123
  # a, (b, c) = 1, 2, 3
@@ -11821,6 +13134,12 @@ module Prism
11821
13134
  end
11822
13135
  end
11823
13136
 
13137
+ # Save the rparen_loc location using the given saved source so that
13138
+ # it can be retrieved later.
13139
+ def save_rparen_loc(repository)
13140
+ repository.enter(node_id, :rparen_loc) unless @rparen_loc.nil?
13141
+ end
13142
+
11824
13143
  # def lparen: () -> String?
11825
13144
  def lparen
11826
13145
  lparen_loc&.slice
@@ -11967,6 +13286,12 @@ module Prism
11967
13286
  end
11968
13287
  end
11969
13288
 
13289
+ # Save the lparen_loc location using the given saved source so that
13290
+ # it can be retrieved later.
13291
+ def save_lparen_loc(repository)
13292
+ repository.enter(node_id, :lparen_loc) unless @lparen_loc.nil?
13293
+ end
13294
+
11970
13295
  # The location of the closing parenthesis.
11971
13296
  #
11972
13297
  # (a, b, c) = 1, 2, 3
@@ -11983,6 +13308,12 @@ module Prism
11983
13308
  end
11984
13309
  end
11985
13310
 
13311
+ # Save the rparen_loc location using the given saved source so that
13312
+ # it can be retrieved later.
13313
+ def save_rparen_loc(repository)
13314
+ repository.enter(node_id, :rparen_loc) unless @rparen_loc.nil?
13315
+ end
13316
+
11986
13317
  # The location of the operator.
11987
13318
  #
11988
13319
  # a, b, c = 1, 2, 3
@@ -11993,6 +13324,12 @@ module Prism
11993
13324
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
11994
13325
  end
11995
13326
 
13327
+ # Save the operator_loc location using the given saved source so that
13328
+ # it can be retrieved later.
13329
+ def save_operator_loc(repository)
13330
+ repository.enter(node_id, :operator_loc)
13331
+ end
13332
+
11996
13333
  # The value to write to the targets. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
11997
13334
  #
11998
13335
  # a, b, c = 1, 2, 3
@@ -12105,6 +13442,12 @@ module Prism
12105
13442
  @keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
12106
13443
  end
12107
13444
 
13445
+ # Save the keyword_loc location using the given saved source so that
13446
+ # it can be retrieved later.
13447
+ def save_keyword_loc(repository)
13448
+ repository.enter(node_id, :keyword_loc)
13449
+ end
13450
+
12108
13451
  # def keyword: () -> String
12109
13452
  def keyword
12110
13453
  keyword_loc.slice
@@ -12258,6 +13601,12 @@ module Prism
12258
13601
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
12259
13602
  end
12260
13603
 
13604
+ # Save the operator_loc location using the given saved source so that
13605
+ # it can be retrieved later.
13606
+ def save_operator_loc(repository)
13607
+ repository.enter(node_id, :operator_loc)
13608
+ end
13609
+
12261
13610
  # attr_reader keyword_loc: Location
12262
13611
  def keyword_loc
12263
13612
  location = @keyword_loc
@@ -12265,6 +13614,12 @@ module Prism
12265
13614
  @keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
12266
13615
  end
12267
13616
 
13617
+ # Save the keyword_loc location using the given saved source so that
13618
+ # it can be retrieved later.
13619
+ def save_keyword_loc(repository)
13620
+ repository.enter(node_id, :keyword_loc)
13621
+ end
13622
+
12268
13623
  # def operator: () -> String
12269
13624
  def operator
12270
13625
  operator_loc.slice
@@ -12516,6 +13871,12 @@ module Prism
12516
13871
  @name_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
12517
13872
  end
12518
13873
 
13874
+ # Save the name_loc location using the given saved source so that
13875
+ # it can be retrieved later.
13876
+ def save_name_loc(repository)
13877
+ repository.enter(node_id, :name_loc)
13878
+ end
13879
+
12519
13880
  # attr_reader value: Prism::node
12520
13881
  attr_reader :value
12521
13882
 
@@ -12611,6 +13972,12 @@ module Prism
12611
13972
  @name_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
12612
13973
  end
12613
13974
 
13975
+ # Save the name_loc location using the given saved source so that
13976
+ # it can be retrieved later.
13977
+ def save_name_loc(repository)
13978
+ repository.enter(node_id, :name_loc)
13979
+ end
13980
+
12614
13981
  # attr_reader operator_loc: Location
12615
13982
  def operator_loc
12616
13983
  location = @operator_loc
@@ -12618,6 +13985,12 @@ module Prism
12618
13985
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
12619
13986
  end
12620
13987
 
13988
+ # Save the operator_loc location using the given saved source so that
13989
+ # it can be retrieved later.
13990
+ def save_operator_loc(repository)
13991
+ repository.enter(node_id, :operator_loc)
13992
+ end
13993
+
12621
13994
  # attr_reader value: Prism::node
12622
13995
  attr_reader :value
12623
13996
 
@@ -12730,6 +14103,12 @@ module Prism
12730
14103
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
12731
14104
  end
12732
14105
 
14106
+ # Save the operator_loc location using the given saved source so that
14107
+ # it can be retrieved later.
14108
+ def save_operator_loc(repository)
14109
+ repository.enter(node_id, :operator_loc)
14110
+ end
14111
+
12733
14112
  # def operator: () -> String
12734
14113
  def operator
12735
14114
  operator_loc.slice
@@ -12927,6 +14306,11 @@ module Prism
12927
14306
  { node_id: node_id, location: location, body: body, opening_loc: opening_loc, closing_loc: closing_loc }
12928
14307
  end
12929
14308
 
14309
+ # def multiple_statements?: () -> bool
14310
+ def multiple_statements?
14311
+ flags.anybits?(ParenthesesNodeFlags::MULTIPLE_STATEMENTS)
14312
+ end
14313
+
12930
14314
  # attr_reader body: Prism::node?
12931
14315
  attr_reader :body
12932
14316
 
@@ -12937,6 +14321,12 @@ module Prism
12937
14321
  @opening_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
12938
14322
  end
12939
14323
 
14324
+ # Save the opening_loc location using the given saved source so that
14325
+ # it can be retrieved later.
14326
+ def save_opening_loc(repository)
14327
+ repository.enter(node_id, :opening_loc)
14328
+ end
14329
+
12940
14330
  # attr_reader closing_loc: Location
12941
14331
  def closing_loc
12942
14332
  location = @closing_loc
@@ -12944,6 +14334,12 @@ module Prism
12944
14334
  @closing_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
12945
14335
  end
12946
14336
 
14337
+ # Save the closing_loc location using the given saved source so that
14338
+ # it can be retrieved later.
14339
+ def save_closing_loc(repository)
14340
+ repository.enter(node_id, :closing_loc)
14341
+ end
14342
+
12947
14343
  # def opening: () -> String
12948
14344
  def opening
12949
14345
  opening_loc.slice
@@ -12973,6 +14369,7 @@ module Prism
12973
14369
  # comparing the value of locations. Locations are checked only for presence.
12974
14370
  def ===(other)
12975
14371
  other.is_a?(ParenthesesNode) &&
14372
+ (flags === other.flags) &&
12976
14373
  (body === other.body) &&
12977
14374
  (opening_loc.nil? == other.opening_loc.nil?) &&
12978
14375
  (closing_loc.nil? == other.closing_loc.nil?)
@@ -13039,6 +14436,12 @@ module Prism
13039
14436
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
13040
14437
  end
13041
14438
 
14439
+ # Save the operator_loc location using the given saved source so that
14440
+ # it can be retrieved later.
14441
+ def save_operator_loc(repository)
14442
+ repository.enter(node_id, :operator_loc)
14443
+ end
14444
+
13042
14445
  # attr_reader lparen_loc: Location
13043
14446
  def lparen_loc
13044
14447
  location = @lparen_loc
@@ -13046,6 +14449,12 @@ module Prism
13046
14449
  @lparen_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
13047
14450
  end
13048
14451
 
14452
+ # Save the lparen_loc location using the given saved source so that
14453
+ # it can be retrieved later.
14454
+ def save_lparen_loc(repository)
14455
+ repository.enter(node_id, :lparen_loc)
14456
+ end
14457
+
13049
14458
  # attr_reader rparen_loc: Location
13050
14459
  def rparen_loc
13051
14460
  location = @rparen_loc
@@ -13053,6 +14462,12 @@ module Prism
13053
14462
  @rparen_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
13054
14463
  end
13055
14464
 
14465
+ # Save the rparen_loc location using the given saved source so that
14466
+ # it can be retrieved later.
14467
+ def save_rparen_loc(repository)
14468
+ repository.enter(node_id, :rparen_loc)
14469
+ end
14470
+
13056
14471
  # def operator: () -> String
13057
14472
  def operator
13058
14473
  operator_loc.slice
@@ -13152,6 +14567,12 @@ module Prism
13152
14567
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
13153
14568
  end
13154
14569
 
14570
+ # Save the operator_loc location using the given saved source so that
14571
+ # it can be retrieved later.
14572
+ def save_operator_loc(repository)
14573
+ repository.enter(node_id, :operator_loc)
14574
+ end
14575
+
13155
14576
  # def operator: () -> String
13156
14577
  def operator
13157
14578
  operator_loc.slice
@@ -13243,6 +14664,12 @@ module Prism
13243
14664
  @keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
13244
14665
  end
13245
14666
 
14667
+ # Save the keyword_loc location using the given saved source so that
14668
+ # it can be retrieved later.
14669
+ def save_keyword_loc(repository)
14670
+ repository.enter(node_id, :keyword_loc)
14671
+ end
14672
+
13246
14673
  # attr_reader opening_loc: Location
13247
14674
  def opening_loc
13248
14675
  location = @opening_loc
@@ -13250,6 +14677,12 @@ module Prism
13250
14677
  @opening_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
13251
14678
  end
13252
14679
 
14680
+ # Save the opening_loc location using the given saved source so that
14681
+ # it can be retrieved later.
14682
+ def save_opening_loc(repository)
14683
+ repository.enter(node_id, :opening_loc)
14684
+ end
14685
+
13253
14686
  # attr_reader closing_loc: Location
13254
14687
  def closing_loc
13255
14688
  location = @closing_loc
@@ -13257,6 +14690,12 @@ module Prism
13257
14690
  @closing_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
13258
14691
  end
13259
14692
 
14693
+ # Save the closing_loc location using the given saved source so that
14694
+ # it can be retrieved later.
14695
+ def save_closing_loc(repository)
14696
+ repository.enter(node_id, :closing_loc)
14697
+ end
14698
+
13260
14699
  # def keyword: () -> String
13261
14700
  def keyword
13262
14701
  keyword_loc.slice
@@ -13360,6 +14799,12 @@ module Prism
13360
14799
  @keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
13361
14800
  end
13362
14801
 
14802
+ # Save the keyword_loc location using the given saved source so that
14803
+ # it can be retrieved later.
14804
+ def save_keyword_loc(repository)
14805
+ repository.enter(node_id, :keyword_loc)
14806
+ end
14807
+
13363
14808
  # attr_reader opening_loc: Location
13364
14809
  def opening_loc
13365
14810
  location = @opening_loc
@@ -13367,6 +14812,12 @@ module Prism
13367
14812
  @opening_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
13368
14813
  end
13369
14814
 
14815
+ # Save the opening_loc location using the given saved source so that
14816
+ # it can be retrieved later.
14817
+ def save_opening_loc(repository)
14818
+ repository.enter(node_id, :opening_loc)
14819
+ end
14820
+
13370
14821
  # attr_reader closing_loc: Location
13371
14822
  def closing_loc
13372
14823
  location = @closing_loc
@@ -13374,6 +14825,12 @@ module Prism
13374
14825
  @closing_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
13375
14826
  end
13376
14827
 
14828
+ # Save the closing_loc location using the given saved source so that
14829
+ # it can be retrieved later.
14830
+ def save_closing_loc(repository)
14831
+ repository.enter(node_id, :closing_loc)
14832
+ end
14833
+
13377
14834
  # def keyword: () -> String
13378
14835
  def keyword
13379
14836
  keyword_loc.slice
@@ -13577,6 +15034,12 @@ module Prism
13577
15034
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
13578
15035
  end
13579
15036
 
15037
+ # Save the operator_loc location using the given saved source so that
15038
+ # it can be retrieved later.
15039
+ def save_operator_loc(repository)
15040
+ repository.enter(node_id, :operator_loc)
15041
+ end
15042
+
13580
15043
  # def operator: () -> String
13581
15044
  def operator
13582
15045
  operator_loc.slice
@@ -13891,6 +15354,12 @@ module Prism
13891
15354
  @opening_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
13892
15355
  end
13893
15356
 
15357
+ # Save the opening_loc location using the given saved source so that
15358
+ # it can be retrieved later.
15359
+ def save_opening_loc(repository)
15360
+ repository.enter(node_id, :opening_loc)
15361
+ end
15362
+
13894
15363
  # attr_reader content_loc: Location
13895
15364
  def content_loc
13896
15365
  location = @content_loc
@@ -13898,6 +15367,12 @@ module Prism
13898
15367
  @content_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
13899
15368
  end
13900
15369
 
15370
+ # Save the content_loc location using the given saved source so that
15371
+ # it can be retrieved later.
15372
+ def save_content_loc(repository)
15373
+ repository.enter(node_id, :content_loc)
15374
+ end
15375
+
13901
15376
  # attr_reader closing_loc: Location
13902
15377
  def closing_loc
13903
15378
  location = @closing_loc
@@ -13905,6 +15380,12 @@ module Prism
13905
15380
  @closing_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
13906
15381
  end
13907
15382
 
15383
+ # Save the closing_loc location using the given saved source so that
15384
+ # it can be retrieved later.
15385
+ def save_closing_loc(repository)
15386
+ repository.enter(node_id, :closing_loc)
15387
+ end
15388
+
13908
15389
  # attr_reader unescaped: String
13909
15390
  attr_reader :unescaped
13910
15391
 
@@ -14014,6 +15495,12 @@ module Prism
14014
15495
  @name_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
14015
15496
  end
14016
15497
 
15498
+ # Save the name_loc location using the given saved source so that
15499
+ # it can be retrieved later.
15500
+ def save_name_loc(repository)
15501
+ repository.enter(node_id, :name_loc)
15502
+ end
15503
+
14017
15504
  # def inspect -> String
14018
15505
  def inspect
14019
15506
  InspectVisitor.compose(self)
@@ -14178,6 +15665,12 @@ module Prism
14178
15665
  @keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
14179
15666
  end
14180
15667
 
15668
+ # Save the keyword_loc location using the given saved source so that
15669
+ # it can be retrieved later.
15670
+ def save_keyword_loc(repository)
15671
+ repository.enter(node_id, :keyword_loc)
15672
+ end
15673
+
14181
15674
  # attr_reader rescue_expression: Prism::node
14182
15675
  attr_reader :rescue_expression
14183
15676
 
@@ -14222,7 +15715,7 @@ module Prism
14222
15715
  # `Foo, *splat, Bar` are in the `exceptions` field. `ex` is in the `reference` field.
14223
15716
  class RescueNode < Node
14224
15717
  # Initialize a new RescueNode node.
14225
- def initialize(source, node_id, location, flags, keyword_loc, exceptions, operator_loc, reference, statements, subsequent)
15718
+ def initialize(source, node_id, location, flags, keyword_loc, exceptions, operator_loc, reference, then_keyword_loc, statements, subsequent)
14226
15719
  @source = source
14227
15720
  @node_id = node_id
14228
15721
  @location = location
@@ -14231,6 +15724,7 @@ module Prism
14231
15724
  @exceptions = exceptions
14232
15725
  @operator_loc = operator_loc
14233
15726
  @reference = reference
15727
+ @then_keyword_loc = then_keyword_loc
14234
15728
  @statements = statements
14235
15729
  @subsequent = subsequent
14236
15730
  end
@@ -14257,20 +15751,20 @@ module Prism
14257
15751
 
14258
15752
  # def comment_targets: () -> Array[Node | Location]
14259
15753
  def comment_targets
14260
- [keyword_loc, *exceptions, *operator_loc, *reference, *statements, *subsequent] #: Array[Prism::node | Location]
15754
+ [keyword_loc, *exceptions, *operator_loc, *reference, *then_keyword_loc, *statements, *subsequent] #: Array[Prism::node | Location]
14261
15755
  end
14262
15756
 
14263
- # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?exceptions: Array[Prism::node], ?operator_loc: Location?, ?reference: LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | BackReferenceReadNode | NumberedReferenceReadNode | MissingNode | nil, ?statements: StatementsNode?, ?subsequent: RescueNode?) -> RescueNode
14264
- def copy(node_id: self.node_id, location: self.location, flags: self.flags, keyword_loc: self.keyword_loc, exceptions: self.exceptions, operator_loc: self.operator_loc, reference: self.reference, statements: self.statements, subsequent: self.subsequent)
14265
- RescueNode.new(source, node_id, location, flags, keyword_loc, exceptions, operator_loc, reference, statements, subsequent)
15757
+ # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?exceptions: Array[Prism::node], ?operator_loc: Location?, ?reference: LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | BackReferenceReadNode | NumberedReferenceReadNode | MissingNode | nil, ?then_keyword_loc: Location?, ?statements: StatementsNode?, ?subsequent: RescueNode?) -> RescueNode
15758
+ def copy(node_id: self.node_id, location: self.location, flags: self.flags, keyword_loc: self.keyword_loc, exceptions: self.exceptions, operator_loc: self.operator_loc, reference: self.reference, then_keyword_loc: self.then_keyword_loc, statements: self.statements, subsequent: self.subsequent)
15759
+ RescueNode.new(source, node_id, location, flags, keyword_loc, exceptions, operator_loc, reference, then_keyword_loc, statements, subsequent)
14266
15760
  end
14267
15761
 
14268
15762
  # def deconstruct: () -> Array[nil | Node]
14269
15763
  alias deconstruct child_nodes
14270
15764
 
14271
- # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, keyword_loc: Location, exceptions: Array[Prism::node], operator_loc: Location?, reference: LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | BackReferenceReadNode | NumberedReferenceReadNode | MissingNode | nil, statements: StatementsNode?, subsequent: RescueNode? }
15765
+ # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, keyword_loc: Location, exceptions: Array[Prism::node], operator_loc: Location?, reference: LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | BackReferenceReadNode | NumberedReferenceReadNode | MissingNode | nil, then_keyword_loc: Location?, statements: StatementsNode?, subsequent: RescueNode? }
14272
15766
  def deconstruct_keys(keys)
14273
- { node_id: node_id, location: location, keyword_loc: keyword_loc, exceptions: exceptions, operator_loc: operator_loc, reference: reference, statements: statements, subsequent: subsequent }
15767
+ { node_id: node_id, location: location, keyword_loc: keyword_loc, exceptions: exceptions, operator_loc: operator_loc, reference: reference, then_keyword_loc: then_keyword_loc, statements: statements, subsequent: subsequent }
14274
15768
  end
14275
15769
 
14276
15770
  # attr_reader keyword_loc: Location
@@ -14280,6 +15774,12 @@ module Prism
14280
15774
  @keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
14281
15775
  end
14282
15776
 
15777
+ # Save the keyword_loc location using the given saved source so that
15778
+ # it can be retrieved later.
15779
+ def save_keyword_loc(repository)
15780
+ repository.enter(node_id, :keyword_loc)
15781
+ end
15782
+
14283
15783
  # attr_reader exceptions: Array[Prism::node]
14284
15784
  attr_reader :exceptions
14285
15785
 
@@ -14296,9 +15796,34 @@ module Prism
14296
15796
  end
14297
15797
  end
14298
15798
 
15799
+ # Save the operator_loc location using the given saved source so that
15800
+ # it can be retrieved later.
15801
+ def save_operator_loc(repository)
15802
+ repository.enter(node_id, :operator_loc) unless @operator_loc.nil?
15803
+ end
15804
+
14299
15805
  # attr_reader reference: LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | BackReferenceReadNode | NumberedReferenceReadNode | MissingNode | nil
14300
15806
  attr_reader :reference
14301
15807
 
15808
+ # attr_reader then_keyword_loc: Location?
15809
+ def then_keyword_loc
15810
+ location = @then_keyword_loc
15811
+ case location
15812
+ when nil
15813
+ nil
15814
+ when Location
15815
+ location
15816
+ else
15817
+ @then_keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
15818
+ end
15819
+ end
15820
+
15821
+ # Save the then_keyword_loc location using the given saved source so that
15822
+ # it can be retrieved later.
15823
+ def save_then_keyword_loc(repository)
15824
+ repository.enter(node_id, :then_keyword_loc) unless @then_keyword_loc.nil?
15825
+ end
15826
+
14302
15827
  # attr_reader statements: StatementsNode?
14303
15828
  attr_reader :statements
14304
15829
 
@@ -14315,6 +15840,11 @@ module Prism
14315
15840
  operator_loc&.slice
14316
15841
  end
14317
15842
 
15843
+ # def then_keyword: () -> String?
15844
+ def then_keyword
15845
+ then_keyword_loc&.slice
15846
+ end
15847
+
14318
15848
  # def inspect -> String
14319
15849
  def inspect
14320
15850
  InspectVisitor.compose(self)
@@ -14339,6 +15869,7 @@ module Prism
14339
15869
  exceptions.zip(other.exceptions).all? { |left, right| left === right } &&
14340
15870
  (operator_loc.nil? == other.operator_loc.nil?) &&
14341
15871
  (reference === other.reference) &&
15872
+ (then_keyword_loc.nil? == other.then_keyword_loc.nil?) &&
14342
15873
  (statements === other.statements) &&
14343
15874
  (subsequent === other.subsequent)
14344
15875
  end
@@ -14415,6 +15946,12 @@ module Prism
14415
15946
  end
14416
15947
  end
14417
15948
 
15949
+ # Save the name_loc location using the given saved source so that
15950
+ # it can be retrieved later.
15951
+ def save_name_loc(repository)
15952
+ repository.enter(node_id, :name_loc) unless @name_loc.nil?
15953
+ end
15954
+
14418
15955
  # attr_reader operator_loc: Location
14419
15956
  def operator_loc
14420
15957
  location = @operator_loc
@@ -14422,6 +15959,12 @@ module Prism
14422
15959
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
14423
15960
  end
14424
15961
 
15962
+ # Save the operator_loc location using the given saved source so that
15963
+ # it can be retrieved later.
15964
+ def save_operator_loc(repository)
15965
+ repository.enter(node_id, :operator_loc)
15966
+ end
15967
+
14425
15968
  # def operator: () -> String
14426
15969
  def operator
14427
15970
  operator_loc.slice
@@ -14578,6 +16121,12 @@ module Prism
14578
16121
  @keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
14579
16122
  end
14580
16123
 
16124
+ # Save the keyword_loc location using the given saved source so that
16125
+ # it can be retrieved later.
16126
+ def save_keyword_loc(repository)
16127
+ repository.enter(node_id, :keyword_loc)
16128
+ end
16129
+
14581
16130
  # attr_reader arguments: ArgumentsNode?
14582
16131
  attr_reader :arguments
14583
16132
 
@@ -14833,6 +16382,12 @@ module Prism
14833
16382
  @class_keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
14834
16383
  end
14835
16384
 
16385
+ # Save the class_keyword_loc location using the given saved source so that
16386
+ # it can be retrieved later.
16387
+ def save_class_keyword_loc(repository)
16388
+ repository.enter(node_id, :class_keyword_loc)
16389
+ end
16390
+
14836
16391
  # attr_reader operator_loc: Location
14837
16392
  def operator_loc
14838
16393
  location = @operator_loc
@@ -14840,6 +16395,12 @@ module Prism
14840
16395
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
14841
16396
  end
14842
16397
 
16398
+ # Save the operator_loc location using the given saved source so that
16399
+ # it can be retrieved later.
16400
+ def save_operator_loc(repository)
16401
+ repository.enter(node_id, :operator_loc)
16402
+ end
16403
+
14843
16404
  # attr_reader expression: Prism::node
14844
16405
  attr_reader :expression
14845
16406
 
@@ -14853,6 +16414,12 @@ module Prism
14853
16414
  @end_keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
14854
16415
  end
14855
16416
 
16417
+ # Save the end_keyword_loc location using the given saved source so that
16418
+ # it can be retrieved later.
16419
+ def save_end_keyword_loc(repository)
16420
+ repository.enter(node_id, :end_keyword_loc)
16421
+ end
16422
+
14856
16423
  # def class_keyword: () -> String
14857
16424
  def class_keyword
14858
16425
  class_keyword_loc.slice
@@ -15184,6 +16751,12 @@ module Prism
15184
16751
  @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
15185
16752
  end
15186
16753
 
16754
+ # Save the operator_loc location using the given saved source so that
16755
+ # it can be retrieved later.
16756
+ def save_operator_loc(repository)
16757
+ repository.enter(node_id, :operator_loc)
16758
+ end
16759
+
15187
16760
  # attr_reader expression: Prism::node?
15188
16761
  attr_reader :expression
15189
16762
 
@@ -15379,6 +16952,12 @@ module Prism
15379
16952
  end
15380
16953
  end
15381
16954
 
16955
+ # Save the opening_loc location using the given saved source so that
16956
+ # it can be retrieved later.
16957
+ def save_opening_loc(repository)
16958
+ repository.enter(node_id, :opening_loc) unless @opening_loc.nil?
16959
+ end
16960
+
15382
16961
  # attr_reader content_loc: Location
15383
16962
  def content_loc
15384
16963
  location = @content_loc
@@ -15386,6 +16965,12 @@ module Prism
15386
16965
  @content_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
15387
16966
  end
15388
16967
 
16968
+ # Save the content_loc location using the given saved source so that
16969
+ # it can be retrieved later.
16970
+ def save_content_loc(repository)
16971
+ repository.enter(node_id, :content_loc)
16972
+ end
16973
+
15389
16974
  # attr_reader closing_loc: Location?
15390
16975
  def closing_loc
15391
16976
  location = @closing_loc
@@ -15399,6 +16984,12 @@ module Prism
15399
16984
  end
15400
16985
  end
15401
16986
 
16987
+ # Save the closing_loc location using the given saved source so that
16988
+ # it can be retrieved later.
16989
+ def save_closing_loc(repository)
16990
+ repository.enter(node_id, :closing_loc) unless @closing_loc.nil?
16991
+ end
16992
+
15402
16993
  # attr_reader unescaped: String
15403
16994
  attr_reader :unescaped
15404
16995
 
@@ -15508,6 +17099,12 @@ module Prism
15508
17099
  @keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
15509
17100
  end
15510
17101
 
17102
+ # Save the keyword_loc location using the given saved source so that
17103
+ # it can be retrieved later.
17104
+ def save_keyword_loc(repository)
17105
+ repository.enter(node_id, :keyword_loc)
17106
+ end
17107
+
15511
17108
  # attr_reader lparen_loc: Location?
15512
17109
  def lparen_loc
15513
17110
  location = @lparen_loc
@@ -15521,6 +17118,12 @@ module Prism
15521
17118
  end
15522
17119
  end
15523
17120
 
17121
+ # Save the lparen_loc location using the given saved source so that
17122
+ # it can be retrieved later.
17123
+ def save_lparen_loc(repository)
17124
+ repository.enter(node_id, :lparen_loc) unless @lparen_loc.nil?
17125
+ end
17126
+
15524
17127
  # attr_reader arguments: ArgumentsNode?
15525
17128
  attr_reader :arguments
15526
17129
 
@@ -15537,6 +17140,12 @@ module Prism
15537
17140
  end
15538
17141
  end
15539
17142
 
17143
+ # Save the rparen_loc location using the given saved source so that
17144
+ # it can be retrieved later.
17145
+ def save_rparen_loc(repository)
17146
+ repository.enter(node_id, :rparen_loc) unless @rparen_loc.nil?
17147
+ end
17148
+
15540
17149
  # attr_reader block: BlockNode | BlockArgumentNode | nil
15541
17150
  attr_reader :block
15542
17151
 
@@ -15663,6 +17272,12 @@ module Prism
15663
17272
  end
15664
17273
  end
15665
17274
 
17275
+ # Save the opening_loc location using the given saved source so that
17276
+ # it can be retrieved later.
17277
+ def save_opening_loc(repository)
17278
+ repository.enter(node_id, :opening_loc) unless @opening_loc.nil?
17279
+ end
17280
+
15666
17281
  # attr_reader value_loc: Location?
15667
17282
  def value_loc
15668
17283
  location = @value_loc
@@ -15676,6 +17291,12 @@ module Prism
15676
17291
  end
15677
17292
  end
15678
17293
 
17294
+ # Save the value_loc location using the given saved source so that
17295
+ # it can be retrieved later.
17296
+ def save_value_loc(repository)
17297
+ repository.enter(node_id, :value_loc) unless @value_loc.nil?
17298
+ end
17299
+
15679
17300
  # attr_reader closing_loc: Location?
15680
17301
  def closing_loc
15681
17302
  location = @closing_loc
@@ -15689,6 +17310,12 @@ module Prism
15689
17310
  end
15690
17311
  end
15691
17312
 
17313
+ # Save the closing_loc location using the given saved source so that
17314
+ # it can be retrieved later.
17315
+ def save_closing_loc(repository)
17316
+ repository.enter(node_id, :closing_loc) unless @closing_loc.nil?
17317
+ end
17318
+
15692
17319
  # attr_reader unescaped: String
15693
17320
  attr_reader :unescaped
15694
17321
 
@@ -15860,6 +17487,12 @@ module Prism
15860
17487
  @keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
15861
17488
  end
15862
17489
 
17490
+ # Save the keyword_loc location using the given saved source so that
17491
+ # it can be retrieved later.
17492
+ def save_keyword_loc(repository)
17493
+ repository.enter(node_id, :keyword_loc)
17494
+ end
17495
+
15863
17496
  # def keyword: () -> String
15864
17497
  def keyword
15865
17498
  keyword_loc.slice
@@ -15962,6 +17595,12 @@ module Prism
15962
17595
  @keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
15963
17596
  end
15964
17597
 
17598
+ # Save the keyword_loc location using the given saved source so that
17599
+ # it can be retrieved later.
17600
+ def save_keyword_loc(repository)
17601
+ repository.enter(node_id, :keyword_loc)
17602
+ end
17603
+
15965
17604
  # The condition to be evaluated for the unless expression. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
15966
17605
  #
15967
17606
  # unless cond then bar end
@@ -15987,6 +17626,12 @@ module Prism
15987
17626
  end
15988
17627
  end
15989
17628
 
17629
+ # Save the then_keyword_loc location using the given saved source so that
17630
+ # it can be retrieved later.
17631
+ def save_then_keyword_loc(repository)
17632
+ repository.enter(node_id, :then_keyword_loc) unless @then_keyword_loc.nil?
17633
+ end
17634
+
15990
17635
  # The body of statements that will executed if the unless condition is
15991
17636
  # falsey. Will be `nil` if no body is provided.
15992
17637
  #
@@ -16016,6 +17661,12 @@ module Prism
16016
17661
  end
16017
17662
  end
16018
17663
 
17664
+ # Save the end_keyword_loc location using the given saved source so that
17665
+ # it can be retrieved later.
17666
+ def save_end_keyword_loc(repository)
17667
+ repository.enter(node_id, :end_keyword_loc) unless @end_keyword_loc.nil?
17668
+ end
17669
+
16019
17670
  # def keyword: () -> String
16020
17671
  def keyword
16021
17672
  keyword_loc.slice
@@ -16068,12 +17719,13 @@ module Prism
16068
17719
  # ^^^^^^^^^^^^^^^^^^^^
16069
17720
  class UntilNode < Node
16070
17721
  # Initialize a new UntilNode node.
16071
- def initialize(source, node_id, location, flags, keyword_loc, closing_loc, predicate, statements)
17722
+ def initialize(source, node_id, location, flags, keyword_loc, do_keyword_loc, closing_loc, predicate, statements)
16072
17723
  @source = source
16073
17724
  @node_id = node_id
16074
17725
  @location = location
16075
17726
  @flags = flags
16076
17727
  @keyword_loc = keyword_loc
17728
+ @do_keyword_loc = do_keyword_loc
16077
17729
  @closing_loc = closing_loc
16078
17730
  @predicate = predicate
16079
17731
  @statements = statements
@@ -16099,20 +17751,20 @@ module Prism
16099
17751
 
16100
17752
  # def comment_targets: () -> Array[Node | Location]
16101
17753
  def comment_targets
16102
- [keyword_loc, *closing_loc, predicate, *statements] #: Array[Prism::node | Location]
17754
+ [keyword_loc, *do_keyword_loc, *closing_loc, predicate, *statements] #: Array[Prism::node | Location]
16103
17755
  end
16104
17756
 
16105
- # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?closing_loc: Location?, ?predicate: Prism::node, ?statements: StatementsNode?) -> UntilNode
16106
- def copy(node_id: self.node_id, location: self.location, flags: self.flags, keyword_loc: self.keyword_loc, closing_loc: self.closing_loc, predicate: self.predicate, statements: self.statements)
16107
- UntilNode.new(source, node_id, location, flags, keyword_loc, closing_loc, predicate, statements)
17757
+ # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?do_keyword_loc: Location?, ?closing_loc: Location?, ?predicate: Prism::node, ?statements: StatementsNode?) -> UntilNode
17758
+ def copy(node_id: self.node_id, location: self.location, flags: self.flags, keyword_loc: self.keyword_loc, do_keyword_loc: self.do_keyword_loc, closing_loc: self.closing_loc, predicate: self.predicate, statements: self.statements)
17759
+ UntilNode.new(source, node_id, location, flags, keyword_loc, do_keyword_loc, closing_loc, predicate, statements)
16108
17760
  end
16109
17761
 
16110
17762
  # def deconstruct: () -> Array[nil | Node]
16111
17763
  alias deconstruct child_nodes
16112
17764
 
16113
- # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, keyword_loc: Location, closing_loc: Location?, predicate: Prism::node, statements: StatementsNode? }
17765
+ # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, keyword_loc: Location, do_keyword_loc: Location?, closing_loc: Location?, predicate: Prism::node, statements: StatementsNode? }
16114
17766
  def deconstruct_keys(keys)
16115
- { node_id: node_id, location: location, keyword_loc: keyword_loc, closing_loc: closing_loc, predicate: predicate, statements: statements }
17767
+ { node_id: node_id, location: location, keyword_loc: keyword_loc, do_keyword_loc: do_keyword_loc, closing_loc: closing_loc, predicate: predicate, statements: statements }
16116
17768
  end
16117
17769
 
16118
17770
  # def begin_modifier?: () -> bool
@@ -16127,6 +17779,31 @@ module Prism
16127
17779
  @keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
16128
17780
  end
16129
17781
 
17782
+ # Save the keyword_loc location using the given saved source so that
17783
+ # it can be retrieved later.
17784
+ def save_keyword_loc(repository)
17785
+ repository.enter(node_id, :keyword_loc)
17786
+ end
17787
+
17788
+ # attr_reader do_keyword_loc: Location?
17789
+ def do_keyword_loc
17790
+ location = @do_keyword_loc
17791
+ case location
17792
+ when nil
17793
+ nil
17794
+ when Location
17795
+ location
17796
+ else
17797
+ @do_keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
17798
+ end
17799
+ end
17800
+
17801
+ # Save the do_keyword_loc location using the given saved source so that
17802
+ # it can be retrieved later.
17803
+ def save_do_keyword_loc(repository)
17804
+ repository.enter(node_id, :do_keyword_loc) unless @do_keyword_loc.nil?
17805
+ end
17806
+
16130
17807
  # attr_reader closing_loc: Location?
16131
17808
  def closing_loc
16132
17809
  location = @closing_loc
@@ -16140,6 +17817,12 @@ module Prism
16140
17817
  end
16141
17818
  end
16142
17819
 
17820
+ # Save the closing_loc location using the given saved source so that
17821
+ # it can be retrieved later.
17822
+ def save_closing_loc(repository)
17823
+ repository.enter(node_id, :closing_loc) unless @closing_loc.nil?
17824
+ end
17825
+
16143
17826
  # attr_reader predicate: Prism::node
16144
17827
  attr_reader :predicate
16145
17828
 
@@ -16151,6 +17834,11 @@ module Prism
16151
17834
  keyword_loc.slice
16152
17835
  end
16153
17836
 
17837
+ # def do_keyword: () -> String?
17838
+ def do_keyword
17839
+ do_keyword_loc&.slice
17840
+ end
17841
+
16154
17842
  # def closing: () -> String?
16155
17843
  def closing
16156
17844
  closing_loc&.slice
@@ -16177,6 +17865,7 @@ module Prism
16177
17865
  other.is_a?(UntilNode) &&
16178
17866
  (flags === other.flags) &&
16179
17867
  (keyword_loc.nil? == other.keyword_loc.nil?) &&
17868
+ (do_keyword_loc.nil? == other.do_keyword_loc.nil?) &&
16180
17869
  (closing_loc.nil? == other.closing_loc.nil?) &&
16181
17870
  (predicate === other.predicate) &&
16182
17871
  (statements === other.statements)
@@ -16245,6 +17934,12 @@ module Prism
16245
17934
  @keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
16246
17935
  end
16247
17936
 
17937
+ # Save the keyword_loc location using the given saved source so that
17938
+ # it can be retrieved later.
17939
+ def save_keyword_loc(repository)
17940
+ repository.enter(node_id, :keyword_loc)
17941
+ end
17942
+
16248
17943
  # attr_reader conditions: Array[Prism::node]
16249
17944
  attr_reader :conditions
16250
17945
 
@@ -16261,6 +17956,12 @@ module Prism
16261
17956
  end
16262
17957
  end
16263
17958
 
17959
+ # Save the then_keyword_loc location using the given saved source so that
17960
+ # it can be retrieved later.
17961
+ def save_then_keyword_loc(repository)
17962
+ repository.enter(node_id, :then_keyword_loc) unless @then_keyword_loc.nil?
17963
+ end
17964
+
16264
17965
  # attr_reader statements: StatementsNode?
16265
17966
  attr_reader :statements
16266
17967
 
@@ -16310,12 +18011,13 @@ module Prism
16310
18011
  # ^^^^^^^^^^^^^^^^^^^^
16311
18012
  class WhileNode < Node
16312
18013
  # Initialize a new WhileNode node.
16313
- def initialize(source, node_id, location, flags, keyword_loc, closing_loc, predicate, statements)
18014
+ def initialize(source, node_id, location, flags, keyword_loc, do_keyword_loc, closing_loc, predicate, statements)
16314
18015
  @source = source
16315
18016
  @node_id = node_id
16316
18017
  @location = location
16317
18018
  @flags = flags
16318
18019
  @keyword_loc = keyword_loc
18020
+ @do_keyword_loc = do_keyword_loc
16319
18021
  @closing_loc = closing_loc
16320
18022
  @predicate = predicate
16321
18023
  @statements = statements
@@ -16341,20 +18043,20 @@ module Prism
16341
18043
 
16342
18044
  # def comment_targets: () -> Array[Node | Location]
16343
18045
  def comment_targets
16344
- [keyword_loc, *closing_loc, predicate, *statements] #: Array[Prism::node | Location]
18046
+ [keyword_loc, *do_keyword_loc, *closing_loc, predicate, *statements] #: Array[Prism::node | Location]
16345
18047
  end
16346
18048
 
16347
- # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?closing_loc: Location?, ?predicate: Prism::node, ?statements: StatementsNode?) -> WhileNode
16348
- def copy(node_id: self.node_id, location: self.location, flags: self.flags, keyword_loc: self.keyword_loc, closing_loc: self.closing_loc, predicate: self.predicate, statements: self.statements)
16349
- WhileNode.new(source, node_id, location, flags, keyword_loc, closing_loc, predicate, statements)
18049
+ # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?do_keyword_loc: Location?, ?closing_loc: Location?, ?predicate: Prism::node, ?statements: StatementsNode?) -> WhileNode
18050
+ def copy(node_id: self.node_id, location: self.location, flags: self.flags, keyword_loc: self.keyword_loc, do_keyword_loc: self.do_keyword_loc, closing_loc: self.closing_loc, predicate: self.predicate, statements: self.statements)
18051
+ WhileNode.new(source, node_id, location, flags, keyword_loc, do_keyword_loc, closing_loc, predicate, statements)
16350
18052
  end
16351
18053
 
16352
18054
  # def deconstruct: () -> Array[nil | Node]
16353
18055
  alias deconstruct child_nodes
16354
18056
 
16355
- # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, keyword_loc: Location, closing_loc: Location?, predicate: Prism::node, statements: StatementsNode? }
18057
+ # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, keyword_loc: Location, do_keyword_loc: Location?, closing_loc: Location?, predicate: Prism::node, statements: StatementsNode? }
16356
18058
  def deconstruct_keys(keys)
16357
- { node_id: node_id, location: location, keyword_loc: keyword_loc, closing_loc: closing_loc, predicate: predicate, statements: statements }
18059
+ { node_id: node_id, location: location, keyword_loc: keyword_loc, do_keyword_loc: do_keyword_loc, closing_loc: closing_loc, predicate: predicate, statements: statements }
16358
18060
  end
16359
18061
 
16360
18062
  # def begin_modifier?: () -> bool
@@ -16369,6 +18071,31 @@ module Prism
16369
18071
  @keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
16370
18072
  end
16371
18073
 
18074
+ # Save the keyword_loc location using the given saved source so that
18075
+ # it can be retrieved later.
18076
+ def save_keyword_loc(repository)
18077
+ repository.enter(node_id, :keyword_loc)
18078
+ end
18079
+
18080
+ # attr_reader do_keyword_loc: Location?
18081
+ def do_keyword_loc
18082
+ location = @do_keyword_loc
18083
+ case location
18084
+ when nil
18085
+ nil
18086
+ when Location
18087
+ location
18088
+ else
18089
+ @do_keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
18090
+ end
18091
+ end
18092
+
18093
+ # Save the do_keyword_loc location using the given saved source so that
18094
+ # it can be retrieved later.
18095
+ def save_do_keyword_loc(repository)
18096
+ repository.enter(node_id, :do_keyword_loc) unless @do_keyword_loc.nil?
18097
+ end
18098
+
16372
18099
  # attr_reader closing_loc: Location?
16373
18100
  def closing_loc
16374
18101
  location = @closing_loc
@@ -16382,6 +18109,12 @@ module Prism
16382
18109
  end
16383
18110
  end
16384
18111
 
18112
+ # Save the closing_loc location using the given saved source so that
18113
+ # it can be retrieved later.
18114
+ def save_closing_loc(repository)
18115
+ repository.enter(node_id, :closing_loc) unless @closing_loc.nil?
18116
+ end
18117
+
16385
18118
  # attr_reader predicate: Prism::node
16386
18119
  attr_reader :predicate
16387
18120
 
@@ -16393,6 +18126,11 @@ module Prism
16393
18126
  keyword_loc.slice
16394
18127
  end
16395
18128
 
18129
+ # def do_keyword: () -> String?
18130
+ def do_keyword
18131
+ do_keyword_loc&.slice
18132
+ end
18133
+
16396
18134
  # def closing: () -> String?
16397
18135
  def closing
16398
18136
  closing_loc&.slice
@@ -16419,6 +18157,7 @@ module Prism
16419
18157
  other.is_a?(WhileNode) &&
16420
18158
  (flags === other.flags) &&
16421
18159
  (keyword_loc.nil? == other.keyword_loc.nil?) &&
18160
+ (do_keyword_loc.nil? == other.do_keyword_loc.nil?) &&
16422
18161
  (closing_loc.nil? == other.closing_loc.nil?) &&
16423
18162
  (predicate === other.predicate) &&
16424
18163
  (statements === other.statements)
@@ -16492,6 +18231,12 @@ module Prism
16492
18231
  @opening_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
16493
18232
  end
16494
18233
 
18234
+ # Save the opening_loc location using the given saved source so that
18235
+ # it can be retrieved later.
18236
+ def save_opening_loc(repository)
18237
+ repository.enter(node_id, :opening_loc)
18238
+ end
18239
+
16495
18240
  # attr_reader content_loc: Location
16496
18241
  def content_loc
16497
18242
  location = @content_loc
@@ -16499,6 +18244,12 @@ module Prism
16499
18244
  @content_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
16500
18245
  end
16501
18246
 
18247
+ # Save the content_loc location using the given saved source so that
18248
+ # it can be retrieved later.
18249
+ def save_content_loc(repository)
18250
+ repository.enter(node_id, :content_loc)
18251
+ end
18252
+
16502
18253
  # attr_reader closing_loc: Location
16503
18254
  def closing_loc
16504
18255
  location = @closing_loc
@@ -16506,6 +18257,12 @@ module Prism
16506
18257
  @closing_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
16507
18258
  end
16508
18259
 
18260
+ # Save the closing_loc location using the given saved source so that
18261
+ # it can be retrieved later.
18262
+ def save_closing_loc(repository)
18263
+ repository.enter(node_id, :closing_loc)
18264
+ end
18265
+
16509
18266
  # attr_reader unescaped: String
16510
18267
  attr_reader :unescaped
16511
18268
 
@@ -16610,6 +18367,12 @@ module Prism
16610
18367
  @keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
16611
18368
  end
16612
18369
 
18370
+ # Save the keyword_loc location using the given saved source so that
18371
+ # it can be retrieved later.
18372
+ def save_keyword_loc(repository)
18373
+ repository.enter(node_id, :keyword_loc)
18374
+ end
18375
+
16613
18376
  # attr_reader lparen_loc: Location?
16614
18377
  def lparen_loc
16615
18378
  location = @lparen_loc
@@ -16623,6 +18386,12 @@ module Prism
16623
18386
  end
16624
18387
  end
16625
18388
 
18389
+ # Save the lparen_loc location using the given saved source so that
18390
+ # it can be retrieved later.
18391
+ def save_lparen_loc(repository)
18392
+ repository.enter(node_id, :lparen_loc) unless @lparen_loc.nil?
18393
+ end
18394
+
16626
18395
  # attr_reader arguments: ArgumentsNode?
16627
18396
  attr_reader :arguments
16628
18397
 
@@ -16639,6 +18408,12 @@ module Prism
16639
18408
  end
16640
18409
  end
16641
18410
 
18411
+ # Save the rparen_loc location using the given saved source so that
18412
+ # it can be retrieved later.
18413
+ def save_rparen_loc(repository)
18414
+ repository.enter(node_id, :rparen_loc) unless @rparen_loc.nil?
18415
+ end
18416
+
16642
18417
  # def keyword: () -> String
16643
18418
  def keyword
16644
18419
  keyword_loc.slice
@@ -16770,6 +18545,12 @@ module Prism
16770
18545
  REPEATED_PARAMETER = 1 << 2
16771
18546
  end
16772
18547
 
18548
+ # Flags for parentheses nodes.
18549
+ module ParenthesesNodeFlags
18550
+ # parentheses that contain multiple potentially void statements
18551
+ MULTIPLE_STATEMENTS = 1 << 2
18552
+ end
18553
+
16773
18554
  # Flags for range and flip-flop nodes.
16774
18555
  module RangeFlags
16775
18556
  # ... operator