prism 0.23.0 → 0.25.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +4 -4
  2. data/BSDmakefile +58 -0
  3. data/CHANGELOG.md +65 -1
  4. data/Makefile +5 -2
  5. data/README.md +45 -6
  6. data/config.yml +499 -4
  7. data/docs/build_system.md +31 -0
  8. data/docs/configuration.md +2 -0
  9. data/docs/cruby_compilation.md +1 -1
  10. data/docs/parser_translation.md +14 -9
  11. data/docs/releasing.md +3 -3
  12. data/docs/ripper_translation.md +50 -0
  13. data/docs/ruby_api.md +1 -0
  14. data/docs/serialization.md +26 -5
  15. data/ext/prism/api_node.c +2342 -1801
  16. data/ext/prism/api_pack.c +9 -0
  17. data/ext/prism/extconf.rb +27 -11
  18. data/ext/prism/extension.c +313 -66
  19. data/ext/prism/extension.h +5 -4
  20. data/include/prism/ast.h +213 -64
  21. data/include/prism/defines.h +106 -2
  22. data/include/prism/diagnostic.h +134 -71
  23. data/include/prism/encoding.h +22 -4
  24. data/include/prism/node.h +93 -0
  25. data/include/prism/options.h +82 -7
  26. data/include/prism/pack.h +11 -0
  27. data/include/prism/parser.h +198 -53
  28. data/include/prism/prettyprint.h +8 -0
  29. data/include/prism/static_literals.h +118 -0
  30. data/include/prism/util/pm_buffer.h +65 -2
  31. data/include/prism/util/pm_constant_pool.h +18 -1
  32. data/include/prism/util/pm_integer.h +119 -0
  33. data/include/prism/util/pm_list.h +1 -1
  34. data/include/prism/util/pm_newline_list.h +12 -3
  35. data/include/prism/util/pm_string.h +26 -2
  36. data/include/prism/version.h +2 -2
  37. data/include/prism.h +59 -1
  38. data/lib/prism/compiler.rb +8 -1
  39. data/lib/prism/debug.rb +46 -3
  40. data/lib/prism/desugar_compiler.rb +225 -80
  41. data/lib/prism/dispatcher.rb +29 -0
  42. data/lib/prism/dot_visitor.rb +87 -16
  43. data/lib/prism/dsl.rb +315 -300
  44. data/lib/prism/ffi.rb +165 -84
  45. data/lib/prism/lex_compat.rb +17 -15
  46. data/lib/prism/mutation_compiler.rb +11 -0
  47. data/lib/prism/node.rb +4857 -3750
  48. data/lib/prism/node_ext.rb +77 -29
  49. data/lib/prism/pack.rb +4 -0
  50. data/lib/prism/parse_result/comments.rb +34 -17
  51. data/lib/prism/parse_result/newlines.rb +3 -1
  52. data/lib/prism/parse_result.rb +88 -34
  53. data/lib/prism/pattern.rb +16 -4
  54. data/lib/prism/polyfill/string.rb +12 -0
  55. data/lib/prism/serialize.rb +960 -327
  56. data/lib/prism/translation/parser/compiler.rb +152 -50
  57. data/lib/prism/translation/parser/lexer.rb +103 -22
  58. data/lib/prism/translation/parser/rubocop.rb +47 -11
  59. data/lib/prism/translation/parser.rb +134 -10
  60. data/lib/prism/translation/parser33.rb +12 -0
  61. data/lib/prism/translation/parser34.rb +12 -0
  62. data/lib/prism/translation/ripper/sexp.rb +125 -0
  63. data/lib/prism/translation/ripper/shim.rb +5 -0
  64. data/lib/prism/translation/ripper.rb +3248 -379
  65. data/lib/prism/translation/ruby_parser.rb +35 -18
  66. data/lib/prism/translation.rb +3 -1
  67. data/lib/prism/visitor.rb +10 -0
  68. data/lib/prism.rb +8 -2
  69. data/prism.gemspec +35 -4
  70. data/rbi/prism/compiler.rbi +14 -0
  71. data/rbi/prism/desugar_compiler.rbi +5 -0
  72. data/rbi/prism/mutation_compiler.rbi +5 -0
  73. data/rbi/prism/node.rbi +8221 -0
  74. data/rbi/prism/node_ext.rbi +102 -0
  75. data/rbi/prism/parse_result.rbi +304 -0
  76. data/rbi/prism/translation/parser/compiler.rbi +13 -0
  77. data/rbi/prism/translation/ripper/ripper_compiler.rbi +5 -0
  78. data/rbi/prism/translation/ripper.rbi +25 -0
  79. data/rbi/prism/translation/ruby_parser.rbi +11 -0
  80. data/rbi/prism/visitor.rbi +470 -0
  81. data/rbi/prism.rbi +39 -7749
  82. data/sig/prism/compiler.rbs +9 -0
  83. data/sig/prism/dispatcher.rbs +16 -0
  84. data/sig/prism/dot_visitor.rbs +6 -0
  85. data/sig/prism/dsl.rbs +462 -0
  86. data/sig/prism/mutation_compiler.rbs +158 -0
  87. data/sig/prism/node.rbs +3529 -0
  88. data/sig/prism/node_ext.rbs +78 -0
  89. data/sig/prism/pack.rbs +43 -0
  90. data/sig/prism/parse_result.rbs +127 -0
  91. data/sig/prism/pattern.rbs +13 -0
  92. data/sig/prism/serialize.rbs +7 -0
  93. data/sig/prism/visitor.rbs +168 -0
  94. data/sig/prism.rbs +188 -4767
  95. data/src/diagnostic.c +575 -230
  96. data/src/encoding.c +211 -108
  97. data/src/node.c +7526 -447
  98. data/src/options.c +36 -12
  99. data/src/pack.c +33 -17
  100. data/src/prettyprint.c +1297 -1388
  101. data/src/prism.c +3665 -1121
  102. data/src/regexp.c +17 -2
  103. data/src/serialize.c +47 -28
  104. data/src/static_literals.c +552 -0
  105. data/src/token_type.c +1 -0
  106. data/src/util/pm_buffer.c +147 -20
  107. data/src/util/pm_char.c +4 -4
  108. data/src/util/pm_constant_pool.c +35 -11
  109. data/src/util/pm_integer.c +629 -0
  110. data/src/util/pm_list.c +1 -1
  111. data/src/util/pm_newline_list.c +20 -8
  112. data/src/util/pm_string.c +134 -5
  113. data/src/util/pm_string_list.c +2 -2
  114. metadata +37 -6
  115. data/docs/ripper.md +0 -36
  116. data/rbi/prism_static.rbi +0 -207
  117. data/sig/prism_static.rbs +0 -201
