rfmt 1.7.0 → 2.0.0.beta1

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 (42) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +25 -0
  3. data/Cargo.lock +90 -1225
  4. data/Cargo.toml +6 -0
  5. data/README.md +32 -28
  6. data/ext/rfmt/Cargo.toml +9 -28
  7. data/ext/rfmt/src/ast/mod.rs +2 -0
  8. data/ext/rfmt/src/config/mod.rs +267 -30
  9. data/ext/rfmt/src/error/mod.rs +14 -3
  10. data/ext/rfmt/src/format/formatter.rs +22 -11
  11. data/ext/rfmt/src/format/registry.rs +8 -0
  12. data/ext/rfmt/src/format/rule.rs +208 -136
  13. data/ext/rfmt/src/format/rules/call.rs +14 -22
  14. data/ext/rfmt/src/format/rules/fallback.rs +4 -11
  15. data/ext/rfmt/src/format/rules/if_unless.rs +25 -3
  16. data/ext/rfmt/src/format/rules/loops.rs +3 -1
  17. data/ext/rfmt/src/format/rules/variable_write.rs +16 -9
  18. data/ext/rfmt/src/lib.rs +45 -12
  19. data/ext/rfmt/src/parser/mod.rs +2 -0
  20. data/ext/rfmt/src/parser/native_adapter.rs +2735 -0
  21. data/ext/rfmt/src/parser/prism_adapter.rs +5 -0
  22. data/ext/rfmt/src/validation.rs +69 -0
  23. data/ext/rfmt/tests/fixtures/parity/comments_mixed.rb +9 -0
  24. data/ext/rfmt/tests/fixtures/parity/constructs.rb +50 -0
  25. data/ext/rfmt/tests/fixtures/parity/embdoc.rb +12 -0
  26. data/ext/rfmt/tests/fixtures/parity/heredoc_assign.rb +15 -0
  27. data/ext/rfmt/tests/fixtures/parity/heredoc_call_args.rb +17 -0
  28. data/ext/rfmt/tests/fixtures/parity/metadata_classes.rb +30 -0
  29. data/ext/rfmt/tests/fixtures/parity/metadata_conditionals.rb +14 -0
  30. data/ext/rfmt/tests/fixtures/parity/metadata_defs.rb +33 -0
  31. data/ext/rfmt/tests/fixtures/parity/multibyte.rb +14 -0
  32. data/ext/rfmt/tests/fixtures/parity/numeric.rb +6 -0
  33. data/ext/rfmt/tests/fixtures/parity/plain.rb +31 -0
  34. data/ext/rfmt/tests/native_parity.rs +245 -0
  35. data/ext/rfmt/tests/ruby_prism_smoke.rs +66 -0
  36. data/lib/rfmt/cli.rb +37 -7
  37. data/lib/rfmt/configuration.rb +2 -20
  38. data/lib/rfmt/version.rb +1 -1
  39. data/lib/rfmt.rb +47 -19
  40. metadata +17 -18
  41. data/lib/rfmt/prism_bridge.rb +0 -529
  42. data/lib/rfmt/prism_node_extractor.rb +0 -115