@@ -1,6 +1,216 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Prism
4
+ class DesugarAndWriteNode # :nodoc:
5
+ attr_reader :node, :source, :read_class, :write_class, :arguments
6
+
7
+ def initialize(node, source, read_class, write_class, *arguments)
8
+ @node = node
9
+ @source = source
10
+ @read_class = read_class
11
+ @write_class = write_class
12
+ @arguments = arguments
13
+ end
14
+
15
+ # Desugar `x &&= y` to `x && x = y`
16
+ def compile
17
+ AndNode.new(
18
+ source,
19
+ read_class.new(source, *arguments, node.name_loc),
20
+ write_class.new(source, *arguments, node.name_loc, node.value, node.operator_loc, node.location),
21
+ node.operator_loc,
22
+ node.location
23
+ )
24
+ end
25
+ end
26
+
27
+ class DesugarOrWriteDefinedNode # :nodoc:
28
+ attr_reader :node, :source, :read_class, :write_class, :arguments
29
+
30
+ def initialize(node, source, read_class, write_class, *arguments)
31
+ @node = node
32
+ @source = source
33
+ @read_class = read_class
34
+ @write_class = write_class
35
+ @arguments = arguments
36
+ end
37
+
38
+ # Desugar `x ||= y` to `defined?(x) ? x : x = y`
39
+ def compile
40
+ IfNode.new(
41
+ source,
42
+ node.operator_loc,
43
+ DefinedNode.new(source, nil, read_class.new(source, *arguments, node.name_loc), nil, node.operator_loc, node.name_loc),
44
+ node.operator_loc,
45
+ StatementsNode.new(source, [read_class.new(source, *arguments, node.name_loc)], node.location),
46
+ ElseNode.new(
47
+ source,
48
+ node.operator_loc,
49
+ StatementsNode.new(
50
+ source,
51
+ [write_class.new(source, *arguments, node.name_loc, node.value, node.operator_loc, node.location)],
52
+ node.location
53
+ ),
54
+ node.operator_loc,
55
+ node.location
56
+ ),
57
+ node.operator_loc,
58
+ node.location
59
+ )
60
+ end
61
+ end
62
+
63
+ class DesugarOperatorWriteNode # :nodoc:
64
+ attr_reader :node, :source, :read_class, :write_class, :arguments
65
+
66
+ def initialize(node, source, read_class, write_class, *arguments)
67
+ @node = node
68
+ @source = source
69
+ @read_class = read_class
70
+ @write_class = write_class
71
+ @arguments = arguments
72
+ end
73
+
74
+ # Desugar `x += y` to `x = x + y`
75
+ def compile
76
+ write_class.new(
77
+ source,
78
+ *arguments,
79
+ node.name_loc,
80
+ CallNode.new(
81
+ source,
82
+ 0,
83
+ read_class.new(source, *arguments, node.name_loc),
84
+ nil,
85
+ node.operator_loc.slice.chomp("=").to_sym,
86
+ node.operator_loc.copy(length: node.operator_loc.length - 1),
87
+ nil,
88
+ ArgumentsNode.new(source, 0, [node.value], node.value.location),
89
+ nil,
90
+ nil,
91
+ node.location
92
+ ),
93
+ node.operator_loc.copy(start_offset: node.operator_loc.end_offset - 1, length: 1),
94
+ node.location
95
+ )
96
+ end
97
+ end
98
+
99
+ class DesugarOrWriteNode # :nodoc:
100
+ attr_reader :node, :source, :read_class, :write_class, :arguments
101
+
102
+ def initialize(node, source, read_class, write_class, *arguments)
103
+ @node = node
104
+ @source = source
105
+ @read_class = read_class
106
+ @write_class = write_class
107
+ @arguments = arguments
108
+ end
109
+
110
+ # Desugar `x ||= y` to `x || x = y`
111
+ def compile
112
+ OrNode.new(
113
+ source,
114
+ read_class.new(source, *arguments, node.name_loc),
115
+ write_class.new(source, *arguments, node.name_loc, node.value, node.operator_loc, node.location),
116
+ node.operator_loc,
117
+ node.location
118
+ )
119
+ end
120
+ end
121
+
122
+ private_constant :DesugarAndWriteNode, :DesugarOrWriteNode, :DesugarOrWriteDefinedNode, :DesugarOperatorWriteNode
123
+
124
+ class ClassVariableAndWriteNode
125
+ def desugar # :nodoc:
126
+ DesugarAndWriteNode.new(self, source, ClassVariableReadNode, ClassVariableWriteNode, name).compile
127
+ end
128
+ end
129
+
130
+ class ClassVariableOrWriteNode
131
+ def desugar # :nodoc:
132
+ DesugarOrWriteDefinedNode.new(self, source, ClassVariableReadNode, ClassVariableWriteNode, name).compile
133
+ end
134
+ end
135
+
136
+ class ClassVariableOperatorWriteNode
137
+ def desugar # :nodoc:
138
+ DesugarOperatorWriteNode.new(self, source, ClassVariableReadNode, ClassVariableWriteNode, name).compile
139
+ end
140
+ end
141
+
142
+ class ConstantAndWriteNode
143
+ def desugar # :nodoc:
144
+ DesugarAndWriteNode.new(self, source, ConstantReadNode, ConstantWriteNode, name).compile
145
+ end
146
+ end
147
+
148
+ class ConstantOrWriteNode
149
+ def desugar # :nodoc:
150
+ DesugarOrWriteDefinedNode.new(self, source, ConstantReadNode, ConstantWriteNode, name).compile
151
+ end
152
+ end
153
+
154
+ class ConstantOperatorWriteNode
155
+ def desugar # :nodoc:
156
+ DesugarOperatorWriteNode.new(self, source, ConstantReadNode, ConstantWriteNode, name).compile
157
+ end
158
+ end
159
+
160
+ class GlobalVariableAndWriteNode
161
+ def desugar # :nodoc:
162
+ DesugarAndWriteNode.new(self, source, GlobalVariableReadNode, GlobalVariableWriteNode, name).compile
163
+ end
164
+ end
165
+
166
+ class GlobalVariableOrWriteNode
167
+ def desugar # :nodoc:
168
+ DesugarOrWriteDefinedNode.new(self, source, GlobalVariableReadNode, GlobalVariableWriteNode, name).compile
169
+ end
170
+ end
171
+
172
+ class GlobalVariableOperatorWriteNode
173
+ def desugar # :nodoc:
174
+ DesugarOperatorWriteNode.new(self, source, GlobalVariableReadNode, GlobalVariableWriteNode, name).compile
175
+ end
176
+ end
177
+
178
+ class InstanceVariableAndWriteNode
179
+ def desugar # :nodoc:
180
+ DesugarAndWriteNode.new(self, source, InstanceVariableReadNode, InstanceVariableWriteNode, name).compile
181
+ end
182
+ end
183
+
184
+ class InstanceVariableOrWriteNode
185
+ def desugar # :nodoc:
186
+ DesugarOrWriteNode.new(self, source, InstanceVariableReadNode, InstanceVariableWriteNode, name).compile
187
+ end
188
+ end
189
+
190
+ class InstanceVariableOperatorWriteNode
191
+ def desugar # :nodoc:
192
+ DesugarOperatorWriteNode.new(self, source, InstanceVariableReadNode, InstanceVariableWriteNode, name).compile
193
+ end
194
+ end
195
+
196
+ class LocalVariableAndWriteNode
197
+ def desugar # :nodoc:
198
+ DesugarAndWriteNode.new(self, source, LocalVariableReadNode, LocalVariableWriteNode, name, depth).compile
199
+ end
200
+ end
201
+
202
+ class LocalVariableOrWriteNode
203
+ def desugar # :nodoc:
204
+ DesugarOrWriteNode.new(self, source, LocalVariableReadNode, LocalVariableWriteNode, name, depth).compile
205
+ end
206
+ end
207
+
208
+ class LocalVariableOperatorWriteNode
209
+ def desugar # :nodoc:
210
+ DesugarOperatorWriteNode.new(self, source, LocalVariableReadNode, LocalVariableWriteNode, name, depth).compile
211
+ end
212
+ end
213
+
4
214
  # DesugarCompiler is a compiler that desugars Ruby code into a more primitive
5
215
  # form. This is useful for consumers that want to deal with fewer node types.
6
216
  class DesugarCompiler < MutationCompiler
@@ -10,7 +220,7 @@ module Prism
10
220
  #
11
221
  # @@foo && @@foo = bar
12
222
  def visit_class_variable_and_write_node(node)
13
- desugar_and_write_node(node, ClassVariableReadNode, ClassVariableWriteNode, node.name)
223
+ node.desugar
14
224
  end
15
225
 
16
226
  # @@foo ||= bar
@@ -19,7 +229,7 @@ module Prism
19
229
  #
20
230
  # defined?(@@foo) ? @@foo : @@foo = bar
21
231
  def visit_class_variable_or_write_node(node)
22
- desugar_or_write_defined_node(node, ClassVariableReadNode, ClassVariableWriteNode, node.name)
232
+ node.desugar
23
233
  end
24
234
 
25
235
  # @@foo += bar
@@ -28,7 +238,7 @@ module Prism
28
238
  #
29
239
  # @@foo = @@foo + bar
30
240
  def visit_class_variable_operator_write_node(node)
31
- desugar_operator_write_node(node, ClassVariableReadNode, ClassVariableWriteNode, node.name)
241
+ node.desugar
32
242
  end
33
243
 
34
244
  # Foo &&= bar