@@ -0,0 +1,2735 @@
1
+ //! Native ruby-prism -> internal AST converter (prism migration phases 3-4).
2
+ //!
3
+ //! Ports the conversion semantics of the pre-migration Ruby bridge
4
+ //! (`lib/rfmt/prism_bridge.rb`, now only in git history) exactly, so its
5
+ //! frozen output can be diffed node-by-node (`tests/native_parity.rs`),
6
+ //! including the live per-type metadata keys and the flat root comment list.
7
+ //! Comments below cite the bridge's files and line numbers as of deletion.
8
+
9
+ use crate::ast::{
10
+ Comment, CommentPosition, CommentType, FormattingInfo, Location, Node as AstNode, NodeType,
11
+ };
12
+ use crate::error::{Result, RfmtError};
13
+ use crate::parser::RubyParser;
14
+ use ruby_prism::{
15
+ ArgumentsNode, ConstantId, Location as PrismLocation, Node as PrismNode, ParseResult, Visit,
16
+ };
17
+ use std::collections::HashMap;
18
+
19
+ /// Parses Ruby source with the ruby-prism crate and converts it to the
20
+ /// internal tree, without any round-trip through Ruby/JSON.
21
+ pub struct NativeAdapter;
22
+
23
+ impl NativeAdapter {
24
+ pub fn new() -> Self {
25
+ Self
26
+ }
27
+ }
28
+
29
+ impl Default for NativeAdapter {
30
+ fn default() -> Self {
31
+ Self::new()
32
+ }
33
+ }
34
+
35
+ impl RubyParser for NativeAdapter {
36
+ fn parse(&self, source: &str) -> Result<AstNode> {
37
+ let parse_result = ruby_prism::parse(source.as_bytes());
38
+ let index = LineIndex::new(source.as_bytes());
39
+
40
+ let errors: Vec<String> = parse_result
41
+ .errors()
42
+ .map(|error| {
43
+ let (line, column) = index.line_column(error.location().start_offset());
44
+ format!("{}:{}: {}", line, column, error.message())
45
+ })
46
+ .collect();
47
+ if !errors.is_empty() {
48
+ // ParseError so lib/rfmt.rb surfaces it as Rfmt::Error
49
+ // "Failed to parse Ruby code: ..." (same shape the pre-migration Ruby bridge raised).
50
+ return Err(RfmtError::ParseError(format!(
51
+ "Parse errors:\n{}",
52
+ errors.join("\n")
53
+ )));
54
+ }
55
+
56
+ let converter = Converter { index: &index };
57
+ let mut root = converter.convert(&parse_result.node()).node;
58
+ // As in the bridge/PrismAdapter pipeline, all comments live in a flat
59
+ // list on the root node; per-node comments stay empty.
60
+ root.comments = root_comments(&parse_result, &index);
61
+ // The AST has no node for the `__END__` data section; record where it
62
+ // starts so the formatter can re-append the source slice verbatim.
63
+ if let Some(data_loc) = parse_result.data_loc() {
64
+ root.metadata.insert(
65
+ "data_start_offset".to_string(),
66
+ data_loc.start_offset().to_string(),
67
+ );
68
+ }
69
+ Ok(root)
70
+ }
71
+ }
72
+
73
+ /// The bridge's serialize_ast_with_comments: every comment with its source
74
+ /// slice as text, always Leading (refined later by the formatter).
75
+ fn root_comments(result: &ParseResult<'_>, index: &LineIndex) -> Vec<Comment> {
76
+ result
77
+ .comments()
78
+ .map(|comment| {
79
+ let loc = comment.location();
80
+ let (start_line, start_column) = index.line_column(loc.start_offset());
81
+ let (mut end_line, end_column) = index.line_column(loc.end_offset());
82
+ // Prism ends `=begin ... =end` at column 0 of the line AFTER the
83
+ // terminator; snap back so the comment doesn't appear to overlap
84
+ // the next statement. Only the location is snapped: text and
85
+ // offsets keep the raw span (bridge parity).
86
+ if end_column == 0 && end_line > start_line {
87
+ end_line -= 1;
88
+ }
89
+ Comment {
90
+ text: String::from_utf8_lossy(loc.as_slice()).into_owned(),
91
+ location: Location::new(
92
+ start_line,
93
+ start_column,
94
+ end_line,
95
+ end_column,
96
+ loc.start_offset(),
97
+ loc.end_offset(),
98
+ ),
99
+ comment_type: match comment.type_() {
100
+ ruby_prism::CommentType::InlineComment => CommentType::Line,
101
+ ruby_prism::CommentType::EmbDocComment => CommentType::Block,
102
+ },
103
+ position: CommentPosition::Leading,
104
+ }
105
+ })
106
+ .collect()
107
+ }
108
+
109
+ /// Line-start byte offsets over the source, for deriving 1-based lines and
110
+ /// 0-based byte columns from prism's byte offsets.
111
+ struct LineIndex {
112
+ line_starts: Vec<usize>,
113
+ }
114
+
115
+ impl LineIndex {
116
+ fn new(source: &[u8]) -> Self {
117
+ let mut line_starts = vec![0];
118
+ for (i, byte) in source.iter().enumerate() {
119
+ if *byte == b'\n' {
120
+ line_starts.push(i + 1);
121
+ }
122
+ }
123
+ Self { line_starts }
124
+ }
125
+
126
+ fn line_column(&self, offset: usize) -> (usize, usize) {
127
+ let line = self.line_starts.partition_point(|&start| start <= offset);
128
+ (line, offset - self.line_starts[line - 1])
129
+ }
130
+ }
131
+
132
+ /// A widening candidate derived from some node's `closing_loc`, with the
133
+ /// heredoc terminator-line snap already applied to `end_line`.
134
+ #[derive(Debug, Clone, Copy, PartialEq, Eq)]
135
+ struct ClosingCandidate {
136
+ end_offset: usize,
137
+ end_line: usize,
138
+ end_column: usize,
139
+ }
140
+
141
+ /// Merge a candidate, keeping the earliest-seen candidate on end_offset ties
142
+ /// (the bridge only replaces on strictly greater end_offset).
143
+ fn fold_candidate(best: &mut Option<ClosingCandidate>, candidate: Option<ClosingCandidate>) {
144
+ if let Some(c) = candidate {
145
+ match best {
146
+ Some(b) if c.end_offset <= b.end_offset => {}
147
+ _ => *best = Some(c),
148
+ }
149
+ }
150
+ }
151
+
152
+ /// How a prism child subtree participates in the conversion of its parent,
153
+ /// mirroring the per-type extraction in prism_bridge.rb.
154
+ enum Part<'pr> {
155
+ /// Converted into a child of the internal node.
156
+ Convert(PrismNode<'pr>),
157
+ /// Dropped from the children but still scanned for heredoc widening (the
158
+ /// bridge widens over prism's generic child_nodes, not the extracted
159
+ /// children).
160
+ WidenOnly(PrismNode<'pr>),
161
+ /// A flattened intermediate (e.g. BlockParametersNode): its children are
162
+ /// converted separately, but its own closing_loc still counts.
163
+ ClosingOf(PrismNode<'pr>),
164
+ /// A child with no prism counterpart in the Rust crate (RationalNode's
165
+ /// deprecated `numeric`), rebuilt to match the bridge output.
166
+ Synthesized(AstNode),
167
+ }
168
+
169
+ struct Converted {
170
+ node: AstNode,
171
+ /// Max closing candidate of this node and its whole prism subtree, so the
172
+ /// parent widens in O(1) instead of re-walking the subtree per ancestor.
173
+ closing: Option<ClosingCandidate>,
174
+ }
175
+
176
+ struct Converter<'a> {
177
+ index: &'a LineIndex,
178
+ }
179
+
180
+ impl Converter<'_> {
181
+ fn convert(&self, node: &PrismNode<'_>) -> Converted {
182
+ let loc = node.location();
183
+ let (start_line, start_column) = self.index.line_column(loc.start_offset());
184
+ let (mut end_line, mut end_column) = self.index.line_column(loc.end_offset());
185
+ let mut end_offset = loc.end_offset();
186
+ // The bridge computes `multiline` from the original prism location,
187
+ // before heredoc widening.
188
+ let multiline = start_line != end_line;
189
+
190
+ let mut best = self.own_closing_candidate(node);
191
+ let mut children = Vec::new();
192
+
193
+ match self.parts(node) {
194
+ Some(parts) => {
195
+ for part in parts {
196
+ match part {
197
+ Part::Convert(child) => {
198
+ let converted = self.convert(&child);
199
+ fold_candidate(&mut best, converted.closing);
200
+ children.push(converted.node);
201
+ }
202
+ Part::WidenOnly(child) => {
203
+ fold_candidate(&mut best, self.subtree_closing(&child));
204
+ }
205
+ Part::ClosingOf(child) => {
206
+ fold_candidate(&mut best, self.own_closing_candidate(&child));
207
+ }
208
+ Part::Synthesized(child) => children.push(child),
209
+ }
210
+ }
211
+ }
212
+ // Node types the bridge extracts no children from: the converted
213
+ // node is a leaf, but widening still scans the real prism subtree.
214
+ None => best = self.subtree_closing(node),
215
+ }
216
+
217
+ // Oracle check: the bottom-up fold must equal a full generic-subtree
218
+ // scan (catches any per-type arm that drops a closing-bearing child).
219
+ debug_assert_eq!(
220
+ best,
221
+ self.subtree_closing(node),
222
+ "widening fold diverged from generic scan for {}",
223
+ node_kind_name(node)
224
+ );
225
+
226
+ if let Some(candidate) = best {
227
+ if candidate.end_offset > end_offset {
228
+ end_offset = candidate.end_offset;
229
+ end_line = candidate.end_line;
230
+ end_column = candidate.end_column;
231
+ }
232
+ }
233
+
234
+ let node = AstNode {
235
+ node_type: NodeType::from_str(node_kind_name(node)),
236
+ location: Location::new(
237
+ start_line,
238
+ start_column,
239
+ end_line,
240
+ end_column,
241
+ loc.start_offset(),
242
+ end_offset,
243
+ ),
244
+ children,
245
+ metadata: extract_metadata(node),
246
+ comments: Vec::new(),
247
+ formatting: FormattingInfo {
248
+ multiline,
249
+ ..FormattingInfo::default()
250
+ },
251
+ };
252
+
253
+ Converted {
254
+ node,
255
+ closing: best,
256
+ }
257
+ }
258
+
259
+ fn own_closing_candidate(&self, node: &PrismNode<'_>) -> Option<ClosingCandidate> {
260
+ own_closing_loc(node).map(|loc| self.closing_candidate(&loc))
261
+ }
262
+
263
+ fn closing_candidate(&self, loc: &PrismLocation<'_>) -> ClosingCandidate {
264
+ let (start_line, _) = self.index.line_column(loc.start_offset());
265
+ let (end_line, end_column) = self.index.line_column(loc.end_offset());
266
+ // Prism reports a heredoc terminator's end as column 0 of the line
267
+ // AFTER the terminator; snap back so blank-line preservation works
268
+ // (see prism_bridge.rb heredoc_terminator_line).
269
+ let end_line = if end_column == 0 && end_line > start_line {
270
+ start_line
271
+ } else {
272
+ end_line
273
+ };
274
+ ClosingCandidate {
275
+ end_offset: loc.end_offset(),
276
+ end_line,
277
+ end_column,
278
+ }
279
+ }
280
+
281
+ /// Max closing candidate over a node and all of its descendants, in the
282
+ /// same pre-order the bridge walks. Intentional divergence: the bridge
283
+ /// stops recursing at depth 10, so for a heredoc buried deeper than that
284
+ /// it fails to widen the far ancestors; the native path widens them too.
285
+ /// Parity fixtures therefore stay shallower than the cap.
286
+ fn subtree_closing(&self, node: &PrismNode<'_>) -> Option<ClosingCandidate> {
287
+ let mut best = self.own_closing_candidate(node);
288
+ for child in direct_children(node) {
289
+ fold_candidate(&mut best, self.subtree_closing(&child));
290
+ }
291
+ best
292
+ }
293
+
294
+ /// The bridge's per-type children extraction (prism_bridge.rb 199-432).
295
+ /// Returns None for node types the bridge gives no children (its `else`
296
+ /// branch and explicit empty arms), which all behave identically.
297
+ #[allow(clippy::too_many_lines)]
298
+ fn parts<'pr>(&self, node: &PrismNode<'pr>) -> Option<Vec<Part<'pr>>> {
299
+ let mut parts: Vec<Part<'pr>> = Vec::new();
300
+
301
+ macro_rules! convert {
302
+ ($node:expr) => {
303
+ parts.push(Part::Convert($node))
304
+ };
305
+ }
306
+ macro_rules! convert_opt {
307
+ ($node:expr) => {
308
+ if let Some(child) = $node {
309
+ parts.push(Part::Convert(child));
310
+ }
311
+ };
312
+ }
313
+ macro_rules! convert_list {
314
+ ($list:expr) => {
315
+ for child in $list.iter() {
316
+ parts.push(Part::Convert(child));
317
+ }
318
+ };
319
+ }
320
+ // `x.child_nodes.compact` on an ArgumentsNode in the bridge.
321
+ macro_rules! convert_args {
322
+ ($args:expr) => {
323
+ if let Some(arguments) = $args {
324
+ convert_list!(arguments.arguments());
325
+ }
326
+ };
327
+ }
328
+
329
+ match node {
330
+ PrismNode::ProgramNode { .. } => {
331
+ let n = node.as_program_node().unwrap();
332
+ convert_list!(n.statements().body());
333
+ }
334
+ PrismNode::StatementsNode { .. } => {
335
+ let n = node.as_statements_node().unwrap();
336
+ convert_list!(n.body());
337
+ }
338
+ PrismNode::ClassNode { .. } => {
339
+ let n = node.as_class_node().unwrap();
340
+ convert!(n.constant_path());
341
+ convert_opt!(n.superclass());
342
+ convert_opt!(n.body());
343
+ }
344
+ PrismNode::ModuleNode { .. } => {
345
+ let n = node.as_module_node().unwrap();
346
+ convert!(n.constant_path());
347
+ convert_opt!(n.body());
348
+ }
349
+ PrismNode::DefNode { .. } => {
350
+ let n = node.as_def_node().unwrap();
351
+ // The bridge drops the receiver from the children, but its
352
+ // widening walk still sees it.
353
+ if let Some(receiver) = n.receiver() {
354
+ parts.push(Part::WidenOnly(receiver));
355
+ }
356
+ if let Some(parameters) = n.parameters() {
357
+ self.flatten(&mut parts, parameters.as_node());
358
+ }
359
+ convert_opt!(n.body());
360
+ }
361
+ PrismNode::CallNode { .. } => {
362
+ let n = node.as_call_node().unwrap();
363
+ convert_opt!(n.receiver());
364
+ convert_args!(n.arguments());
365
+ convert_opt!(n.block());
366
+ }
367
+ PrismNode::IfNode { .. } => {
368
+ let n = node.as_if_node().unwrap();
369
+ convert!(n.predicate());
370
+ convert_opt!(n.statements().map(|s| s.as_node()));
371
+ convert_opt!(n.subsequent());
372
+ }
373
+ PrismNode::UnlessNode { .. } => {
374
+ let n = node.as_unless_node().unwrap();
375
+ convert!(n.predicate());
376
+ convert_opt!(n.statements().map(|s| s.as_node()));
377
+ convert_opt!(n.else_clause().map(|e| e.as_node()));
378
+ }
379
+ PrismNode::ElseNode { .. } => {
380
+ let n = node.as_else_node().unwrap();
381
+ convert_opt!(n.statements().map(|s| s.as_node()));
382
+ }
383
+ PrismNode::ArrayNode { .. } => {
384
+ let n = node.as_array_node().unwrap();
385
+ convert_list!(n.elements());
386
+ }
387
+ PrismNode::HashNode { .. } => {
388
+ let n = node.as_hash_node().unwrap();
389
+ convert_list!(n.elements());
390
+ }
391
+ PrismNode::BlockNode { .. } => {
392
+ let n = node.as_block_node().unwrap();
393
+ if let Some(parameters) = n.parameters() {
394
+ self.flatten(&mut parts, parameters);
395
+ }
396
+ convert_opt!(n.body());
397
+ }
398
+ PrismNode::BeginNode { .. } => {
399
+ let n = node.as_begin_node().unwrap();
400
+ convert_opt!(n.statements().map(|s| s.as_node()));
401
+ convert_opt!(n.rescue_clause().map(|r| r.as_node()));
402
+ convert_opt!(n.else_clause().map(|e| e.as_node()));
403
+ convert_opt!(n.ensure_clause().map(|e| e.as_node()));
404
+ }
405
+ PrismNode::EnsureNode { .. } => {
406
+ let n = node.as_ensure_node().unwrap();
407
+ convert_opt!(n.statements().map(|s| s.as_node()));
408
+ }
409
+ PrismNode::LambdaNode { .. } => {
410
+ let n = node.as_lambda_node().unwrap();
411
+ if let Some(parameters) = n.parameters() {
412
+ self.flatten(&mut parts, parameters);
413
+ }
414
+ convert_opt!(n.body());
415
+ }
416
+ PrismNode::RescueNode { .. } => {
417
+ let n = node.as_rescue_node().unwrap();
418
+ convert_list!(n.exceptions());
419
+ convert_opt!(n.reference());
420
+ convert_opt!(n.statements().map(|s| s.as_node()));
421
+ convert_opt!(n.subsequent().map(|s| s.as_node()));
422
+ }
423
+ PrismNode::LocalVariableWriteNode { .. } => {
424
+ convert!(node.as_local_variable_write_node().unwrap().value());
425
+ }
426
+ PrismNode::InstanceVariableWriteNode { .. } => {
427
+ convert!(node.as_instance_variable_write_node().unwrap().value());
428
+ }
429
+ PrismNode::ReturnNode { .. } => {
430
+ convert_args!(node.as_return_node().unwrap().arguments());
431
+ }
432
+ PrismNode::OrNode { .. } => {
433
+ let n = node.as_or_node().unwrap();
434
+ convert!(n.left());
435
+ convert!(n.right());
436
+ }
437
+ PrismNode::AndNode { .. } => {
438
+ let n = node.as_and_node().unwrap();
439
+ convert!(n.left());
440
+ convert!(n.right());
441
+ }
442
+ PrismNode::AssocNode { .. } => {
443
+ let n = node.as_assoc_node().unwrap();
444
+ convert!(n.key());
445
+ convert!(n.value());
446
+ }
447
+ PrismNode::KeywordHashNode { .. } => {
448
+ convert_list!(node.as_keyword_hash_node().unwrap().elements());
449
+ }
450
+ PrismNode::InterpolatedStringNode { .. } => {
451
+ convert_list!(node.as_interpolated_string_node().unwrap().parts());
452
+ }
453
+ PrismNode::EmbeddedStatementsNode { .. } => {
454
+ let n = node.as_embedded_statements_node().unwrap();
455
+ convert_opt!(n.statements().map(|s| s.as_node()));
456
+ }
457
+ PrismNode::CaseNode { .. } => {
458
+ let n = node.as_case_node().unwrap();
459
+ convert_opt!(n.predicate());
460
+ convert_list!(n.conditions());
461
+ convert_opt!(n.else_clause().map(|e| e.as_node()));
462
+ }
463
+ PrismNode::WhenNode { .. } => {
464
+ let n = node.as_when_node().unwrap();
465
+ convert_list!(n.conditions());
466
+ convert_opt!(n.statements().map(|s| s.as_node()));
467
+ }
468
+ PrismNode::WhileNode { .. } => {
469
+ let n = node.as_while_node().unwrap();
470
+ convert!(n.predicate());
471
+ convert_opt!(n.statements().map(|s| s.as_node()));
472
+ }
473
+ PrismNode::UntilNode { .. } => {
474
+ let n = node.as_until_node().unwrap();
475
+ convert!(n.predicate());
476
+ convert_opt!(n.statements().map(|s| s.as_node()));
477
+ }
478
+ PrismNode::ForNode { .. } => {
479
+ let n = node.as_for_node().unwrap();
480
+ convert!(n.index());
481
+ convert!(n.collection());
482
+ convert_opt!(n.statements().map(|s| s.as_node()));
483
+ }
484
+ PrismNode::BreakNode { .. } => {
485
+ convert_args!(node.as_break_node().unwrap().arguments());
486
+ }
487
+ PrismNode::NextNode { .. } => {
488
+ convert_args!(node.as_next_node().unwrap().arguments());
489
+ }
490
+ PrismNode::YieldNode { .. } => {
491
+ convert_args!(node.as_yield_node().unwrap().arguments());
492
+ }
493
+ PrismNode::SuperNode { .. } => {
494
+ let n = node.as_super_node().unwrap();
495
+ convert_args!(n.arguments());
496
+ convert_opt!(n.block());
497
+ }
498
+ PrismNode::ForwardingSuperNode { .. } => {
499
+ let n = node.as_forwarding_super_node().unwrap();
500
+ convert_opt!(n.block().map(|b| b.as_node()));
501
+ }
502
+ PrismNode::RescueModifierNode { .. } => {
503
+ let n = node.as_rescue_modifier_node().unwrap();
504
+ convert!(n.expression());
505
+ convert!(n.rescue_expression());
506
+ }
507
+ PrismNode::RangeNode { .. } => {
508
+ let n = node.as_range_node().unwrap();
509
+ convert_opt!(n.left());
510
+ convert_opt!(n.right());
511
+ }
512
+ PrismNode::SplatNode { .. } => {
513
+ convert_opt!(node.as_splat_node().unwrap().expression());
514
+ }
515
+ PrismNode::InterpolatedRegularExpressionNode { .. } => {
516
+ convert_list!(node
517
+ .as_interpolated_regular_expression_node()
518
+ .unwrap()
519
+ .parts());
520
+ }
521
+ PrismNode::InterpolatedSymbolNode { .. } => {
522
+ convert_list!(node.as_interpolated_symbol_node().unwrap().parts());
523
+ }
524
+ PrismNode::InterpolatedXStringNode { .. } => {
525
+ convert_list!(node.as_interpolated_x_string_node().unwrap().parts());
526
+ }
527
+ PrismNode::ClassVariableWriteNode { .. } => {
528
+ convert!(node.as_class_variable_write_node().unwrap().value());
529
+ }
530
+ PrismNode::GlobalVariableWriteNode { .. } => {
531
+ convert!(node.as_global_variable_write_node().unwrap().value());
532
+ }
533
+ PrismNode::ClassVariableOrWriteNode { .. } => {
534
+ convert!(node.as_class_variable_or_write_node().unwrap().value());
535
+ }
536
+ PrismNode::ClassVariableAndWriteNode { .. } => {
537
+ convert!(node.as_class_variable_and_write_node().unwrap().value());
538
+ }
539
+ PrismNode::GlobalVariableOrWriteNode { .. } => {
540
+ convert!(node.as_global_variable_or_write_node().unwrap().value());
541
+ }
542
+ PrismNode::GlobalVariableAndWriteNode { .. } => {
543
+ convert!(node.as_global_variable_and_write_node().unwrap().value());
544
+ }
545
+ PrismNode::LocalVariableOrWriteNode { .. } => {
546
+ convert!(node.as_local_variable_or_write_node().unwrap().value());
547
+ }
548
+ PrismNode::LocalVariableAndWriteNode { .. } => {
549
+ convert!(node.as_local_variable_and_write_node().unwrap().value());
550
+ }
551
+ PrismNode::InstanceVariableOrWriteNode { .. } => {
552
+ convert!(node.as_instance_variable_or_write_node().unwrap().value());
553
+ }
554
+ PrismNode::InstanceVariableAndWriteNode { .. } => {
555
+ convert!(node.as_instance_variable_and_write_node().unwrap().value());
556
+ }
557
+ PrismNode::ConstantOrWriteNode { .. } => {
558
+ convert!(node.as_constant_or_write_node().unwrap().value());
559
+ }
560
+ PrismNode::ConstantAndWriteNode { .. } => {
561
+ convert!(node.as_constant_and_write_node().unwrap().value());
562
+ }
563
+ PrismNode::ClassVariableOperatorWriteNode { .. } => {
564
+ convert!(node
565
+ .as_class_variable_operator_write_node()
566
+ .unwrap()
567
+ .value());
568
+ }
569
+ PrismNode::GlobalVariableOperatorWriteNode { .. } => {
570
+ convert!(node
571
+ .as_global_variable_operator_write_node()
572
+ .unwrap()
573
+ .value());
574
+ }
575
+ PrismNode::LocalVariableOperatorWriteNode { .. } => {
576
+ convert!(node
577
+ .as_local_variable_operator_write_node()
578
+ .unwrap()
579
+ .value());
580
+ }
581
+ PrismNode::InstanceVariableOperatorWriteNode { .. } => {
582
+ convert!(node
583
+ .as_instance_variable_operator_write_node()
584
+ .unwrap()
585
+ .value());
586
+ }
587
+ PrismNode::ConstantOperatorWriteNode { .. } => {
588
+ convert!(node.as_constant_operator_write_node().unwrap().value());
589
+ }
590
+ PrismNode::ConstantPathOrWriteNode { .. } => {
591
+ let n = node.as_constant_path_or_write_node().unwrap();
592
+ convert!(n.target().as_node());
593
+ convert!(n.value());
594
+ }
595
+ PrismNode::ConstantPathAndWriteNode { .. } => {
596
+ let n = node.as_constant_path_and_write_node().unwrap();
597
+ convert!(n.target().as_node());
598
+ convert!(n.value());
599
+ }
600
+ PrismNode::ConstantPathOperatorWriteNode { .. } => {
601
+ let n = node.as_constant_path_operator_write_node().unwrap();
602
+ convert!(n.target().as_node());
603
+ convert!(n.value());
604
+ }
605
+ PrismNode::ConstantPathWriteNode { .. } => {
606
+ let n = node.as_constant_path_write_node().unwrap();
607
+ convert!(n.target().as_node());
608
+ convert!(n.value());
609
+ }
610
+ PrismNode::CaseMatchNode { .. } => {
611
+ let n = node.as_case_match_node().unwrap();
612
+ convert_opt!(n.predicate());
613
+ convert_list!(n.conditions());
614
+ convert_opt!(n.else_clause().map(|e| e.as_node()));
615
+ }
616
+ PrismNode::InNode { .. } => {
617
+ let n = node.as_in_node().unwrap();
618
+ convert!(n.pattern());
619
+ convert_opt!(n.statements().map(|s| s.as_node()));
620
+ }
621
+ PrismNode::MatchPredicateNode { .. } => {
622
+ let n = node.as_match_predicate_node().unwrap();
623
+ convert!(n.value());
624
+ convert!(n.pattern());
625
+ }
626
+ PrismNode::MatchRequiredNode { .. } => {
627
+ let n = node.as_match_required_node().unwrap();
628
+ convert!(n.value());
629
+ convert!(n.pattern());
630
+ }
631
+ PrismNode::ParenthesesNode { .. } => {
632
+ convert_opt!(node.as_parentheses_node().unwrap().body());
633
+ }
634
+ PrismNode::DefinedNode { .. } => {
635
+ convert!(node.as_defined_node().unwrap().value());
636
+ }
637
+ PrismNode::SingletonClassNode { .. } => {
638
+ let n = node.as_singleton_class_node().unwrap();
639
+ convert!(n.expression());
640
+ convert_opt!(n.body());
641
+ }
642
+ PrismNode::AliasMethodNode { .. } => {
643
+ let n = node.as_alias_method_node().unwrap();
644
+ convert!(n.new_name());
645
+ convert!(n.old_name());
646
+ }
647
+ PrismNode::AliasGlobalVariableNode { .. } => {
648
+ let n = node.as_alias_global_variable_node().unwrap();
649
+ convert!(n.new_name());
650
+ convert!(n.old_name());
651
+ }
652
+ PrismNode::UndefNode { .. } => {
653
+ convert_list!(node.as_undef_node().unwrap().names());
654
+ }
655
+ PrismNode::AssocSplatNode { .. } => {
656
+ convert_opt!(node.as_assoc_splat_node().unwrap().value());
657
+ }
658
+ PrismNode::BlockArgumentNode { .. } => {
659
+ convert_opt!(node.as_block_argument_node().unwrap().expression());
660
+ }
661
+ PrismNode::MultiWriteNode { .. } => {
662
+ let n = node.as_multi_write_node().unwrap();
663
+ convert_list!(n.lefts());
664
+ convert_opt!(n.rest());
665
+ convert_list!(n.rights());
666
+ convert!(n.value());
667
+ }
668
+ PrismNode::MultiTargetNode { .. } => {
669
+ let n = node.as_multi_target_node().unwrap();
670
+ convert_list!(n.lefts());
671
+ convert_opt!(n.rest());
672
+ convert_list!(n.rights());
673
+ }
674
+ PrismNode::PreExecutionNode { .. } => {
675
+ let n = node.as_pre_execution_node().unwrap();
676
+ convert_opt!(n.statements().map(|s| s.as_node()));
677
+ }
678
+ PrismNode::PostExecutionNode { .. } => {
679
+ let n = node.as_post_execution_node().unwrap();
680
+ convert_opt!(n.statements().map(|s| s.as_node()));
681
+ }
682
+ // The bridge's arm calls the deprecated RationalNode#numeric,
683
+ // which the Rust crate does not expose; rebuild the same child.
684
+ PrismNode::RationalNode { .. } => {
685
+ parts.push(Part::Synthesized(self.rational_numeric(node)));
686
+ }
687
+ PrismNode::ImaginaryNode { .. } => {
688
+ convert!(node.as_imaginary_node().unwrap().numeric());
689
+ }
690
+ PrismNode::EmbeddedVariableNode { .. } => {
691
+ convert!(node.as_embedded_variable_node().unwrap().variable());
692
+ }
693
+ PrismNode::ArrayPatternNode { .. } => {
694
+ let n = node.as_array_pattern_node().unwrap();
695
+ if let Some(constant) = n.constant() {
696
+ parts.push(Part::WidenOnly(constant));
697
+ }
698
+ convert_list!(n.requireds());
699
+ convert_opt!(n.rest());
700
+ convert_list!(n.posts());
701
+ }
702
+ PrismNode::HashPatternNode { .. } => {
703
+ let n = node.as_hash_pattern_node().unwrap();
704
+ if let Some(constant) = n.constant() {
705
+ parts.push(Part::WidenOnly(constant));
706
+ }
707
+ convert_list!(n.elements());
708
+ convert_opt!(n.rest());
709
+ }
710
+ PrismNode::FindPatternNode { .. } => {
711
+ let n = node.as_find_pattern_node().unwrap();
712
+ if let Some(constant) = n.constant() {
713
+ parts.push(Part::WidenOnly(constant));
714
+ }
715
+ convert!(n.left().as_node());
716
+ convert_list!(n.requireds());
717
+ convert!(n.right());
718
+ }
719
+ PrismNode::CapturePatternNode { .. } => {
720
+ let n = node.as_capture_pattern_node().unwrap();
721
+ convert!(n.value());
722
+ convert!(n.target().as_node());
723
+ }
724
+ PrismNode::AlternationPatternNode { .. } => {
725
+ let n = node.as_alternation_pattern_node().unwrap();
726
+ convert!(n.left());
727
+ convert!(n.right());
728
+ }
729
+ PrismNode::PinnedExpressionNode { .. } => {
730
+ convert!(node.as_pinned_expression_node().unwrap().expression());
731
+ }
732
+ PrismNode::PinnedVariableNode { .. } => {
733
+ convert!(node.as_pinned_variable_node().unwrap().variable());
734
+ }
735
+ PrismNode::CallAndWriteNode { .. } => {
736
+ let n = node.as_call_and_write_node().unwrap();
737
+ convert_opt!(n.receiver());
738
+ convert!(n.value());
739
+ }
740
+ PrismNode::CallOrWriteNode { .. } => {
741
+ let n = node.as_call_or_write_node().unwrap();
742
+ convert_opt!(n.receiver());
743
+ convert!(n.value());
744
+ }
745
+ PrismNode::CallOperatorWriteNode { .. } => {
746
+ let n = node.as_call_operator_write_node().unwrap();
747
+ convert_opt!(n.receiver());
748
+ convert!(n.value());
749
+ }
750
+ PrismNode::IndexAndWriteNode { .. } => {
751
+ let n = node.as_index_and_write_node().unwrap();
752
+ convert_opt!(n.receiver());
753
+ convert_opt!(n.arguments().map(|a: ArgumentsNode<'pr>| a.as_node()));
754
+ if let Some(block) = n.block() {
755
+ parts.push(Part::WidenOnly(block.as_node()));
756
+ }
757
+ convert!(n.value());
758
+ }
759
+ PrismNode::IndexOrWriteNode { .. } => {
760
+ let n = node.as_index_or_write_node().unwrap();
761
+ convert_opt!(n.receiver());
762
+ convert_opt!(n.arguments().map(|a: ArgumentsNode<'pr>| a.as_node()));
763
+ if let Some(block) = n.block() {
764
+ parts.push(Part::WidenOnly(block.as_node()));
765
+ }
766
+ convert!(n.value());
767
+ }
768
+ PrismNode::IndexOperatorWriteNode { .. } => {
769
+ let n = node.as_index_operator_write_node().unwrap();
770
+ convert_opt!(n.receiver());
771
+ convert_opt!(n.arguments().map(|a: ArgumentsNode<'pr>| a.as_node()));
772
+ if let Some(block) = n.block() {
773
+ parts.push(Part::WidenOnly(block.as_node()));
774
+ }
775
+ convert!(n.value());
776
+ }
777
+ PrismNode::MatchWriteNode { .. } => {
778
+ let n = node.as_match_write_node().unwrap();
779
+ convert!(n.call().as_node());
780
+ convert_list!(n.targets());
781
+ }
782
+ PrismNode::FlipFlopNode { .. } => {
783
+ let n = node.as_flip_flop_node().unwrap();
784
+ convert_opt!(n.left());
785
+ convert_opt!(n.right());
786
+ }
787
+ PrismNode::ImplicitNode { .. } => {
788
+ convert!(node.as_implicit_node().unwrap().value());
789
+ }
790
+ _ => return None,
791
+ }
792
+
793
+ Some(parts)
794
+ }
795
+
796
+ /// RationalNode#numeric in the Ruby gem: an IntegerNode or FloatNode
797
+ /// spanning the literal minus the trailing `r`.
798
+ fn rational_numeric(&self, node: &PrismNode<'_>) -> AstNode {
799
+ let loc = node.location();
800
+ let end_offset = loc.end_offset() - 1;
801
+ let (start_line, start_column) = self.index.line_column(loc.start_offset());
802
+ let (end_line, end_column) = self.index.line_column(end_offset);
803
+ // Rational literals allow no exponent, so a dot means a float base.
804
+ let kind = if loc.as_slice().contains(&b'.') {
805
+ "float_node"
806
+ } else {
807
+ "integer_node"
808
+ };
809
+ AstNode {
810
+ node_type: NodeType::from_str(kind),
811
+ location: Location::new(
812
+ start_line,
813
+ start_column,
814
+ end_line,
815
+ end_column,
816
+ loc.start_offset(),
817
+ end_offset,
818
+ ),
819
+ children: Vec::new(),
820
+ metadata: HashMap::new(),
821
+ comments: Vec::new(),
822
+ formatting: FormattingInfo {
823
+ multiline: start_line != end_line,
824
+ ..FormattingInfo::default()
825
+ },
826
+ }
827
+ }
828
+
829
+ /// The bridge's `x.child_nodes.compact` flattening of a parameters node.
830
+ /// The flattened node's own closing_loc (BlockParametersNode's `|`) still
831
+ /// participates in widening.
832
+ fn flatten<'pr>(&self, parts: &mut Vec<Part<'pr>>, intermediate: PrismNode<'pr>) {
833
+ for child in direct_children(&intermediate) {
834
+ parts.push(Part::Convert(child));
835
+ }
836
+ parts.push(Part::ClosingOf(intermediate));
837
+ }
838
+ }
839
+
840
+ /// The bridge's per-type metadata (prism_bridge.rb extract_metadata), minus
841
+ /// the keys nothing downstream reads (parameters_count, message, content,
842
+ /// value). All values stay strings for adapter-port parity.
843
+ fn extract_metadata(node: &PrismNode<'_>) -> HashMap<String, String> {
844
+ let mut metadata = HashMap::new();
845
+
846
+ match node {
847
+ PrismNode::ClassNode { .. } => {
848
+ let n = node.as_class_node().unwrap();
849
+ metadata.insert(
850
+ "name".to_string(),
851
+ class_or_module_name(&n.constant_path(), &n.name()),
852
+ );
853
+ if let Some(superclass) = n.superclass() {
854
+ metadata.insert("superclass".to_string(), superclass_name(&superclass));
855
+ }
856
+ }
857
+ PrismNode::ModuleNode { .. } => {
858
+ let n = node.as_module_node().unwrap();
859
+ metadata.insert(
860
+ "name".to_string(),
861
+ class_or_module_name(&n.constant_path(), &n.name()),
862
+ );
863
+ }
864
+ PrismNode::DefNode { .. } => {
865
+ let n = node.as_def_node().unwrap();
866
+ // name_loc slice rather than the name symbol, so unary operator
867
+ // suffixes survive (prism normalizes `def !@` to :!).
868
+ metadata.insert("name".to_string(), slice_string(&n.name_loc()));
869
+ if let Some(parameters) = n.parameters() {
870
+ metadata.insert(
871
+ "parameters_text".to_string(),
872
+ slice_string(&parameters.location()),
873
+ );
874
+ metadata.insert(
875
+ "has_parens".to_string(),
876
+ n.lparen_loc().is_some().to_string(),
877
+ );
878
+ }
879
+ if let Some(receiver) = n.receiver() {
880
+ let value = if receiver.as_self_node().is_some() {
881
+ "self".to_string()
882
+ } else {
883
+ slice_string(&receiver.location())
884
+ };
885
+ metadata.insert("receiver".to_string(), value);
886
+ }
887
+ }
888
+ PrismNode::CallNode { .. } => {
889
+ let n = node.as_call_node().unwrap();
890
+ metadata.insert("name".to_string(), constant_id_string(&n.name()));
891
+ }
892
+ PrismNode::LocalVariableWriteNode { .. } => {
893
+ let n = node.as_local_variable_write_node().unwrap();
894
+ metadata.insert("name".to_string(), constant_id_string(&n.name()));
895
+ }
896
+ PrismNode::InstanceVariableWriteNode { .. } => {
897
+ let n = node.as_instance_variable_write_node().unwrap();
898
+ metadata.insert("name".to_string(), constant_id_string(&n.name()));
899
+ }
900
+ // UnlessNode gets no is_ternary key: the bridge guards on
901
+ // respond_to?(:if_keyword_loc), which UnlessNode lacks.
902
+ PrismNode::IfNode { .. } => {
903
+ let n = node.as_if_node().unwrap();
904
+ metadata.insert(
905
+ "is_ternary".to_string(),
906
+ n.if_keyword_loc().is_none().to_string(),
907
+ );
908
+ }
909
+ _ => {}
910
+ }
911
+
912
+ metadata
913
+ }
914
+
915
+ fn slice_string(loc: &PrismLocation<'_>) -> String {
916
+ String::from_utf8_lossy(loc.as_slice()).into_owned()
917
+ }
918
+
919
+ fn constant_id_string(id: &ConstantId<'_>) -> String {
920
+ String::from_utf8_lossy(id.as_slice()).into_owned()
921
+ }
922
+
923
+ /// prism_node_extractor.rb extract_class_or_module_name: constant_path is
924
+ /// always present, `name` is the bridge's fallback for exotic paths.
925
+ fn class_or_module_name(constant_path: &PrismNode<'_>, name: &ConstantId<'_>) -> String {
926
+ if let Some(read) = constant_path.as_constant_read_node() {
927
+ constant_id_string(&read.name())
928
+ } else if let Some(path) = constant_path.as_constant_path_node() {
929
+ constant_path_full_name(&path).unwrap_or_else(|| slice_string(&constant_path.location()))
930
+ } else {
931
+ constant_id_string(name)
932
+ }
933
+ }
934
+
935
+ /// prism_node_extractor.rb extract_superclass_name.
936
+ fn superclass_name(superclass: &PrismNode<'_>) -> String {
937
+ if let Some(read) = superclass.as_constant_read_node() {
938
+ constant_id_string(&read.name())
939
+ } else if let Some(path) = superclass.as_constant_path_node() {
940
+ constant_path_full_name(&path).unwrap_or_else(|| slice_string(&superclass.location()))
941
+ } else {
942
+ // CallNode superclasses (`ActiveRecord::Migration[8.1]`) and the
943
+ // bridge's generic fallback both take the source slice.
944
+ slice_string(&superclass.location())
945
+ }
946
+ }
947
+
948
+ /// The prism gem's ConstantPathNode#full_name. Divergence: where the gem
949
+ /// raises (dynamic parts like `self::Foo`, or missing names) and so aborts
950
+ /// the whole bridge parse, this returns None and the callers fall back to
951
+ /// the source slice.
952
+ fn constant_path_full_name(path: &ruby_prism::ConstantPathNode<'_>) -> Option<String> {
953
+ let mut parts = vec![constant_id_string(&path.name()?)];
954
+ let mut parent = path.parent();
955
+ loop {
956
+ match parent {
957
+ // Root scope (`::Foo`): the gem prepends an empty part.
958
+ None => {
959
+ parts.push(String::new());
960
+ break;
961
+ }
962
+ Some(node) => {
963
+ if let Some(inner) = node.as_constant_path_node() {
964
+ parts.push(constant_id_string(&inner.name()?));
965
+ parent = inner.parent();
966
+ } else {
967
+ let read = node.as_constant_read_node()?;
968
+ parts.push(constant_id_string(&read.name()));
969
+ break;
970
+ }
971
+ }
972
+ }
973
+ }
974
+ parts.reverse();
975
+ Some(parts.join("::"))
976
+ }
977
+
978
+ /// Direct children of a node in prism's generic child_nodes order. The crate
979
+ /// has no generic child accessor, so every typed visit method is overridden
980
+ /// to record the child without descending, and the node dispatches to its
981
+ /// generated walk function (all arms generated from the Node enum variants).
982
+ fn direct_children<'pr>(node: &PrismNode<'pr>) -> Vec<PrismNode<'pr>> {
983
+ struct Collector<'pr> {
984
+ children: Vec<PrismNode<'pr>>,
985
+ }
986
+
987
+ impl<'pr> Visit<'pr> for Collector<'pr> {
988
+ fn visit_alias_global_variable_node(
989
+ &mut self,
990
+ node: &ruby_prism::AliasGlobalVariableNode<'pr>,
991
+ ) {
992
+ self.children.push(node.as_node());
993
+ }
994
+
995
+ fn visit_alias_method_node(&mut self, node: &ruby_prism::AliasMethodNode<'pr>) {
996
+ self.children.push(node.as_node());
997
+ }
998
+
999
+ fn visit_alternation_pattern_node(
1000
+ &mut self,
1001
+ node: &ruby_prism::AlternationPatternNode<'pr>,
1002
+ ) {
1003
+ self.children.push(node.as_node());
1004
+ }
1005
+
1006
+ fn visit_and_node(&mut self, node: &ruby_prism::AndNode<'pr>) {
1007
+ self.children.push(node.as_node());
1008
+ }
1009
+
1010
+ fn visit_arguments_node(&mut self, node: &ruby_prism::ArgumentsNode<'pr>) {
1011
+ self.children.push(node.as_node());
1012
+ }
1013
+
1014
+ fn visit_array_node(&mut self, node: &ruby_prism::ArrayNode<'pr>) {
1015
+ self.children.push(node.as_node());
1016
+ }
1017
+
1018
+ fn visit_array_pattern_node(&mut self, node: &ruby_prism::ArrayPatternNode<'pr>) {
1019
+ self.children.push(node.as_node());
1020
+ }
1021
+
1022
+ fn visit_assoc_node(&mut self, node: &ruby_prism::AssocNode<'pr>) {
1023
+ self.children.push(node.as_node());
1024
+ }
1025
+
1026
+ fn visit_assoc_splat_node(&mut self, node: &ruby_prism::AssocSplatNode<'pr>) {
1027
+ self.children.push(node.as_node());
1028
+ }
1029
+
1030
+ fn visit_back_reference_read_node(
1031
+ &mut self,
1032
+ node: &ruby_prism::BackReferenceReadNode<'pr>,
1033
+ ) {
1034
+ self.children.push(node.as_node());
1035
+ }
1036
+
1037
+ fn visit_begin_node(&mut self, node: &ruby_prism::BeginNode<'pr>) {
1038
+ self.children.push(node.as_node());
1039
+ }
1040
+
1041
+ fn visit_block_argument_node(&mut self, node: &ruby_prism::BlockArgumentNode<'pr>) {
1042
+ self.children.push(node.as_node());
1043
+ }
1044
+
1045
+ fn visit_block_local_variable_node(
1046
+ &mut self,
1047
+ node: &ruby_prism::BlockLocalVariableNode<'pr>,
1048
+ ) {
1049
+ self.children.push(node.as_node());
1050
+ }
1051
+
1052
+ fn visit_block_node(&mut self, node: &ruby_prism::BlockNode<'pr>) {
1053
+ self.children.push(node.as_node());
1054
+ }
1055
+
1056
+ fn visit_block_parameter_node(&mut self, node: &ruby_prism::BlockParameterNode<'pr>) {
1057
+ self.children.push(node.as_node());
1058
+ }
1059
+
1060
+ fn visit_block_parameters_node(&mut self, node: &ruby_prism::BlockParametersNode<'pr>) {
1061
+ self.children.push(node.as_node());
1062
+ }
1063
+
1064
+ fn visit_break_node(&mut self, node: &ruby_prism::BreakNode<'pr>) {
1065
+ self.children.push(node.as_node());
1066
+ }
1067
+
1068
+ fn visit_call_and_write_node(&mut self, node: &ruby_prism::CallAndWriteNode<'pr>) {
1069
+ self.children.push(node.as_node());
1070
+ }
1071
+
1072
+ fn visit_call_node(&mut self, node: &ruby_prism::CallNode<'pr>) {
1073
+ self.children.push(node.as_node());
1074
+ }
1075
+
1076
+ fn visit_call_operator_write_node(
1077
+ &mut self,
1078
+ node: &ruby_prism::CallOperatorWriteNode<'pr>,
1079
+ ) {
1080
+ self.children.push(node.as_node());
1081
+ }
1082
+
1083
+ fn visit_call_or_write_node(&mut self, node: &ruby_prism::CallOrWriteNode<'pr>) {
1084
+ self.children.push(node.as_node());
1085
+ }
1086
+
1087
+ fn visit_call_target_node(&mut self, node: &ruby_prism::CallTargetNode<'pr>) {
1088
+ self.children.push(node.as_node());
1089
+ }
1090
+
1091
+ fn visit_capture_pattern_node(&mut self, node: &ruby_prism::CapturePatternNode<'pr>) {
1092
+ self.children.push(node.as_node());
1093
+ }
1094
+
1095
+ fn visit_case_match_node(&mut self, node: &ruby_prism::CaseMatchNode<'pr>) {
1096
+ self.children.push(node.as_node());
1097
+ }
1098
+
1099
+ fn visit_case_node(&mut self, node: &ruby_prism::CaseNode<'pr>) {
1100
+ self.children.push(node.as_node());
1101
+ }
1102
+
1103
+ fn visit_class_node(&mut self, node: &ruby_prism::ClassNode<'pr>) {
1104
+ self.children.push(node.as_node());
1105
+ }
1106
+
1107
+ fn visit_class_variable_and_write_node(
1108
+ &mut self,
1109
+ node: &ruby_prism::ClassVariableAndWriteNode<'pr>,
1110
+ ) {
1111
+ self.children.push(node.as_node());
1112
+ }
1113
+
1114
+ fn visit_class_variable_operator_write_node(
1115
+ &mut self,
1116
+ node: &ruby_prism::ClassVariableOperatorWriteNode<'pr>,
1117
+ ) {
1118
+ self.children.push(node.as_node());
1119
+ }
1120
+
1121
+ fn visit_class_variable_or_write_node(
1122
+ &mut self,
1123
+ node: &ruby_prism::ClassVariableOrWriteNode<'pr>,
1124
+ ) {
1125
+ self.children.push(node.as_node());
1126
+ }
1127
+
1128
+ fn visit_class_variable_read_node(
1129
+ &mut self,
1130
+ node: &ruby_prism::ClassVariableReadNode<'pr>,
1131
+ ) {
1132
+ self.children.push(node.as_node());
1133
+ }
1134
+
1135
+ fn visit_class_variable_target_node(
1136
+ &mut self,
1137
+ node: &ruby_prism::ClassVariableTargetNode<'pr>,
1138
+ ) {
1139
+ self.children.push(node.as_node());
1140
+ }
1141
+
1142
+ fn visit_class_variable_write_node(
1143
+ &mut self,
1144
+ node: &ruby_prism::ClassVariableWriteNode<'pr>,
1145
+ ) {
1146
+ self.children.push(node.as_node());
1147
+ }
1148
+
1149
+ fn visit_constant_and_write_node(&mut self, node: &ruby_prism::ConstantAndWriteNode<'pr>) {
1150
+ self.children.push(node.as_node());
1151
+ }
1152
+
1153
+ fn visit_constant_operator_write_node(
1154
+ &mut self,
1155
+ node: &ruby_prism::ConstantOperatorWriteNode<'pr>,
1156
+ ) {
1157
+ self.children.push(node.as_node());
1158
+ }
1159
+
1160
+ fn visit_constant_or_write_node(&mut self, node: &ruby_prism::ConstantOrWriteNode<'pr>) {
1161
+ self.children.push(node.as_node());
1162
+ }
1163
+
1164
+ fn visit_constant_path_and_write_node(
1165
+ &mut self,
1166
+ node: &ruby_prism::ConstantPathAndWriteNode<'pr>,
1167
+ ) {
1168
+ self.children.push(node.as_node());
1169
+ }
1170
+
1171
+ fn visit_constant_path_node(&mut self, node: &ruby_prism::ConstantPathNode<'pr>) {
1172
+ self.children.push(node.as_node());
1173
+ }
1174
+
1175
+ fn visit_constant_path_operator_write_node(
1176
+ &mut self,
1177
+ node: &ruby_prism::ConstantPathOperatorWriteNode<'pr>,
1178
+ ) {
1179
+ self.children.push(node.as_node());
1180
+ }
1181
+
1182
+ fn visit_constant_path_or_write_node(
1183
+ &mut self,
1184
+ node: &ruby_prism::ConstantPathOrWriteNode<'pr>,
1185
+ ) {
1186
+ self.children.push(node.as_node());
1187
+ }
1188
+
1189
+ fn visit_constant_path_target_node(
1190
+ &mut self,
1191
+ node: &ruby_prism::ConstantPathTargetNode<'pr>,
1192
+ ) {
1193
+ self.children.push(node.as_node());
1194
+ }
1195
+
1196
+ fn visit_constant_path_write_node(
1197
+ &mut self,
1198
+ node: &ruby_prism::ConstantPathWriteNode<'pr>,
1199
+ ) {
1200
+ self.children.push(node.as_node());
1201
+ }
1202
+
1203
+ fn visit_constant_read_node(&mut self, node: &ruby_prism::ConstantReadNode<'pr>) {
1204
+ self.children.push(node.as_node());
1205
+ }
1206
+
1207
+ fn visit_constant_target_node(&mut self, node: &ruby_prism::ConstantTargetNode<'pr>) {
1208
+ self.children.push(node.as_node());
1209
+ }
1210
+
1211
+ fn visit_constant_write_node(&mut self, node: &ruby_prism::ConstantWriteNode<'pr>) {
1212
+ self.children.push(node.as_node());
1213
+ }
1214
+
1215
+ fn visit_def_node(&mut self, node: &ruby_prism::DefNode<'pr>) {
1216
+ self.children.push(node.as_node());
1217
+ }
1218
+
1219
+ fn visit_defined_node(&mut self, node: &ruby_prism::DefinedNode<'pr>) {
1220
+ self.children.push(node.as_node());
1221
+ }
1222
+
1223
+ fn visit_else_node(&mut self, node: &ruby_prism::ElseNode<'pr>) {
1224
+ self.children.push(node.as_node());
1225
+ }
1226
+
1227
+ fn visit_embedded_statements_node(
1228
+ &mut self,
1229
+ node: &ruby_prism::EmbeddedStatementsNode<'pr>,
1230
+ ) {
1231
+ self.children.push(node.as_node());
1232
+ }
1233
+
1234
+ fn visit_embedded_variable_node(&mut self, node: &ruby_prism::EmbeddedVariableNode<'pr>) {
1235
+ self.children.push(node.as_node());
1236
+ }
1237
+
1238
+ fn visit_ensure_node(&mut self, node: &ruby_prism::EnsureNode<'pr>) {
1239
+ self.children.push(node.as_node());
1240
+ }
1241
+
1242
+ fn visit_false_node(&mut self, node: &ruby_prism::FalseNode<'pr>) {
1243
+ self.children.push(node.as_node());
1244
+ }
1245
+
1246
+ fn visit_find_pattern_node(&mut self, node: &ruby_prism::FindPatternNode<'pr>) {
1247
+ self.children.push(node.as_node());
1248
+ }
1249
+
1250
+ fn visit_flip_flop_node(&mut self, node: &ruby_prism::FlipFlopNode<'pr>) {
1251
+ self.children.push(node.as_node());
1252
+ }
1253
+
1254
+ fn visit_float_node(&mut self, node: &ruby_prism::FloatNode<'pr>) {
1255
+ self.children.push(node.as_node());
1256
+ }
1257
+
1258
+ fn visit_for_node(&mut self, node: &ruby_prism::ForNode<'pr>) {
1259
+ self.children.push(node.as_node());
1260
+ }
1261
+
1262
+ fn visit_forwarding_arguments_node(
1263
+ &mut self,
1264
+ node: &ruby_prism::ForwardingArgumentsNode<'pr>,
1265
+ ) {
1266
+ self.children.push(node.as_node());
1267
+ }
1268
+
1269
+ fn visit_forwarding_parameter_node(
1270
+ &mut self,
1271
+ node: &ruby_prism::ForwardingParameterNode<'pr>,
1272
+ ) {
1273
+ self.children.push(node.as_node());
1274
+ }
1275
+
1276
+ fn visit_forwarding_super_node(&mut self, node: &ruby_prism::ForwardingSuperNode<'pr>) {
1277
+ self.children.push(node.as_node());
1278
+ }
1279
+
1280
+ fn visit_global_variable_and_write_node(
1281
+ &mut self,
1282
+ node: &ruby_prism::GlobalVariableAndWriteNode<'pr>,
1283
+ ) {
1284
+ self.children.push(node.as_node());
1285
+ }
1286
+
1287
+ fn visit_global_variable_operator_write_node(
1288
+ &mut self,
1289
+ node: &ruby_prism::GlobalVariableOperatorWriteNode<'pr>,
1290
+ ) {
1291
+ self.children.push(node.as_node());
1292
+ }
1293
+
1294
+ fn visit_global_variable_or_write_node(
1295
+ &mut self,
1296
+ node: &ruby_prism::GlobalVariableOrWriteNode<'pr>,
1297
+ ) {
1298
+ self.children.push(node.as_node());
1299
+ }
1300
+
1301
+ fn visit_global_variable_read_node(
1302
+ &mut self,
1303
+ node: &ruby_prism::GlobalVariableReadNode<'pr>,
1304
+ ) {
1305
+ self.children.push(node.as_node());
1306
+ }
1307
+
1308
+ fn visit_global_variable_target_node(
1309
+ &mut self,
1310
+ node: &ruby_prism::GlobalVariableTargetNode<'pr>,
1311
+ ) {
1312
+ self.children.push(node.as_node());
1313
+ }
1314
+
1315
+ fn visit_global_variable_write_node(
1316
+ &mut self,
1317
+ node: &ruby_prism::GlobalVariableWriteNode<'pr>,
1318
+ ) {
1319
+ self.children.push(node.as_node());
1320
+ }
1321
+
1322
+ fn visit_hash_node(&mut self, node: &ruby_prism::HashNode<'pr>) {
1323
+ self.children.push(node.as_node());
1324
+ }
1325
+
1326
+ fn visit_hash_pattern_node(&mut self, node: &ruby_prism::HashPatternNode<'pr>) {
1327
+ self.children.push(node.as_node());
1328
+ }
1329
+
1330
+ fn visit_if_node(&mut self, node: &ruby_prism::IfNode<'pr>) {
1331
+ self.children.push(node.as_node());
1332
+ }
1333
+
1334
+ fn visit_imaginary_node(&mut self, node: &ruby_prism::ImaginaryNode<'pr>) {
1335
+ self.children.push(node.as_node());
1336
+ }
1337
+
1338
+ fn visit_implicit_node(&mut self, node: &ruby_prism::ImplicitNode<'pr>) {
1339
+ self.children.push(node.as_node());
1340
+ }
1341
+
1342
+ fn visit_implicit_rest_node(&mut self, node: &ruby_prism::ImplicitRestNode<'pr>) {
1343
+ self.children.push(node.as_node());
1344
+ }
1345
+
1346
+ fn visit_in_node(&mut self, node: &ruby_prism::InNode<'pr>) {
1347
+ self.children.push(node.as_node());
1348
+ }
1349
+
1350
+ fn visit_index_and_write_node(&mut self, node: &ruby_prism::IndexAndWriteNode<'pr>) {
1351
+ self.children.push(node.as_node());
1352
+ }
1353
+
1354
+ fn visit_index_operator_write_node(
1355
+ &mut self,
1356
+ node: &ruby_prism::IndexOperatorWriteNode<'pr>,
1357
+ ) {
1358
+ self.children.push(node.as_node());
1359
+ }
1360
+
1361
+ fn visit_index_or_write_node(&mut self, node: &ruby_prism::IndexOrWriteNode<'pr>) {
1362
+ self.children.push(node.as_node());
1363
+ }
1364
+
1365
+ fn visit_index_target_node(&mut self, node: &ruby_prism::IndexTargetNode<'pr>) {
1366
+ self.children.push(node.as_node());
1367
+ }
1368
+
1369
+ fn visit_instance_variable_and_write_node(
1370
+ &mut self,
1371
+ node: &ruby_prism::InstanceVariableAndWriteNode<'pr>,
1372
+ ) {
1373
+ self.children.push(node.as_node());
1374
+ }
1375
+
1376
+ fn visit_instance_variable_operator_write_node(
1377
+ &mut self,
1378
+ node: &ruby_prism::InstanceVariableOperatorWriteNode<'pr>,
1379
+ ) {
1380
+ self.children.push(node.as_node());
1381
+ }
1382
+
1383
+ fn visit_instance_variable_or_write_node(
1384
+ &mut self,
1385
+ node: &ruby_prism::InstanceVariableOrWriteNode<'pr>,
1386
+ ) {
1387
+ self.children.push(node.as_node());
1388
+ }
1389
+
1390
+ fn visit_instance_variable_read_node(
1391
+ &mut self,
1392
+ node: &ruby_prism::InstanceVariableReadNode<'pr>,
1393
+ ) {
1394
+ self.children.push(node.as_node());
1395
+ }
1396
+
1397
+ fn visit_instance_variable_target_node(
1398
+ &mut self,
1399
+ node: &ruby_prism::InstanceVariableTargetNode<'pr>,
1400
+ ) {
1401
+ self.children.push(node.as_node());
1402
+ }
1403
+
1404
+ fn visit_instance_variable_write_node(
1405
+ &mut self,
1406
+ node: &ruby_prism::InstanceVariableWriteNode<'pr>,
1407
+ ) {
1408
+ self.children.push(node.as_node());
1409
+ }
1410
+
1411
+ fn visit_integer_node(&mut self, node: &ruby_prism::IntegerNode<'pr>) {
1412
+ self.children.push(node.as_node());
1413
+ }
1414
+
1415
+ fn visit_interpolated_match_last_line_node(
1416
+ &mut self,
1417
+ node: &ruby_prism::InterpolatedMatchLastLineNode<'pr>,
1418
+ ) {
1419
+ self.children.push(node.as_node());
1420
+ }
1421
+
1422
+ fn visit_interpolated_regular_expression_node(
1423
+ &mut self,
1424
+ node: &ruby_prism::InterpolatedRegularExpressionNode<'pr>,
1425
+ ) {
1426
+ self.children.push(node.as_node());
1427
+ }
1428
+
1429
+ fn visit_interpolated_string_node(
1430
+ &mut self,
1431
+ node: &ruby_prism::InterpolatedStringNode<'pr>,
1432
+ ) {
1433
+ self.children.push(node.as_node());
1434
+ }
1435
+
1436
+ fn visit_interpolated_symbol_node(
1437
+ &mut self,
1438
+ node: &ruby_prism::InterpolatedSymbolNode<'pr>,
1439
+ ) {
1440
+ self.children.push(node.as_node());
1441
+ }
1442
+
1443
+ fn visit_interpolated_x_string_node(
1444
+ &mut self,
1445
+ node: &ruby_prism::InterpolatedXStringNode<'pr>,
1446
+ ) {
1447
+ self.children.push(node.as_node());
1448
+ }
1449
+
1450
+ fn visit_it_local_variable_read_node(
1451
+ &mut self,
1452
+ node: &ruby_prism::ItLocalVariableReadNode<'pr>,
1453
+ ) {
1454
+ self.children.push(node.as_node());
1455
+ }
1456
+
1457
+ fn visit_it_parameters_node(&mut self, node: &ruby_prism::ItParametersNode<'pr>) {
1458
+ self.children.push(node.as_node());
1459
+ }
1460
+
1461
+ fn visit_keyword_hash_node(&mut self, node: &ruby_prism::KeywordHashNode<'pr>) {
1462
+ self.children.push(node.as_node());
1463
+ }
1464
+
1465
+ fn visit_keyword_rest_parameter_node(
1466
+ &mut self,
1467
+ node: &ruby_prism::KeywordRestParameterNode<'pr>,
1468
+ ) {
1469
+ self.children.push(node.as_node());
1470
+ }
1471
+
1472
+ fn visit_lambda_node(&mut self, node: &ruby_prism::LambdaNode<'pr>) {
1473
+ self.children.push(node.as_node());
1474
+ }
1475
+
1476
+ fn visit_local_variable_and_write_node(
1477
+ &mut self,
1478
+ node: &ruby_prism::LocalVariableAndWriteNode<'pr>,
1479
+ ) {
1480
+ self.children.push(node.as_node());
1481
+ }
1482
+
1483
+ fn visit_local_variable_operator_write_node(
1484
+ &mut self,
1485
+ node: &ruby_prism::LocalVariableOperatorWriteNode<'pr>,
1486
+ ) {
1487
+ self.children.push(node.as_node());
1488
+ }
1489
+
1490
+ fn visit_local_variable_or_write_node(
1491
+ &mut self,
1492
+ node: &ruby_prism::LocalVariableOrWriteNode<'pr>,
1493
+ ) {
1494
+ self.children.push(node.as_node());
1495
+ }
1496
+
1497
+ fn visit_local_variable_read_node(
1498
+ &mut self,
1499
+ node: &ruby_prism::LocalVariableReadNode<'pr>,
1500
+ ) {
1501
+ self.children.push(node.as_node());
1502
+ }
1503
+
1504
+ fn visit_local_variable_target_node(
1505
+ &mut self,
1506
+ node: &ruby_prism::LocalVariableTargetNode<'pr>,
1507
+ ) {
1508
+ self.children.push(node.as_node());
1509
+ }
1510
+
1511
+ fn visit_local_variable_write_node(
1512
+ &mut self,
1513
+ node: &ruby_prism::LocalVariableWriteNode<'pr>,
1514
+ ) {
1515
+ self.children.push(node.as_node());
1516
+ }
1517
+
1518
+ fn visit_match_last_line_node(&mut self, node: &ruby_prism::MatchLastLineNode<'pr>) {
1519
+ self.children.push(node.as_node());
1520
+ }
1521
+
1522
+ fn visit_match_predicate_node(&mut self, node: &ruby_prism::MatchPredicateNode<'pr>) {
1523
+ self.children.push(node.as_node());
1524
+ }
1525
+
1526
+ fn visit_match_required_node(&mut self, node: &ruby_prism::MatchRequiredNode<'pr>) {
1527
+ self.children.push(node.as_node());
1528
+ }
1529
+
1530
+ fn visit_match_write_node(&mut self, node: &ruby_prism::MatchWriteNode<'pr>) {
1531
+ self.children.push(node.as_node());
1532
+ }
1533
+
1534
+ fn visit_missing_node(&mut self, node: &ruby_prism::MissingNode<'pr>) {
1535
+ self.children.push(node.as_node());
1536
+ }
1537
+
1538
+ fn visit_module_node(&mut self, node: &ruby_prism::ModuleNode<'pr>) {
1539
+ self.children.push(node.as_node());
1540
+ }
1541
+
1542
+ fn visit_multi_target_node(&mut self, node: &ruby_prism::MultiTargetNode<'pr>) {
1543
+ self.children.push(node.as_node());
1544
+ }
1545
+
1546
+ fn visit_multi_write_node(&mut self, node: &ruby_prism::MultiWriteNode<'pr>) {
1547
+ self.children.push(node.as_node());
1548
+ }
1549
+
1550
+ fn visit_next_node(&mut self, node: &ruby_prism::NextNode<'pr>) {
1551
+ self.children.push(node.as_node());
1552
+ }
1553
+
1554
+ fn visit_nil_node(&mut self, node: &ruby_prism::NilNode<'pr>) {
1555
+ self.children.push(node.as_node());
1556
+ }
1557
+
1558
+ fn visit_no_keywords_parameter_node(
1559
+ &mut self,
1560
+ node: &ruby_prism::NoKeywordsParameterNode<'pr>,
1561
+ ) {
1562
+ self.children.push(node.as_node());
1563
+ }
1564
+
1565
+ fn visit_numbered_parameters_node(
1566
+ &mut self,
1567
+ node: &ruby_prism::NumberedParametersNode<'pr>,
1568
+ ) {
1569
+ self.children.push(node.as_node());
1570
+ }
1571
+
1572
+ fn visit_numbered_reference_read_node(
1573
+ &mut self,
1574
+ node: &ruby_prism::NumberedReferenceReadNode<'pr>,
1575
+ ) {
1576
+ self.children.push(node.as_node());
1577
+ }
1578
+
1579
+ fn visit_optional_keyword_parameter_node(
1580
+ &mut self,
1581
+ node: &ruby_prism::OptionalKeywordParameterNode<'pr>,
1582
+ ) {
1583
+ self.children.push(node.as_node());
1584
+ }
1585
+
1586
+ fn visit_optional_parameter_node(&mut self, node: &ruby_prism::OptionalParameterNode<'pr>) {
1587
+ self.children.push(node.as_node());
1588
+ }
1589
+
1590
+ fn visit_or_node(&mut self, node: &ruby_prism::OrNode<'pr>) {
1591
+ self.children.push(node.as_node());
1592
+ }
1593
+
1594
+ fn visit_parameters_node(&mut self, node: &ruby_prism::ParametersNode<'pr>) {
1595
+ self.children.push(node.as_node());
1596
+ }
1597
+
1598
+ fn visit_parentheses_node(&mut self, node: &ruby_prism::ParenthesesNode<'pr>) {
1599
+ self.children.push(node.as_node());
1600
+ }
1601
+
1602
+ fn visit_pinned_expression_node(&mut self, node: &ruby_prism::PinnedExpressionNode<'pr>) {
1603
+ self.children.push(node.as_node());
1604
+ }
1605
+
1606
+ fn visit_pinned_variable_node(&mut self, node: &ruby_prism::PinnedVariableNode<'pr>) {
1607
+ self.children.push(node.as_node());
1608
+ }
1609
+
1610
+ fn visit_post_execution_node(&mut self, node: &ruby_prism::PostExecutionNode<'pr>) {
1611
+ self.children.push(node.as_node());
1612
+ }
1613
+
1614
+ fn visit_pre_execution_node(&mut self, node: &ruby_prism::PreExecutionNode<'pr>) {
1615
+ self.children.push(node.as_node());
1616
+ }
1617
+
1618
+ fn visit_program_node(&mut self, node: &ruby_prism::ProgramNode<'pr>) {
1619
+ self.children.push(node.as_node());
1620
+ }
1621
+
1622
+ fn visit_range_node(&mut self, node: &ruby_prism::RangeNode<'pr>) {
1623
+ self.children.push(node.as_node());
1624
+ }
1625
+
1626
+ fn visit_rational_node(&mut self, node: &ruby_prism::RationalNode<'pr>) {
1627
+ self.children.push(node.as_node());
1628
+ }
1629
+
1630
+ fn visit_redo_node(&mut self, node: &ruby_prism::RedoNode<'pr>) {
1631
+ self.children.push(node.as_node());
1632
+ }
1633
+
1634
+ fn visit_regular_expression_node(&mut self, node: &ruby_prism::RegularExpressionNode<'pr>) {
1635
+ self.children.push(node.as_node());
1636
+ }
1637
+
1638
+ fn visit_required_keyword_parameter_node(
1639
+ &mut self,
1640
+ node: &ruby_prism::RequiredKeywordParameterNode<'pr>,
1641
+ ) {
1642
+ self.children.push(node.as_node());
1643
+ }
1644
+
1645
+ fn visit_required_parameter_node(&mut self, node: &ruby_prism::RequiredParameterNode<'pr>) {
1646
+ self.children.push(node.as_node());
1647
+ }
1648
+
1649
+ fn visit_rescue_modifier_node(&mut self, node: &ruby_prism::RescueModifierNode<'pr>) {
1650
+ self.children.push(node.as_node());
1651
+ }
1652
+
1653
+ fn visit_rescue_node(&mut self, node: &ruby_prism::RescueNode<'pr>) {
1654
+ self.children.push(node.as_node());
1655
+ }
1656
+
1657
+ fn visit_rest_parameter_node(&mut self, node: &ruby_prism::RestParameterNode<'pr>) {
1658
+ self.children.push(node.as_node());
1659
+ }
1660
+
1661
+ fn visit_retry_node(&mut self, node: &ruby_prism::RetryNode<'pr>) {
1662
+ self.children.push(node.as_node());
1663
+ }
1664
+
1665
+ fn visit_return_node(&mut self, node: &ruby_prism::ReturnNode<'pr>) {
1666
+ self.children.push(node.as_node());
1667
+ }
1668
+
1669
+ fn visit_self_node(&mut self, node: &ruby_prism::SelfNode<'pr>) {
1670
+ self.children.push(node.as_node());
1671
+ }
1672
+
1673
+ fn visit_shareable_constant_node(&mut self, node: &ruby_prism::ShareableConstantNode<'pr>) {
1674
+ self.children.push(node.as_node());
1675
+ }
1676
+
1677
+ fn visit_singleton_class_node(&mut self, node: &ruby_prism::SingletonClassNode<'pr>) {
1678
+ self.children.push(node.as_node());
1679
+ }
1680
+
1681
+ fn visit_source_encoding_node(&mut self, node: &ruby_prism::SourceEncodingNode<'pr>) {
1682
+ self.children.push(node.as_node());
1683
+ }
1684
+
1685
+ fn visit_source_file_node(&mut self, node: &ruby_prism::SourceFileNode<'pr>) {
1686
+ self.children.push(node.as_node());
1687
+ }
1688
+
1689
+ fn visit_source_line_node(&mut self, node: &ruby_prism::SourceLineNode<'pr>) {
1690
+ self.children.push(node.as_node());
1691
+ }
1692
+
1693
+ fn visit_splat_node(&mut self, node: &ruby_prism::SplatNode<'pr>) {
1694
+ self.children.push(node.as_node());
1695
+ }
1696
+
1697
+ fn visit_statements_node(&mut self, node: &ruby_prism::StatementsNode<'pr>) {
1698
+ self.children.push(node.as_node());
1699
+ }
1700
+
1701
+ fn visit_string_node(&mut self, node: &ruby_prism::StringNode<'pr>) {
1702
+ self.children.push(node.as_node());
1703
+ }
1704
+
1705
+ fn visit_super_node(&mut self, node: &ruby_prism::SuperNode<'pr>) {
1706
+ self.children.push(node.as_node());
1707
+ }
1708
+
1709
+ fn visit_symbol_node(&mut self, node: &ruby_prism::SymbolNode<'pr>) {
1710
+ self.children.push(node.as_node());
1711
+ }
1712
+
1713
+ fn visit_true_node(&mut self, node: &ruby_prism::TrueNode<'pr>) {
1714
+ self.children.push(node.as_node());
1715
+ }
1716
+
1717
+ fn visit_undef_node(&mut self, node: &ruby_prism::UndefNode<'pr>) {
1718
+ self.children.push(node.as_node());
1719
+ }
1720
+
1721
+ fn visit_unless_node(&mut self, node: &ruby_prism::UnlessNode<'pr>) {
1722
+ self.children.push(node.as_node());
1723
+ }
1724
+
1725
+ fn visit_until_node(&mut self, node: &ruby_prism::UntilNode<'pr>) {
1726
+ self.children.push(node.as_node());
1727
+ }
1728
+
1729
+ fn visit_when_node(&mut self, node: &ruby_prism::WhenNode<'pr>) {
1730
+ self.children.push(node.as_node());
1731
+ }
1732
+
1733
+ fn visit_while_node(&mut self, node: &ruby_prism::WhileNode<'pr>) {
1734
+ self.children.push(node.as_node());
1735
+ }
1736
+
1737
+ fn visit_x_string_node(&mut self, node: &ruby_prism::XStringNode<'pr>) {
1738
+ self.children.push(node.as_node());
1739
+ }
1740
+
1741
+ fn visit_yield_node(&mut self, node: &ruby_prism::YieldNode<'pr>) {
1742
+ self.children.push(node.as_node());
1743
+ }
1744
+ }
1745
+
1746
+ let mut collector = Collector {
1747
+ children: Vec::new(),
1748
+ };
1749
+ match node {
1750
+ PrismNode::AliasGlobalVariableNode { .. } => {
1751
+ ruby_prism::visit_alias_global_variable_node(
1752
+ &mut collector,
1753
+ &node.as_alias_global_variable_node().unwrap(),
1754
+ );
1755
+ }
1756
+ PrismNode::AliasMethodNode { .. } => {
1757
+ ruby_prism::visit_alias_method_node(
1758
+ &mut collector,
1759
+ &node.as_alias_method_node().unwrap(),
1760
+ );
1761
+ }
1762
+ PrismNode::AlternationPatternNode { .. } => {
1763
+ ruby_prism::visit_alternation_pattern_node(
1764
+ &mut collector,
1765
+ &node.as_alternation_pattern_node().unwrap(),
1766
+ );
1767
+ }
1768
+ PrismNode::AndNode { .. } => {
1769
+ ruby_prism::visit_and_node(&mut collector, &node.as_and_node().unwrap());
1770
+ }
1771
+ PrismNode::ArgumentsNode { .. } => {
1772
+ ruby_prism::visit_arguments_node(&mut collector, &node.as_arguments_node().unwrap());
1773
+ }
1774
+ PrismNode::ArrayNode { .. } => {
1775
+ ruby_prism::visit_array_node(&mut collector, &node.as_array_node().unwrap());
1776
+ }
1777
+ PrismNode::ArrayPatternNode { .. } => {
1778
+ ruby_prism::visit_array_pattern_node(
1779
+ &mut collector,
1780
+ &node.as_array_pattern_node().unwrap(),
1781
+ );
1782
+ }
1783
+ PrismNode::AssocNode { .. } => {
1784
+ ruby_prism::visit_assoc_node(&mut collector, &node.as_assoc_node().unwrap());
1785
+ }
1786
+ PrismNode::AssocSplatNode { .. } => {
1787
+ ruby_prism::visit_assoc_splat_node(
1788
+ &mut collector,
1789
+ &node.as_assoc_splat_node().unwrap(),
1790
+ );
1791
+ }
1792
+ PrismNode::BackReferenceReadNode { .. } => {
1793
+ ruby_prism::visit_back_reference_read_node(
1794
+ &mut collector,
1795
+ &node.as_back_reference_read_node().unwrap(),
1796
+ );
1797
+ }
1798
+ PrismNode::BeginNode { .. } => {
1799
+ ruby_prism::visit_begin_node(&mut collector, &node.as_begin_node().unwrap());
1800
+ }
1801
+ PrismNode::BlockArgumentNode { .. } => {
1802
+ ruby_prism::visit_block_argument_node(
1803
+ &mut collector,
1804
+ &node.as_block_argument_node().unwrap(),
1805
+ );
1806
+ }
1807
+ PrismNode::BlockLocalVariableNode { .. } => {
1808
+ ruby_prism::visit_block_local_variable_node(
1809
+ &mut collector,
1810
+ &node.as_block_local_variable_node().unwrap(),
1811
+ );
1812
+ }
1813
+ PrismNode::BlockNode { .. } => {
1814
+ ruby_prism::visit_block_node(&mut collector, &node.as_block_node().unwrap());
1815
+ }
1816
+ PrismNode::BlockParameterNode { .. } => {
1817
+ ruby_prism::visit_block_parameter_node(
1818
+ &mut collector,
1819
+ &node.as_block_parameter_node().unwrap(),
1820
+ );
1821
+ }
1822
+ PrismNode::BlockParametersNode { .. } => {
1823
+ ruby_prism::visit_block_parameters_node(
1824
+ &mut collector,
1825
+ &node.as_block_parameters_node().unwrap(),
1826
+ );
1827
+ }
1828
+ PrismNode::BreakNode { .. } => {
1829
+ ruby_prism::visit_break_node(&mut collector, &node.as_break_node().unwrap());
1830
+ }
1831
+ PrismNode::CallAndWriteNode { .. } => {
1832
+ ruby_prism::visit_call_and_write_node(
1833
+ &mut collector,
1834
+ &node.as_call_and_write_node().unwrap(),
1835
+ );
1836
+ }
1837
+ PrismNode::CallNode { .. } => {
1838
+ ruby_prism::visit_call_node(&mut collector, &node.as_call_node().unwrap());
1839
+ }
1840
+ PrismNode::CallOperatorWriteNode { .. } => {
1841
+ ruby_prism::visit_call_operator_write_node(
1842
+ &mut collector,
1843
+ &node.as_call_operator_write_node().unwrap(),
1844
+ );
1845
+ }
1846
+ PrismNode::CallOrWriteNode { .. } => {
1847
+ ruby_prism::visit_call_or_write_node(
1848
+ &mut collector,
1849
+ &node.as_call_or_write_node().unwrap(),
1850
+ );
1851
+ }
1852
+ PrismNode::CallTargetNode { .. } => {
1853
+ ruby_prism::visit_call_target_node(
1854
+ &mut collector,
1855
+ &node.as_call_target_node().unwrap(),
1856
+ );
1857
+ }
1858
+ PrismNode::CapturePatternNode { .. } => {
1859
+ ruby_prism::visit_capture_pattern_node(
1860
+ &mut collector,
1861
+ &node.as_capture_pattern_node().unwrap(),
1862
+ );
1863
+ }
1864
+ PrismNode::CaseMatchNode { .. } => {
1865
+ ruby_prism::visit_case_match_node(&mut collector, &node.as_case_match_node().unwrap());
1866
+ }
1867
+ PrismNode::CaseNode { .. } => {
1868
+ ruby_prism::visit_case_node(&mut collector, &node.as_case_node().unwrap());
1869
+ }
1870
+ PrismNode::ClassNode { .. } => {
1871
+ ruby_prism::visit_class_node(&mut collector, &node.as_class_node().unwrap());
1872
+ }
1873
+ PrismNode::ClassVariableAndWriteNode { .. } => {
1874
+ ruby_prism::visit_class_variable_and_write_node(
1875
+ &mut collector,
1876
+ &node.as_class_variable_and_write_node().unwrap(),
1877
+ );
1878
+ }
1879
+ PrismNode::ClassVariableOperatorWriteNode { .. } => {
1880
+ ruby_prism::visit_class_variable_operator_write_node(
1881
+ &mut collector,
1882
+ &node.as_class_variable_operator_write_node().unwrap(),
1883
+ );
1884
+ }
1885
+ PrismNode::ClassVariableOrWriteNode { .. } => {
1886
+ ruby_prism::visit_class_variable_or_write_node(
1887
+ &mut collector,
1888
+ &node.as_class_variable_or_write_node().unwrap(),
1889
+ );
1890
+ }
1891
+ PrismNode::ClassVariableReadNode { .. } => {
1892
+ ruby_prism::visit_class_variable_read_node(
1893
+ &mut collector,
1894
+ &node.as_class_variable_read_node().unwrap(),
1895
+ );
1896
+ }
1897
+ PrismNode::ClassVariableTargetNode { .. } => {
1898
+ ruby_prism::visit_class_variable_target_node(
1899
+ &mut collector,
1900
+ &node.as_class_variable_target_node().unwrap(),
1901
+ );
1902
+ }
1903
+ PrismNode::ClassVariableWriteNode { .. } => {
1904
+ ruby_prism::visit_class_variable_write_node(
1905
+ &mut collector,
1906
+ &node.as_class_variable_write_node().unwrap(),
1907
+ );
1908
+ }
1909
+ PrismNode::ConstantAndWriteNode { .. } => {
1910
+ ruby_prism::visit_constant_and_write_node(
1911
+ &mut collector,
1912
+ &node.as_constant_and_write_node().unwrap(),
1913
+ );
1914
+ }
1915
+ PrismNode::ConstantOperatorWriteNode { .. } => {
1916
+ ruby_prism::visit_constant_operator_write_node(
1917
+ &mut collector,
1918
+ &node.as_constant_operator_write_node().unwrap(),
1919
+ );
1920
+ }
1921
+ PrismNode::ConstantOrWriteNode { .. } => {
1922
+ ruby_prism::visit_constant_or_write_node(
1923
+ &mut collector,
1924
+ &node.as_constant_or_write_node().unwrap(),
1925
+ );
1926
+ }
1927
+ PrismNode::ConstantPathAndWriteNode { .. } => {
1928
+ ruby_prism::visit_constant_path_and_write_node(
1929
+ &mut collector,
1930
+ &node.as_constant_path_and_write_node().unwrap(),
1931
+ );
1932
+ }
1933
+ PrismNode::ConstantPathNode { .. } => {
1934
+ ruby_prism::visit_constant_path_node(
1935
+ &mut collector,
1936
+ &node.as_constant_path_node().unwrap(),
1937
+ );
1938
+ }
1939
+ PrismNode::ConstantPathOperatorWriteNode { .. } => {
1940
+ ruby_prism::visit_constant_path_operator_write_node(
1941
+ &mut collector,
1942
+ &node.as_constant_path_operator_write_node().unwrap(),
1943
+ );
1944
+ }
1945
+ PrismNode::ConstantPathOrWriteNode { .. } => {
1946
+ ruby_prism::visit_constant_path_or_write_node(
1947
+ &mut collector,
1948
+ &node.as_constant_path_or_write_node().unwrap(),
1949
+ );
1950
+ }
1951
+ PrismNode::ConstantPathTargetNode { .. } => {
1952
+ ruby_prism::visit_constant_path_target_node(
1953
+ &mut collector,
1954
+ &node.as_constant_path_target_node().unwrap(),
1955
+ );
1956
+ }
1957
+ PrismNode::ConstantPathWriteNode { .. } => {
1958
+ ruby_prism::visit_constant_path_write_node(
1959
+ &mut collector,
1960
+ &node.as_constant_path_write_node().unwrap(),
1961
+ );
1962
+ }
1963
+ PrismNode::ConstantReadNode { .. } => {
1964
+ ruby_prism::visit_constant_read_node(
1965
+ &mut collector,
1966
+ &node.as_constant_read_node().unwrap(),
1967
+ );
1968
+ }
1969
+ PrismNode::ConstantTargetNode { .. } => {
1970
+ ruby_prism::visit_constant_target_node(
1971
+ &mut collector,
1972
+ &node.as_constant_target_node().unwrap(),
1973
+ );
1974
+ }
1975
+ PrismNode::ConstantWriteNode { .. } => {
1976
+ ruby_prism::visit_constant_write_node(
1977
+ &mut collector,
1978
+ &node.as_constant_write_node().unwrap(),
1979
+ );
1980
+ }
1981
+ PrismNode::DefNode { .. } => {
1982
+ ruby_prism::visit_def_node(&mut collector, &node.as_def_node().unwrap());
1983
+ }
1984
+ PrismNode::DefinedNode { .. } => {
1985
+ ruby_prism::visit_defined_node(&mut collector, &node.as_defined_node().unwrap());
1986
+ }
1987
+ PrismNode::ElseNode { .. } => {
1988
+ ruby_prism::visit_else_node(&mut collector, &node.as_else_node().unwrap());
1989
+ }
1990
+ PrismNode::EmbeddedStatementsNode { .. } => {
1991
+ ruby_prism::visit_embedded_statements_node(
1992
+ &mut collector,
1993
+ &node.as_embedded_statements_node().unwrap(),
1994
+ );
1995
+ }
1996
+ PrismNode::EmbeddedVariableNode { .. } => {
1997
+ ruby_prism::visit_embedded_variable_node(
1998
+ &mut collector,
1999
+ &node.as_embedded_variable_node().unwrap(),
2000
+ );
2001
+ }
2002
+ PrismNode::EnsureNode { .. } => {
2003
+ ruby_prism::visit_ensure_node(&mut collector, &node.as_ensure_node().unwrap());
2004
+ }
2005
+ PrismNode::FalseNode { .. } => {
2006
+ ruby_prism::visit_false_node(&mut collector, &node.as_false_node().unwrap());
2007
+ }
2008
+ PrismNode::FindPatternNode { .. } => {
2009
+ ruby_prism::visit_find_pattern_node(
2010
+ &mut collector,
2011
+ &node.as_find_pattern_node().unwrap(),
2012
+ );
2013
+ }
2014
+ PrismNode::FlipFlopNode { .. } => {
2015
+ ruby_prism::visit_flip_flop_node(&mut collector, &node.as_flip_flop_node().unwrap());
2016
+ }
2017
+ PrismNode::FloatNode { .. } => {
2018
+ ruby_prism::visit_float_node(&mut collector, &node.as_float_node().unwrap());
2019
+ }
2020
+ PrismNode::ForNode { .. } => {
2021
+ ruby_prism::visit_for_node(&mut collector, &node.as_for_node().unwrap());
2022
+ }
2023
+ PrismNode::ForwardingArgumentsNode { .. } => {
2024
+ ruby_prism::visit_forwarding_arguments_node(
2025
+ &mut collector,
2026
+ &node.as_forwarding_arguments_node().unwrap(),
2027
+ );
2028
+ }
2029
+ PrismNode::ForwardingParameterNode { .. } => {
2030
+ ruby_prism::visit_forwarding_parameter_node(
2031
+ &mut collector,
2032
+ &node.as_forwarding_parameter_node().unwrap(),
2033
+ );
2034
+ }
2035
+ PrismNode::ForwardingSuperNode { .. } => {
2036
+ ruby_prism::visit_forwarding_super_node(
2037
+ &mut collector,
2038
+ &node.as_forwarding_super_node().unwrap(),
2039
+ );
2040
+ }
2041
+ PrismNode::GlobalVariableAndWriteNode { .. } => {
2042
+ ruby_prism::visit_global_variable_and_write_node(
2043
+ &mut collector,
2044
+ &node.as_global_variable_and_write_node().unwrap(),
2045
+ );
2046
+ }
2047
+ PrismNode::GlobalVariableOperatorWriteNode { .. } => {
2048
+ ruby_prism::visit_global_variable_operator_write_node(
2049
+ &mut collector,
2050
+ &node.as_global_variable_operator_write_node().unwrap(),
2051
+ );
2052
+ }
2053
+ PrismNode::GlobalVariableOrWriteNode { .. } => {
2054
+ ruby_prism::visit_global_variable_or_write_node(
2055
+ &mut collector,
2056
+ &node.as_global_variable_or_write_node().unwrap(),
2057
+ );
2058
+ }
2059
+ PrismNode::GlobalVariableReadNode { .. } => {
2060
+ ruby_prism::visit_global_variable_read_node(
2061
+ &mut collector,
2062
+ &node.as_global_variable_read_node().unwrap(),
2063
+ );
2064
+ }
2065
+ PrismNode::GlobalVariableTargetNode { .. } => {
2066
+ ruby_prism::visit_global_variable_target_node(
2067
+ &mut collector,
2068
+ &node.as_global_variable_target_node().unwrap(),
2069
+ );
2070
+ }
2071
+ PrismNode::GlobalVariableWriteNode { .. } => {
2072
+ ruby_prism::visit_global_variable_write_node(
2073
+ &mut collector,
2074
+ &node.as_global_variable_write_node().unwrap(),
2075
+ );
2076
+ }
2077
+ PrismNode::HashNode { .. } => {
2078
+ ruby_prism::visit_hash_node(&mut collector, &node.as_hash_node().unwrap());
2079
+ }
2080
+ PrismNode::HashPatternNode { .. } => {
2081
+ ruby_prism::visit_hash_pattern_node(
2082
+ &mut collector,
2083
+ &node.as_hash_pattern_node().unwrap(),
2084
+ );
2085
+ }
2086
+ PrismNode::IfNode { .. } => {
2087
+ ruby_prism::visit_if_node(&mut collector, &node.as_if_node().unwrap());
2088
+ }
2089
+ PrismNode::ImaginaryNode { .. } => {
2090
+ ruby_prism::visit_imaginary_node(&mut collector, &node.as_imaginary_node().unwrap());
2091
+ }
2092
+ PrismNode::ImplicitNode { .. } => {
2093
+ ruby_prism::visit_implicit_node(&mut collector, &node.as_implicit_node().unwrap());
2094
+ }
2095
+ PrismNode::ImplicitRestNode { .. } => {
2096
+ ruby_prism::visit_implicit_rest_node(
2097
+ &mut collector,
2098
+ &node.as_implicit_rest_node().unwrap(),
2099
+ );
2100
+ }
2101
+ PrismNode::InNode { .. } => {
2102
+ ruby_prism::visit_in_node(&mut collector, &node.as_in_node().unwrap());
2103
+ }
2104
+ PrismNode::IndexAndWriteNode { .. } => {
2105
+ ruby_prism::visit_index_and_write_node(
2106
+ &mut collector,
2107
+ &node.as_index_and_write_node().unwrap(),
2108
+ );
2109
+ }
2110
+ PrismNode::IndexOperatorWriteNode { .. } => {
2111
+ ruby_prism::visit_index_operator_write_node(
2112
+ &mut collector,
2113
+ &node.as_index_operator_write_node().unwrap(),
2114
+ );
2115
+ }
2116
+ PrismNode::IndexOrWriteNode { .. } => {
2117
+ ruby_prism::visit_index_or_write_node(
2118
+ &mut collector,
2119
+ &node.as_index_or_write_node().unwrap(),
2120
+ );
2121
+ }
2122
+ PrismNode::IndexTargetNode { .. } => {
2123
+ ruby_prism::visit_index_target_node(
2124
+ &mut collector,
2125
+ &node.as_index_target_node().unwrap(),
2126
+ );
2127
+ }
2128
+ PrismNode::InstanceVariableAndWriteNode { .. } => {
2129
+ ruby_prism::visit_instance_variable_and_write_node(
2130
+ &mut collector,
2131
+ &node.as_instance_variable_and_write_node().unwrap(),
2132
+ );
2133
+ }
2134
+ PrismNode::InstanceVariableOperatorWriteNode { .. } => {
2135
+ ruby_prism::visit_instance_variable_operator_write_node(
2136
+ &mut collector,
2137
+ &node.as_instance_variable_operator_write_node().unwrap(),
2138
+ );
2139
+ }
2140
+ PrismNode::InstanceVariableOrWriteNode { .. } => {
2141
+ ruby_prism::visit_instance_variable_or_write_node(
2142
+ &mut collector,
2143
+ &node.as_instance_variable_or_write_node().unwrap(),
2144
+ );
2145
+ }
2146
+ PrismNode::InstanceVariableReadNode { .. } => {
2147
+ ruby_prism::visit_instance_variable_read_node(
2148
+ &mut collector,
2149
+ &node.as_instance_variable_read_node().unwrap(),
2150
+ );
2151
+ }
2152
+ PrismNode::InstanceVariableTargetNode { .. } => {
2153
+ ruby_prism::visit_instance_variable_target_node(
2154
+ &mut collector,
2155
+ &node.as_instance_variable_target_node().unwrap(),
2156
+ );
2157
+ }
2158
+ PrismNode::InstanceVariableWriteNode { .. } => {
2159
+ ruby_prism::visit_instance_variable_write_node(
2160
+ &mut collector,
2161
+ &node.as_instance_variable_write_node().unwrap(),
2162
+ );
2163
+ }
2164
+ PrismNode::IntegerNode { .. } => {
2165
+ ruby_prism::visit_integer_node(&mut collector, &node.as_integer_node().unwrap());
2166
+ }
2167
+ PrismNode::InterpolatedMatchLastLineNode { .. } => {
2168
+ ruby_prism::visit_interpolated_match_last_line_node(
2169
+ &mut collector,
2170
+ &node.as_interpolated_match_last_line_node().unwrap(),
2171
+ );
2172
+ }
2173
+ PrismNode::InterpolatedRegularExpressionNode { .. } => {
2174
+ ruby_prism::visit_interpolated_regular_expression_node(
2175
+ &mut collector,
2176
+ &node.as_interpolated_regular_expression_node().unwrap(),
2177
+ );
2178
+ }
2179
+ PrismNode::InterpolatedStringNode { .. } => {
2180
+ ruby_prism::visit_interpolated_string_node(
2181
+ &mut collector,
2182
+ &node.as_interpolated_string_node().unwrap(),
2183
+ );
2184
+ }
2185
+ PrismNode::InterpolatedSymbolNode { .. } => {
2186
+ ruby_prism::visit_interpolated_symbol_node(
2187
+ &mut collector,
2188
+ &node.as_interpolated_symbol_node().unwrap(),
2189
+ );
2190
+ }
2191
+ PrismNode::InterpolatedXStringNode { .. } => {
2192
+ ruby_prism::visit_interpolated_x_string_node(
2193
+ &mut collector,
2194
+ &node.as_interpolated_x_string_node().unwrap(),
2195
+ );
2196
+ }
2197
+ PrismNode::ItLocalVariableReadNode { .. } => {
2198
+ ruby_prism::visit_it_local_variable_read_node(
2199
+ &mut collector,
2200
+ &node.as_it_local_variable_read_node().unwrap(),
2201
+ );
2202
+ }
2203
+ PrismNode::ItParametersNode { .. } => {
2204
+ ruby_prism::visit_it_parameters_node(
2205
+ &mut collector,
2206
+ &node.as_it_parameters_node().unwrap(),
2207
+ );
2208
+ }
2209
+ PrismNode::KeywordHashNode { .. } => {
2210
+ ruby_prism::visit_keyword_hash_node(
2211
+ &mut collector,
2212
+ &node.as_keyword_hash_node().unwrap(),
2213
+ );
2214
+ }
2215
+ PrismNode::KeywordRestParameterNode { .. } => {
2216
+ ruby_prism::visit_keyword_rest_parameter_node(
2217
+ &mut collector,
2218
+ &node.as_keyword_rest_parameter_node().unwrap(),
2219
+ );
2220
+ }
2221
+ PrismNode::LambdaNode { .. } => {
2222
+ ruby_prism::visit_lambda_node(&mut collector, &node.as_lambda_node().unwrap());
2223
+ }
2224
+ PrismNode::LocalVariableAndWriteNode { .. } => {
2225
+ ruby_prism::visit_local_variable_and_write_node(
2226
+ &mut collector,
2227
+ &node.as_local_variable_and_write_node().unwrap(),
2228
+ );
2229
+ }
2230
+ PrismNode::LocalVariableOperatorWriteNode { .. } => {
2231
+ ruby_prism::visit_local_variable_operator_write_node(
2232
+ &mut collector,
2233
+ &node.as_local_variable_operator_write_node().unwrap(),
2234
+ );
2235
+ }
2236
+ PrismNode::LocalVariableOrWriteNode { .. } => {
2237
+ ruby_prism::visit_local_variable_or_write_node(
2238
+ &mut collector,
2239
+ &node.as_local_variable_or_write_node().unwrap(),
2240
+ );
2241
+ }
2242
+ PrismNode::LocalVariableReadNode { .. } => {
2243
+ ruby_prism::visit_local_variable_read_node(
2244
+ &mut collector,
2245
+ &node.as_local_variable_read_node().unwrap(),
2246
+ );
2247
+ }
2248
+ PrismNode::LocalVariableTargetNode { .. } => {
2249
+ ruby_prism::visit_local_variable_target_node(
2250
+ &mut collector,
2251
+ &node.as_local_variable_target_node().unwrap(),
2252
+ );
2253
+ }
2254
+ PrismNode::LocalVariableWriteNode { .. } => {
2255
+ ruby_prism::visit_local_variable_write_node(
2256
+ &mut collector,
2257
+ &node.as_local_variable_write_node().unwrap(),
2258
+ );
2259
+ }
2260
+ PrismNode::MatchLastLineNode { .. } => {
2261
+ ruby_prism::visit_match_last_line_node(
2262
+ &mut collector,
2263
+ &node.as_match_last_line_node().unwrap(),
2264
+ );
2265
+ }
2266
+ PrismNode::MatchPredicateNode { .. } => {
2267
+ ruby_prism::visit_match_predicate_node(
2268
+ &mut collector,
2269
+ &node.as_match_predicate_node().unwrap(),
2270
+ );
2271
+ }
2272
+ PrismNode::MatchRequiredNode { .. } => {
2273
+ ruby_prism::visit_match_required_node(
2274
+ &mut collector,
2275
+ &node.as_match_required_node().unwrap(),
2276
+ );
2277
+ }
2278
+ PrismNode::MatchWriteNode { .. } => {
2279
+ ruby_prism::visit_match_write_node(
2280
+ &mut collector,
2281
+ &node.as_match_write_node().unwrap(),
2282
+ );
2283
+ }
2284
+ PrismNode::MissingNode { .. } => {
2285
+ ruby_prism::visit_missing_node(&mut collector, &node.as_missing_node().unwrap());
2286
+ }
2287
+ PrismNode::ModuleNode { .. } => {
2288
+ ruby_prism::visit_module_node(&mut collector, &node.as_module_node().unwrap());
2289
+ }
2290
+ PrismNode::MultiTargetNode { .. } => {
2291
+ ruby_prism::visit_multi_target_node(
2292
+ &mut collector,
2293
+ &node.as_multi_target_node().unwrap(),
2294
+ );
2295
+ }
2296
+ PrismNode::MultiWriteNode { .. } => {
2297
+ ruby_prism::visit_multi_write_node(
2298
+ &mut collector,
2299
+ &node.as_multi_write_node().unwrap(),
2300
+ );
2301
+ }
2302
+ PrismNode::NextNode { .. } => {
2303
+ ruby_prism::visit_next_node(&mut collector, &node.as_next_node().unwrap());
2304
+ }
2305
+ PrismNode::NilNode { .. } => {
2306
+ ruby_prism::visit_nil_node(&mut collector, &node.as_nil_node().unwrap());
2307
+ }
2308
+ PrismNode::NoKeywordsParameterNode { .. } => {
2309
+ ruby_prism::visit_no_keywords_parameter_node(
2310
+ &mut collector,
2311
+ &node.as_no_keywords_parameter_node().unwrap(),
2312
+ );
2313
+ }
2314
+ PrismNode::NumberedParametersNode { .. } => {
2315
+ ruby_prism::visit_numbered_parameters_node(
2316
+ &mut collector,
2317
+ &node.as_numbered_parameters_node().unwrap(),
2318
+ );
2319
+ }
2320
+ PrismNode::NumberedReferenceReadNode { .. } => {
2321
+ ruby_prism::visit_numbered_reference_read_node(
2322
+ &mut collector,
2323
+ &node.as_numbered_reference_read_node().unwrap(),
2324
+ );
2325
+ }
2326
+ PrismNode::OptionalKeywordParameterNode { .. } => {
2327
+ ruby_prism::visit_optional_keyword_parameter_node(
2328
+ &mut collector,
2329
+ &node.as_optional_keyword_parameter_node().unwrap(),
2330
+ );
2331
+ }
2332
+ PrismNode::OptionalParameterNode { .. } => {
2333
+ ruby_prism::visit_optional_parameter_node(
2334
+ &mut collector,
2335
+ &node.as_optional_parameter_node().unwrap(),
2336
+ );
2337
+ }
2338
+ PrismNode::OrNode { .. } => {
2339
+ ruby_prism::visit_or_node(&mut collector, &node.as_or_node().unwrap());
2340
+ }
2341
+ PrismNode::ParametersNode { .. } => {
2342
+ ruby_prism::visit_parameters_node(&mut collector, &node.as_parameters_node().unwrap());
2343
+ }
2344
+ PrismNode::ParenthesesNode { .. } => {
2345
+ ruby_prism::visit_parentheses_node(
2346
+ &mut collector,
2347
+ &node.as_parentheses_node().unwrap(),
2348
+ );
2349
+ }
2350
+ PrismNode::PinnedExpressionNode { .. } => {
2351
+ ruby_prism::visit_pinned_expression_node(
2352
+ &mut collector,
2353
+ &node.as_pinned_expression_node().unwrap(),
2354
+ );
2355
+ }
2356
+ PrismNode::PinnedVariableNode { .. } => {
2357
+ ruby_prism::visit_pinned_variable_node(
2358
+ &mut collector,
2359
+ &node.as_pinned_variable_node().unwrap(),
2360
+ );
2361
+ }
2362
+ PrismNode::PostExecutionNode { .. } => {
2363
+ ruby_prism::visit_post_execution_node(
2364
+ &mut collector,
2365
+ &node.as_post_execution_node().unwrap(),
2366
+ );
2367
+ }
2368
+ PrismNode::PreExecutionNode { .. } => {
2369
+ ruby_prism::visit_pre_execution_node(
2370
+ &mut collector,
2371
+ &node.as_pre_execution_node().unwrap(),
2372
+ );
2373
+ }
2374
+ PrismNode::ProgramNode { .. } => {
2375
+ ruby_prism::visit_program_node(&mut collector, &node.as_program_node().unwrap());
2376
+ }
2377
+ PrismNode::RangeNode { .. } => {
2378
+ ruby_prism::visit_range_node(&mut collector, &node.as_range_node().unwrap());
2379
+ }
2380
+ PrismNode::RationalNode { .. } => {
2381
+ ruby_prism::visit_rational_node(&mut collector, &node.as_rational_node().unwrap());
2382
+ }
2383
+ PrismNode::RedoNode { .. } => {
2384
+ ruby_prism::visit_redo_node(&mut collector, &node.as_redo_node().unwrap());
2385
+ }
2386
+ PrismNode::RegularExpressionNode { .. } => {
2387
+ ruby_prism::visit_regular_expression_node(
2388
+ &mut collector,
2389
+ &node.as_regular_expression_node().unwrap(),
2390
+ );
2391
+ }
2392
+ PrismNode::RequiredKeywordParameterNode { .. } => {
2393
+ ruby_prism::visit_required_keyword_parameter_node(
2394
+ &mut collector,
2395
+ &node.as_required_keyword_parameter_node().unwrap(),
2396
+ );
2397
+ }
2398
+ PrismNode::RequiredParameterNode { .. } => {
2399
+ ruby_prism::visit_required_parameter_node(
2400
+ &mut collector,
2401
+ &node.as_required_parameter_node().unwrap(),
2402
+ );
2403
+ }
2404
+ PrismNode::RescueModifierNode { .. } => {
2405
+ ruby_prism::visit_rescue_modifier_node(
2406
+ &mut collector,
2407
+ &node.as_rescue_modifier_node().unwrap(),
2408
+ );
2409
+ }
2410
+ PrismNode::RescueNode { .. } => {
2411
+ ruby_prism::visit_rescue_node(&mut collector, &node.as_rescue_node().unwrap());
2412
+ }
2413
+ PrismNode::RestParameterNode { .. } => {
2414
+ ruby_prism::visit_rest_parameter_node(
2415
+ &mut collector,
2416
+ &node.as_rest_parameter_node().unwrap(),
2417
+ );
2418
+ }
2419
+ PrismNode::RetryNode { .. } => {
2420
+ ruby_prism::visit_retry_node(&mut collector, &node.as_retry_node().unwrap());
2421
+ }
2422
+ PrismNode::ReturnNode { .. } => {
2423
+ ruby_prism::visit_return_node(&mut collector, &node.as_return_node().unwrap());
2424
+ }
2425
+ PrismNode::SelfNode { .. } => {
2426
+ ruby_prism::visit_self_node(&mut collector, &node.as_self_node().unwrap());
2427
+ }
2428
+ PrismNode::ShareableConstantNode { .. } => {
2429
+ ruby_prism::visit_shareable_constant_node(
2430
+ &mut collector,
2431
+ &node.as_shareable_constant_node().unwrap(),
2432
+ );
2433
+ }
2434
+ PrismNode::SingletonClassNode { .. } => {
2435
+ ruby_prism::visit_singleton_class_node(
2436
+ &mut collector,
2437
+ &node.as_singleton_class_node().unwrap(),
2438
+ );
2439
+ }
2440
+ PrismNode::SourceEncodingNode { .. } => {
2441
+ ruby_prism::visit_source_encoding_node(
2442
+ &mut collector,
2443
+ &node.as_source_encoding_node().unwrap(),
2444
+ );
2445
+ }
2446
+ PrismNode::SourceFileNode { .. } => {
2447
+ ruby_prism::visit_source_file_node(
2448
+ &mut collector,
2449
+ &node.as_source_file_node().unwrap(),
2450
+ );
2451
+ }
2452
+ PrismNode::SourceLineNode { .. } => {
2453
+ ruby_prism::visit_source_line_node(
2454
+ &mut collector,
2455
+ &node.as_source_line_node().unwrap(),
2456
+ );
2457
+ }
2458
+ PrismNode::SplatNode { .. } => {
2459
+ ruby_prism::visit_splat_node(&mut collector, &node.as_splat_node().unwrap());
2460
+ }
2461
+ PrismNode::StatementsNode { .. } => {
2462
+ ruby_prism::visit_statements_node(&mut collector, &node.as_statements_node().unwrap());
2463
+ }
2464
+ PrismNode::StringNode { .. } => {
2465
+ ruby_prism::visit_string_node(&mut collector, &node.as_string_node().unwrap());
2466
+ }
2467
+ PrismNode::SuperNode { .. } => {
2468
+ ruby_prism::visit_super_node(&mut collector, &node.as_super_node().unwrap());
2469
+ }
2470
+ PrismNode::SymbolNode { .. } => {
2471
+ ruby_prism::visit_symbol_node(&mut collector, &node.as_symbol_node().unwrap());
2472
+ }
2473
+ PrismNode::TrueNode { .. } => {
2474
+ ruby_prism::visit_true_node(&mut collector, &node.as_true_node().unwrap());
2475
+ }
2476
+ PrismNode::UndefNode { .. } => {
2477
+ ruby_prism::visit_undef_node(&mut collector, &node.as_undef_node().unwrap());
2478
+ }
2479
+ PrismNode::UnlessNode { .. } => {
2480
+ ruby_prism::visit_unless_node(&mut collector, &node.as_unless_node().unwrap());
2481
+ }
2482
+ PrismNode::UntilNode { .. } => {
2483
+ ruby_prism::visit_until_node(&mut collector, &node.as_until_node().unwrap());
2484
+ }
2485
+ PrismNode::WhenNode { .. } => {
2486
+ ruby_prism::visit_when_node(&mut collector, &node.as_when_node().unwrap());
2487
+ }
2488
+ PrismNode::WhileNode { .. } => {
2489
+ ruby_prism::visit_while_node(&mut collector, &node.as_while_node().unwrap());
2490
+ }
2491
+ PrismNode::XStringNode { .. } => {
2492
+ ruby_prism::visit_x_string_node(&mut collector, &node.as_x_string_node().unwrap());
2493
+ }
2494
+ PrismNode::YieldNode { .. } => {
2495
+ ruby_prism::visit_yield_node(&mut collector, &node.as_yield_node().unwrap());
2496
+ }
2497
+ }
2498
+ collector.children
2499
+ }
2500
+
2501
+ /// `closing_loc` for every node kind that has one, mirroring the bridge's
2502
+ /// `respond_to?(:closing_loc)` (both lists are generated from prism's
2503
+ /// config.yml, so the coverage is the complete set for this prism version).
2504
+ fn own_closing_loc<'pr>(node: &PrismNode<'pr>) -> Option<PrismLocation<'pr>> {
2505
+ match node {
2506
+ PrismNode::ArrayNode { .. } => node.as_array_node().unwrap().closing_loc(),
2507
+ PrismNode::ArrayPatternNode { .. } => node.as_array_pattern_node().unwrap().closing_loc(),
2508
+ PrismNode::BlockNode { .. } => Some(node.as_block_node().unwrap().closing_loc()),
2509
+ PrismNode::BlockParametersNode { .. } => {
2510
+ node.as_block_parameters_node().unwrap().closing_loc()
2511
+ }
2512
+ PrismNode::CallNode { .. } => node.as_call_node().unwrap().closing_loc(),
2513
+ PrismNode::EmbeddedStatementsNode { .. } => {
2514
+ Some(node.as_embedded_statements_node().unwrap().closing_loc())
2515
+ }
2516
+ PrismNode::FindPatternNode { .. } => node.as_find_pattern_node().unwrap().closing_loc(),
2517
+ PrismNode::HashNode { .. } => Some(node.as_hash_node().unwrap().closing_loc()),
2518
+ PrismNode::HashPatternNode { .. } => node.as_hash_pattern_node().unwrap().closing_loc(),
2519
+ PrismNode::IndexAndWriteNode { .. } => {
2520
+ Some(node.as_index_and_write_node().unwrap().closing_loc())
2521
+ }
2522
+ PrismNode::IndexOperatorWriteNode { .. } => {
2523
+ Some(node.as_index_operator_write_node().unwrap().closing_loc())
2524
+ }
2525
+ PrismNode::IndexOrWriteNode { .. } => {
2526
+ Some(node.as_index_or_write_node().unwrap().closing_loc())
2527
+ }
2528
+ PrismNode::IndexTargetNode { .. } => {
2529
+ Some(node.as_index_target_node().unwrap().closing_loc())
2530
+ }
2531
+ PrismNode::InterpolatedMatchLastLineNode { .. } => Some(
2532
+ node.as_interpolated_match_last_line_node()
2533
+ .unwrap()
2534
+ .closing_loc(),
2535
+ ),
2536
+ PrismNode::InterpolatedRegularExpressionNode { .. } => Some(
2537
+ node.as_interpolated_regular_expression_node()
2538
+ .unwrap()
2539
+ .closing_loc(),
2540
+ ),
2541
+ PrismNode::InterpolatedStringNode { .. } => {
2542
+ node.as_interpolated_string_node().unwrap().closing_loc()
2543
+ }
2544
+ PrismNode::InterpolatedSymbolNode { .. } => {
2545
+ node.as_interpolated_symbol_node().unwrap().closing_loc()
2546
+ }
2547
+ PrismNode::InterpolatedXStringNode { .. } => {
2548
+ Some(node.as_interpolated_x_string_node().unwrap().closing_loc())
2549
+ }
2550
+ PrismNode::LambdaNode { .. } => Some(node.as_lambda_node().unwrap().closing_loc()),
2551
+ PrismNode::MatchLastLineNode { .. } => {
2552
+ Some(node.as_match_last_line_node().unwrap().closing_loc())
2553
+ }
2554
+ PrismNode::ParenthesesNode { .. } => {
2555
+ Some(node.as_parentheses_node().unwrap().closing_loc())
2556
+ }
2557
+ PrismNode::PostExecutionNode { .. } => {
2558
+ Some(node.as_post_execution_node().unwrap().closing_loc())
2559
+ }
2560
+ PrismNode::PreExecutionNode { .. } => {
2561
+ Some(node.as_pre_execution_node().unwrap().closing_loc())
2562
+ }
2563
+ PrismNode::RegularExpressionNode { .. } => {
2564
+ Some(node.as_regular_expression_node().unwrap().closing_loc())
2565
+ }
2566
+ PrismNode::StringNode { .. } => node.as_string_node().unwrap().closing_loc(),
2567
+ PrismNode::SymbolNode { .. } => node.as_symbol_node().unwrap().closing_loc(),
2568
+ PrismNode::UntilNode { .. } => node.as_until_node().unwrap().closing_loc(),
2569
+ PrismNode::WhileNode { .. } => node.as_while_node().unwrap().closing_loc(),
2570
+ PrismNode::XStringNode { .. } => Some(node.as_x_string_node().unwrap().closing_loc()),
2571
+ _ => None,
2572
+ }
2573
+ }
2574
+
2575
+ /// Prism node kind as the snake_cased Ruby class name, matching the bridge's
2576
+ /// node_type_name. Fed to NodeType::from_str, which falls back to Unknown.
2577
+ fn node_kind_name(node: &PrismNode<'_>) -> &'static str {
2578
+ match node {
2579
+ PrismNode::AliasGlobalVariableNode { .. } => "alias_global_variable_node",
2580
+ PrismNode::AliasMethodNode { .. } => "alias_method_node",
2581
+ PrismNode::AlternationPatternNode { .. } => "alternation_pattern_node",
2582
+ PrismNode::AndNode { .. } => "and_node",
2583
+ PrismNode::ArgumentsNode { .. } => "arguments_node",
2584
+ PrismNode::ArrayNode { .. } => "array_node",
2585
+ PrismNode::ArrayPatternNode { .. } => "array_pattern_node",
2586
+ PrismNode::AssocNode { .. } => "assoc_node",
2587
+ PrismNode::AssocSplatNode { .. } => "assoc_splat_node",
2588
+ PrismNode::BackReferenceReadNode { .. } => "back_reference_read_node",
2589
+ PrismNode::BeginNode { .. } => "begin_node",
2590
+ PrismNode::BlockArgumentNode { .. } => "block_argument_node",
2591
+ PrismNode::BlockLocalVariableNode { .. } => "block_local_variable_node",
2592
+ PrismNode::BlockNode { .. } => "block_node",
2593
+ PrismNode::BlockParameterNode { .. } => "block_parameter_node",
2594
+ PrismNode::BlockParametersNode { .. } => "block_parameters_node",
2595
+ PrismNode::BreakNode { .. } => "break_node",
2596
+ PrismNode::CallAndWriteNode { .. } => "call_and_write_node",
2597
+ PrismNode::CallNode { .. } => "call_node",
2598
+ PrismNode::CallOperatorWriteNode { .. } => "call_operator_write_node",
2599
+ PrismNode::CallOrWriteNode { .. } => "call_or_write_node",
2600
+ PrismNode::CallTargetNode { .. } => "call_target_node",
2601
+ PrismNode::CapturePatternNode { .. } => "capture_pattern_node",
2602
+ PrismNode::CaseMatchNode { .. } => "case_match_node",
2603
+ PrismNode::CaseNode { .. } => "case_node",
2604
+ PrismNode::ClassNode { .. } => "class_node",
2605
+ PrismNode::ClassVariableAndWriteNode { .. } => "class_variable_and_write_node",
2606
+ PrismNode::ClassVariableOperatorWriteNode { .. } => "class_variable_operator_write_node",
2607
+ PrismNode::ClassVariableOrWriteNode { .. } => "class_variable_or_write_node",
2608
+ PrismNode::ClassVariableReadNode { .. } => "class_variable_read_node",
2609
+ PrismNode::ClassVariableTargetNode { .. } => "class_variable_target_node",
2610
+ PrismNode::ClassVariableWriteNode { .. } => "class_variable_write_node",
2611
+ PrismNode::ConstantAndWriteNode { .. } => "constant_and_write_node",
2612
+ PrismNode::ConstantOperatorWriteNode { .. } => "constant_operator_write_node",
2613
+ PrismNode::ConstantOrWriteNode { .. } => "constant_or_write_node",
2614
+ PrismNode::ConstantPathAndWriteNode { .. } => "constant_path_and_write_node",
2615
+ PrismNode::ConstantPathNode { .. } => "constant_path_node",
2616
+ PrismNode::ConstantPathOperatorWriteNode { .. } => "constant_path_operator_write_node",
2617
+ PrismNode::ConstantPathOrWriteNode { .. } => "constant_path_or_write_node",
2618
+ PrismNode::ConstantPathTargetNode { .. } => "constant_path_target_node",
2619
+ PrismNode::ConstantPathWriteNode { .. } => "constant_path_write_node",
2620
+ PrismNode::ConstantReadNode { .. } => "constant_read_node",
2621
+ PrismNode::ConstantTargetNode { .. } => "constant_target_node",
2622
+ PrismNode::ConstantWriteNode { .. } => "constant_write_node",
2623
+ PrismNode::DefNode { .. } => "def_node",
2624
+ PrismNode::DefinedNode { .. } => "defined_node",
2625
+ PrismNode::ElseNode { .. } => "else_node",
2626
+ PrismNode::EmbeddedStatementsNode { .. } => "embedded_statements_node",
2627
+ PrismNode::EmbeddedVariableNode { .. } => "embedded_variable_node",
2628
+ PrismNode::EnsureNode { .. } => "ensure_node",
2629
+ PrismNode::FalseNode { .. } => "false_node",
2630
+ PrismNode::FindPatternNode { .. } => "find_pattern_node",
2631
+ PrismNode::FlipFlopNode { .. } => "flip_flop_node",
2632
+ PrismNode::FloatNode { .. } => "float_node",
2633
+ PrismNode::ForNode { .. } => "for_node",
2634
+ PrismNode::ForwardingArgumentsNode { .. } => "forwarding_arguments_node",
2635
+ PrismNode::ForwardingParameterNode { .. } => "forwarding_parameter_node",
2636
+ PrismNode::ForwardingSuperNode { .. } => "forwarding_super_node",
2637
+ PrismNode::GlobalVariableAndWriteNode { .. } => "global_variable_and_write_node",
2638
+ PrismNode::GlobalVariableOperatorWriteNode { .. } => "global_variable_operator_write_node",
2639
+ PrismNode::GlobalVariableOrWriteNode { .. } => "global_variable_or_write_node",
2640
+ PrismNode::GlobalVariableReadNode { .. } => "global_variable_read_node",
2641
+ PrismNode::GlobalVariableTargetNode { .. } => "global_variable_target_node",
2642
+ PrismNode::GlobalVariableWriteNode { .. } => "global_variable_write_node",
2643
+ PrismNode::HashNode { .. } => "hash_node",
2644
+ PrismNode::HashPatternNode { .. } => "hash_pattern_node",
2645
+ PrismNode::IfNode { .. } => "if_node",
2646
+ PrismNode::ImaginaryNode { .. } => "imaginary_node",
2647
+ PrismNode::ImplicitNode { .. } => "implicit_node",
2648
+ PrismNode::ImplicitRestNode { .. } => "implicit_rest_node",
2649
+ PrismNode::InNode { .. } => "in_node",
2650
+ PrismNode::IndexAndWriteNode { .. } => "index_and_write_node",
2651
+ PrismNode::IndexOperatorWriteNode { .. } => "index_operator_write_node",
2652
+ PrismNode::IndexOrWriteNode { .. } => "index_or_write_node",
2653
+ PrismNode::IndexTargetNode { .. } => "index_target_node",
2654
+ PrismNode::InstanceVariableAndWriteNode { .. } => "instance_variable_and_write_node",
2655
+ PrismNode::InstanceVariableOperatorWriteNode { .. } => {
2656
+ "instance_variable_operator_write_node"
2657
+ }
2658
+ PrismNode::InstanceVariableOrWriteNode { .. } => "instance_variable_or_write_node",
2659
+ PrismNode::InstanceVariableReadNode { .. } => "instance_variable_read_node",
2660
+ PrismNode::InstanceVariableTargetNode { .. } => "instance_variable_target_node",
2661
+ PrismNode::InstanceVariableWriteNode { .. } => "instance_variable_write_node",
2662
+ PrismNode::IntegerNode { .. } => "integer_node",
2663
+ PrismNode::InterpolatedMatchLastLineNode { .. } => "interpolated_match_last_line_node",
2664
+ PrismNode::InterpolatedRegularExpressionNode { .. } => {
2665
+ "interpolated_regular_expression_node"
2666
+ }
2667
+ PrismNode::InterpolatedStringNode { .. } => "interpolated_string_node",
2668
+ PrismNode::InterpolatedSymbolNode { .. } => "interpolated_symbol_node",
2669
+ PrismNode::InterpolatedXStringNode { .. } => "interpolated_x_string_node",
2670
+ PrismNode::ItLocalVariableReadNode { .. } => "it_local_variable_read_node",
2671
+ PrismNode::ItParametersNode { .. } => "it_parameters_node",
2672
+ PrismNode::KeywordHashNode { .. } => "keyword_hash_node",
2673
+ PrismNode::KeywordRestParameterNode { .. } => "keyword_rest_parameter_node",
2674
+ PrismNode::LambdaNode { .. } => "lambda_node",
2675
+ PrismNode::LocalVariableAndWriteNode { .. } => "local_variable_and_write_node",
2676
+ PrismNode::LocalVariableOperatorWriteNode { .. } => "local_variable_operator_write_node",
2677
+ PrismNode::LocalVariableOrWriteNode { .. } => "local_variable_or_write_node",
2678
+ PrismNode::LocalVariableReadNode { .. } => "local_variable_read_node",
2679
+ PrismNode::LocalVariableTargetNode { .. } => "local_variable_target_node",
2680
+ PrismNode::LocalVariableWriteNode { .. } => "local_variable_write_node",
2681
+ PrismNode::MatchLastLineNode { .. } => "match_last_line_node",
2682
+ PrismNode::MatchPredicateNode { .. } => "match_predicate_node",
2683
+ PrismNode::MatchRequiredNode { .. } => "match_required_node",
2684
+ PrismNode::MatchWriteNode { .. } => "match_write_node",
2685
+ PrismNode::MissingNode { .. } => "missing_node",
2686
+ PrismNode::ModuleNode { .. } => "module_node",
2687
+ PrismNode::MultiTargetNode { .. } => "multi_target_node",
2688
+ PrismNode::MultiWriteNode { .. } => "multi_write_node",
2689
+ PrismNode::NextNode { .. } => "next_node",
2690
+ PrismNode::NilNode { .. } => "nil_node",
2691
+ PrismNode::NoKeywordsParameterNode { .. } => "no_keywords_parameter_node",
2692
+ PrismNode::NumberedParametersNode { .. } => "numbered_parameters_node",
2693
+ PrismNode::NumberedReferenceReadNode { .. } => "numbered_reference_read_node",
2694
+ PrismNode::OptionalKeywordParameterNode { .. } => "optional_keyword_parameter_node",
2695
+ PrismNode::OptionalParameterNode { .. } => "optional_parameter_node",
2696
+ PrismNode::OrNode { .. } => "or_node",
2697
+ PrismNode::ParametersNode { .. } => "parameters_node",
2698
+ PrismNode::ParenthesesNode { .. } => "parentheses_node",
2699
+ PrismNode::PinnedExpressionNode { .. } => "pinned_expression_node",
2700
+ PrismNode::PinnedVariableNode { .. } => "pinned_variable_node",
2701
+ PrismNode::PostExecutionNode { .. } => "post_execution_node",
2702
+ PrismNode::PreExecutionNode { .. } => "pre_execution_node",
2703
+ PrismNode::ProgramNode { .. } => "program_node",
2704
+ PrismNode::RangeNode { .. } => "range_node",
2705
+ PrismNode::RationalNode { .. } => "rational_node",
2706
+ PrismNode::RedoNode { .. } => "redo_node",
2707
+ PrismNode::RegularExpressionNode { .. } => "regular_expression_node",
2708
+ PrismNode::RequiredKeywordParameterNode { .. } => "required_keyword_parameter_node",
2709
+ PrismNode::RequiredParameterNode { .. } => "required_parameter_node",
2710
+ PrismNode::RescueModifierNode { .. } => "rescue_modifier_node",
2711
+ PrismNode::RescueNode { .. } => "rescue_node",
2712
+ PrismNode::RestParameterNode { .. } => "rest_parameter_node",
2713
+ PrismNode::RetryNode { .. } => "retry_node",
2714
+ PrismNode::ReturnNode { .. } => "return_node",
2715
+ PrismNode::SelfNode { .. } => "self_node",
2716
+ PrismNode::ShareableConstantNode { .. } => "shareable_constant_node",
2717
+ PrismNode::SingletonClassNode { .. } => "singleton_class_node",
2718
+ PrismNode::SourceEncodingNode { .. } => "source_encoding_node",
2719
+ PrismNode::SourceFileNode { .. } => "source_file_node",
2720
+ PrismNode::SourceLineNode { .. } => "source_line_node",
2721
+ PrismNode::SplatNode { .. } => "splat_node",
2722
+ PrismNode::StatementsNode { .. } => "statements_node",
2723
+ PrismNode::StringNode { .. } => "string_node",
2724
+ PrismNode::SuperNode { .. } => "super_node",
2725
+ PrismNode::SymbolNode { .. } => "symbol_node",
2726
+ PrismNode::TrueNode { .. } => "true_node",
2727
+ PrismNode::UndefNode { .. } => "undef_node",
2728
+ PrismNode::UnlessNode { .. } => "unless_node",
2729
+ PrismNode::UntilNode { .. } => "until_node",
2730
+ PrismNode::WhenNode { .. } => "when_node",
2731
+ PrismNode::WhileNode { .. } => "while_node",
2732
+ PrismNode::XStringNode { .. } => "x_string_node",
2733
+ PrismNode::YieldNode { .. } => "yield_node",
2734
+ }
2735
+ }