@@ -37,7 +247,7 @@ module Prism
37
247
  #
38
248
  # Foo && Foo = bar
39
249
  def visit_constant_and_write_node(node)
40
- desugar_and_write_node(node, ConstantReadNode, ConstantWriteNode, node.name)
250
+ node.desugar
41
251
  end
42
252
 
43
253
  # Foo ||= bar
@@ -46,7 +256,7 @@ module Prism
46
256
  #
47
257
  # defined?(Foo) ? Foo : Foo = bar
48
258
  def visit_constant_or_write_node(node)
49
- desugar_or_write_defined_node(node, ConstantReadNode, ConstantWriteNode, node.name)
259
+ node.desugar
50
260
  end
51
261
 
52
262
  # Foo += bar
@@ -55,7 +265,7 @@ module Prism
55
265
  #
56
266
  # Foo = Foo + bar
57
267
  def visit_constant_operator_write_node(node)
58
- desugar_operator_write_node(node, ConstantReadNode, ConstantWriteNode, node.name)
268
+ node.desugar
59
269
  end
60
270
 
61
271
  # $foo &&= bar
@@ -64,7 +274,7 @@ module Prism
64
274
  #
65
275
  # $foo && $foo = bar
66
276
  def visit_global_variable_and_write_node(node)
67
- desugar_and_write_node(node, GlobalVariableReadNode, GlobalVariableWriteNode, node.name)
277
+ node.desugar
68
278
  end
69
279
 
70
280
  # $foo ||= bar
@@ -73,7 +283,7 @@ module Prism
73
283
  #
74
284
  # defined?($foo) ? $foo : $foo = bar
75
285
  def visit_global_variable_or_write_node(node)
76
- desugar_or_write_defined_node(node, GlobalVariableReadNode, GlobalVariableWriteNode, node.name)
286
+ node.desugar
77
287
  end
78
288
 
79
289
  # $foo += bar
@@ -82,7 +292,7 @@ module Prism
82
292
  #
83
293
  # $foo = $foo + bar
84
294
  def visit_global_variable_operator_write_node(node)
85
- desugar_operator_write_node(node, GlobalVariableReadNode, GlobalVariableWriteNode, node.name)
295
+ node.desugar
86
296
  end
87
297
 
88
298
  # @foo &&= bar
@@ -91,7 +301,7 @@ module Prism
91
301
  #
92
302
  # @foo && @foo = bar
93
303
  def visit_instance_variable_and_write_node(node)
94
- desugar_and_write_node(node, InstanceVariableReadNode, InstanceVariableWriteNode, node.name)
304
+ node.desugar
95
305
  end
96
306
 
97
307
  # @foo ||= bar
@@ -100,7 +310,7 @@ module Prism
100
310
  #
101
311
  # @foo || @foo = bar
102
312
  def visit_instance_variable_or_write_node(node)
103
- desugar_or_write_node(node, InstanceVariableReadNode, InstanceVariableWriteNode, node.name)
313
+ node.desugar
104
314
  end
105
315
 
106
316
  # @foo += bar
@@ -109,7 +319,7 @@ module Prism
109
319
  #
110
320
  # @foo = @foo + bar
111
321
  def visit_instance_variable_operator_write_node(node)
112
- desugar_operator_write_node(node, InstanceVariableReadNode, InstanceVariableWriteNode, node.name)
322
+ node.desugar
113
323
  end
114
324
 
115
325
  # foo &&= bar
@@ -118,7 +328,7 @@ module Prism
118
328
  #
119
329
  # foo && foo = bar
120
330
  def visit_local_variable_and_write_node(node)
121
- desugar_and_write_node(node, LocalVariableReadNode, LocalVariableWriteNode, node.name, node.depth)
331
+ node.desugar
122
332
  end
123
333
 
124
334
  # foo ||= bar
@@ -127,7 +337,7 @@ module Prism
127
337
  #
128
338
  # foo || foo = bar
129
339
  def visit_local_variable_or_write_node(node)
130
- desugar_or_write_node(node, LocalVariableReadNode, LocalVariableWriteNode, node.name, node.depth)
340
+ node.desugar
131
341
  end
132
342
 
133
343
  # foo += bar
@@ -136,72 +346,7 @@ module Prism
136
346
  #
137
347
  # foo = foo + bar
138
348
  def visit_local_variable_operator_write_node(node)
139
- desugar_operator_write_node(node, LocalVariableReadNode, LocalVariableWriteNode, node.name, node.depth)
140
- end
141
-
142
- private
143
-
144
- # Desugar `x &&= y` to `x && x = y`
145
- def desugar_and_write_node(node, read_class, write_class, *arguments)
146
- AndNode.new(
147
- read_class.new(*arguments, node.name_loc),
148
- write_class.new(*arguments, node.name_loc, node.value, node.operator_loc, node.location),
149
- node.operator_loc,
150
- node.location
151
- )
152
- end
153
-
154
- # Desugar `x += y` to `x = x + y`
155
- def desugar_operator_write_node(node, read_class, write_class, *arguments)
156
- write_class.new(
157
- *arguments,
158
- node.name_loc,
159
- CallNode.new(
160
- 0,
161
- read_class.new(*arguments, node.name_loc),
162
- nil,
163
- node.operator_loc.slice.chomp("="),
164
- node.operator_loc.copy(length: node.operator_loc.length - 1),
165
- nil,
166
- ArgumentsNode.new(0, [node.value], node.value.location),
167
- nil,
168
- nil,
169
- node.location
170
- ),
171
- node.operator_loc.copy(start_offset: node.operator_loc.end_offset - 1, length: 1),
172
- node.location
173
- )
174
- end
175
-
176
- # Desugar `x ||= y` to `x || x = y`
177
- def desugar_or_write_node(node, read_class, write_class, *arguments)
178
- OrNode.new(
179
- read_class.new(*arguments, node.name_loc),
180
- write_class.new(*arguments, node.name_loc, node.value, node.operator_loc, node.location),
181
- node.operator_loc,
182
- node.location
183
- )
184
- end
185
-
186
- # Desugar `x ||= y` to `defined?(x) ? x : x = y`
187
- def desugar_or_write_defined_node(node, read_class, write_class, *arguments)
188
- IfNode.new(
189
- node.operator_loc,
190
- DefinedNode.new(nil, read_class.new(*arguments, node.name_loc), nil, node.operator_loc, node.name_loc),
191
- node.operator_loc,
192
- StatementsNode.new([read_class.new(*arguments, node.name_loc)], node.location),
193
- ElseNode.new(
194
- node.operator_loc,
195
- StatementsNode.new(
196
- [write_class.new(*arguments, node.name_loc, node.value, node.operator_loc, node.location)],
197
- node.location
198
- ),
199
- node.operator_loc,
200
- node.location
201
- ),
202
- node.operator_loc,
203
- node.location
204
- )
349
+ node.desugar
205
350
  end
206
351
  end
207
352
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  =begin
3
4
  This file is generated by the templates/template.rb script and should not be
4
5
  modified manually. See templates/lib/prism/dispatcher.rb.erb
@@ -761,6 +762,14 @@ module Prism
761
762
  listeners[:on_interpolated_x_string_node_leave]&.each { |listener| listener.on_interpolated_x_string_node_leave(node) }
762
763
  end
763
764
 
765
+ # Dispatch enter and leave events for ItParametersNode nodes and continue
766
+ # walking the tree.
767
+ def visit_it_parameters_node(node)
768
+ listeners[:on_it_parameters_node_enter]&.each { |listener| listener.on_it_parameters_node_enter(node) }
769
+ super
770
+ listeners[:on_it_parameters_node_leave]&.each { |listener| listener.on_it_parameters_node_leave(node) }
771
+ end
772
+
764
773
  # Dispatch enter and leave events for KeywordHashNode nodes and continue
765
774
  # walking the tree.
766
775
  def visit_keyword_hash_node(node)
@@ -1113,6 +1122,14 @@ module Prism
1113
1122
  listeners[:on_self_node_leave]&.each { |listener| listener.on_self_node_leave(node) }
1114
1123
  end
1115
1124
 
1125
+ # Dispatch enter and leave events for ShareableConstantNode nodes and continue
1126
+ # walking the tree.
1127
+ def visit_shareable_constant_node(node)
1128
+ listeners[:on_shareable_constant_node_enter]&.each { |listener| listener.on_shareable_constant_node_enter(node) }
1129
+ super
1130
+ listeners[:on_shareable_constant_node_leave]&.each { |listener| listener.on_shareable_constant_node_leave(node) }
1131
+ end
1132
+
1116
1133
  # Dispatch enter and leave events for SingletonClassNode nodes and continue
1117
1134
  # walking the tree.
1118
1135
  def visit_singleton_class_node(node)
@@ -1778,6 +1795,12 @@ module Prism
1778
1795
  listeners[:on_interpolated_x_string_node_leave]&.each { |listener| listener.on_interpolated_x_string_node_leave(node) }
1779
1796
  end
1780
1797
 
1798
+ # Dispatch enter and leave events for ItParametersNode nodes.
1799
+ def visit_it_parameters_node(node)
1800
+ listeners[:on_it_parameters_node_enter]&.each { |listener| listener.on_it_parameters_node_enter(node) }
1801
+ listeners[:on_it_parameters_node_leave]&.each { |listener| listener.on_it_parameters_node_leave(node) }
1802
+ end
1803
+
1781
1804
  # Dispatch enter and leave events for KeywordHashNode nodes.
1782
1805
  def visit_keyword_hash_node(node)
1783
1806
  listeners[:on_keyword_hash_node_enter]&.each { |listener| listener.on_keyword_hash_node_enter(node) }
@@ -2042,6 +2065,12 @@ module Prism
2042
2065
  listeners[:on_self_node_leave]&.each { |listener| listener.on_self_node_leave(node) }
2043
2066
  end
2044
2067
 
2068
+ # Dispatch enter and leave events for ShareableConstantNode nodes.
2069
+ def visit_shareable_constant_node(node)
2070
+ listeners[:on_shareable_constant_node_enter]&.each { |listener| listener.on_shareable_constant_node_enter(node) }
2071
+ listeners[:on_shareable_constant_node_leave]&.each { |listener| listener.on_shareable_constant_node_leave(node) }
2072
+ end
2073
+
2045
2074
  # Dispatch enter and leave events for SingletonClassNode nodes.
2046
2075
  def visit_singleton_class_node(node)
2047
2076
  listeners[:on_singleton_class_node_enter]&.each { |listener| listener.on_singleton_class_node_enter(node) }