yarp 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,683 @@
1
+ # frozen_string_literal: true
2
+ =begin
3
+ This file is generated by the templates/template.rb script and should not be
4
+ modified manually. See templates/lib/yarp/mutation_visitor.rb.erb
5
+ if you are looking to modify the template
6
+ =end
7
+
8
+ module YARP
9
+ # This visitor walks through the tree and copies each node as it is being
10
+ # visited. This is useful for consumers that want to mutate the tree, as you
11
+ # can change subtrees in place without effecting the rest of the tree.
12
+ class MutationVisitor < BasicVisitor
13
+ # Copy a AliasNode node
14
+ def visit_alias_node(node)
15
+ node.copy(new_name: visit(node.new_name), old_name: visit(node.old_name))
16
+ end
17
+
18
+ # Copy a AlternationPatternNode node
19
+ def visit_alternation_pattern_node(node)
20
+ node.copy(left: visit(node.left), right: visit(node.right))
21
+ end
22
+
23
+ # Copy a AndNode node
24
+ def visit_and_node(node)
25
+ node.copy(left: visit(node.left), right: visit(node.right))
26
+ end
27
+
28
+ # Copy a ArgumentsNode node
29
+ def visit_arguments_node(node)
30
+ node.copy(arguments: visit_all(node.arguments))
31
+ end
32
+
33
+ # Copy a ArrayNode node
34
+ def visit_array_node(node)
35
+ node.copy(elements: visit_all(node.elements))
36
+ end
37
+
38
+ # Copy a ArrayPatternNode node
39
+ def visit_array_pattern_node(node)
40
+ node.copy(constant: visit(node.constant), requireds: visit_all(node.requireds), rest: visit(node.rest), posts: visit_all(node.posts))
41
+ end
42
+
43
+ # Copy a AssocNode node
44
+ def visit_assoc_node(node)
45
+ node.copy(key: visit(node.key), value: visit(node.value))
46
+ end
47
+
48
+ # Copy a AssocSplatNode node
49
+ def visit_assoc_splat_node(node)
50
+ node.copy(value: visit(node.value))
51
+ end
52
+
53
+ # Copy a BackReferenceReadNode node
54
+ def visit_back_reference_read_node(node)
55
+ node.copy
56
+ end
57
+
58
+ # Copy a BeginNode node
59
+ def visit_begin_node(node)
60
+ node.copy(statements: visit(node.statements), rescue_clause: visit(node.rescue_clause), else_clause: visit(node.else_clause), ensure_clause: visit(node.ensure_clause))
61
+ end
62
+
63
+ # Copy a BlockArgumentNode node
64
+ def visit_block_argument_node(node)
65
+ node.copy(expression: visit(node.expression))
66
+ end
67
+
68
+ # Copy a BlockNode node
69
+ def visit_block_node(node)
70
+ node.copy(parameters: visit(node.parameters), body: visit(node.body))
71
+ end
72
+
73
+ # Copy a BlockParameterNode node
74
+ def visit_block_parameter_node(node)
75
+ node.copy
76
+ end
77
+
78
+ # Copy a BlockParametersNode node
79
+ def visit_block_parameters_node(node)
80
+ node.copy(parameters: visit(node.parameters))
81
+ end
82
+
83
+ # Copy a BreakNode node
84
+ def visit_break_node(node)
85
+ node.copy(arguments: visit(node.arguments))
86
+ end
87
+
88
+ # Copy a CallNode node
89
+ def visit_call_node(node)
90
+ node.copy(receiver: visit(node.receiver), arguments: visit(node.arguments), block: visit(node.block))
91
+ end
92
+
93
+ # Copy a CallOperatorAndWriteNode node
94
+ def visit_call_operator_and_write_node(node)
95
+ node.copy(target: visit(node.target), value: visit(node.value))
96
+ end
97
+
98
+ # Copy a CallOperatorOrWriteNode node
99
+ def visit_call_operator_or_write_node(node)
100
+ node.copy(target: visit(node.target), value: visit(node.value))
101
+ end
102
+
103
+ # Copy a CallOperatorWriteNode node
104
+ def visit_call_operator_write_node(node)
105
+ node.copy(target: visit(node.target), value: visit(node.value))
106
+ end
107
+
108
+ # Copy a CapturePatternNode node
109
+ def visit_capture_pattern_node(node)
110
+ node.copy(value: visit(node.value), target: visit(node.target))
111
+ end
112
+
113
+ # Copy a CaseNode node
114
+ def visit_case_node(node)
115
+ node.copy(predicate: visit(node.predicate), conditions: visit_all(node.conditions), consequent: visit(node.consequent))
116
+ end
117
+
118
+ # Copy a ClassNode node
119
+ def visit_class_node(node)
120
+ node.copy(constant_path: visit(node.constant_path), superclass: visit(node.superclass), body: visit(node.body))
121
+ end
122
+
123
+ # Copy a ClassVariableAndWriteNode node
124
+ def visit_class_variable_and_write_node(node)
125
+ node.copy(value: visit(node.value))
126
+ end
127
+
128
+ # Copy a ClassVariableOperatorWriteNode node
129
+ def visit_class_variable_operator_write_node(node)
130
+ node.copy(value: visit(node.value))
131
+ end
132
+
133
+ # Copy a ClassVariableOrWriteNode node
134
+ def visit_class_variable_or_write_node(node)
135
+ node.copy(value: visit(node.value))
136
+ end
137
+
138
+ # Copy a ClassVariableReadNode node
139
+ def visit_class_variable_read_node(node)
140
+ node.copy
141
+ end
142
+
143
+ # Copy a ClassVariableTargetNode node
144
+ def visit_class_variable_target_node(node)
145
+ node.copy
146
+ end
147
+
148
+ # Copy a ClassVariableWriteNode node
149
+ def visit_class_variable_write_node(node)
150
+ node.copy(value: visit(node.value))
151
+ end
152
+
153
+ # Copy a ConstantAndWriteNode node
154
+ def visit_constant_and_write_node(node)
155
+ node.copy(value: visit(node.value))
156
+ end
157
+
158
+ # Copy a ConstantOperatorWriteNode node
159
+ def visit_constant_operator_write_node(node)
160
+ node.copy(value: visit(node.value))
161
+ end
162
+
163
+ # Copy a ConstantOrWriteNode node
164
+ def visit_constant_or_write_node(node)
165
+ node.copy(value: visit(node.value))
166
+ end
167
+
168
+ # Copy a ConstantPathAndWriteNode node
169
+ def visit_constant_path_and_write_node(node)
170
+ node.copy(target: visit(node.target), value: visit(node.value))
171
+ end
172
+
173
+ # Copy a ConstantPathNode node
174
+ def visit_constant_path_node(node)
175
+ node.copy(parent: visit(node.parent), child: visit(node.child))
176
+ end
177
+
178
+ # Copy a ConstantPathOperatorWriteNode node
179
+ def visit_constant_path_operator_write_node(node)
180
+ node.copy(target: visit(node.target), value: visit(node.value))
181
+ end
182
+
183
+ # Copy a ConstantPathOrWriteNode node
184
+ def visit_constant_path_or_write_node(node)
185
+ node.copy(target: visit(node.target), value: visit(node.value))
186
+ end
187
+
188
+ # Copy a ConstantPathTargetNode node
189
+ def visit_constant_path_target_node(node)
190
+ node.copy(parent: visit(node.parent), child: visit(node.child))
191
+ end
192
+
193
+ # Copy a ConstantPathWriteNode node
194
+ def visit_constant_path_write_node(node)
195
+ node.copy(target: visit(node.target), value: visit(node.value))
196
+ end
197
+
198
+ # Copy a ConstantReadNode node
199
+ def visit_constant_read_node(node)
200
+ node.copy
201
+ end
202
+
203
+ # Copy a ConstantTargetNode node
204
+ def visit_constant_target_node(node)
205
+ node.copy
206
+ end
207
+
208
+ # Copy a ConstantWriteNode node
209
+ def visit_constant_write_node(node)
210
+ node.copy(value: visit(node.value))
211
+ end
212
+
213
+ # Copy a DefNode node
214
+ def visit_def_node(node)
215
+ node.copy(receiver: visit(node.receiver), parameters: visit(node.parameters), body: visit(node.body))
216
+ end
217
+
218
+ # Copy a DefinedNode node
219
+ def visit_defined_node(node)
220
+ node.copy(value: visit(node.value))
221
+ end
222
+
223
+ # Copy a ElseNode node
224
+ def visit_else_node(node)
225
+ node.copy(statements: visit(node.statements))
226
+ end
227
+
228
+ # Copy a EmbeddedStatementsNode node
229
+ def visit_embedded_statements_node(node)
230
+ node.copy(statements: visit(node.statements))
231
+ end
232
+
233
+ # Copy a EmbeddedVariableNode node
234
+ def visit_embedded_variable_node(node)
235
+ node.copy(variable: visit(node.variable))
236
+ end
237
+
238
+ # Copy a EnsureNode node
239
+ def visit_ensure_node(node)
240
+ node.copy(statements: visit(node.statements))
241
+ end
242
+
243
+ # Copy a FalseNode node
244
+ def visit_false_node(node)
245
+ node.copy
246
+ end
247
+
248
+ # Copy a FindPatternNode node
249
+ def visit_find_pattern_node(node)
250
+ node.copy(constant: visit(node.constant), left: visit(node.left), requireds: visit_all(node.requireds), right: visit(node.right))
251
+ end
252
+
253
+ # Copy a FlipFlopNode node
254
+ def visit_flip_flop_node(node)
255
+ node.copy(left: visit(node.left), right: visit(node.right))
256
+ end
257
+
258
+ # Copy a FloatNode node
259
+ def visit_float_node(node)
260
+ node.copy
261
+ end
262
+
263
+ # Copy a ForNode node
264
+ def visit_for_node(node)
265
+ node.copy(index: visit(node.index), collection: visit(node.collection), statements: visit(node.statements))
266
+ end
267
+
268
+ # Copy a ForwardingArgumentsNode node
269
+ def visit_forwarding_arguments_node(node)
270
+ node.copy
271
+ end
272
+
273
+ # Copy a ForwardingParameterNode node
274
+ def visit_forwarding_parameter_node(node)
275
+ node.copy
276
+ end
277
+
278
+ # Copy a ForwardingSuperNode node
279
+ def visit_forwarding_super_node(node)
280
+ node.copy(block: visit(node.block))
281
+ end
282
+
283
+ # Copy a GlobalVariableAndWriteNode node
284
+ def visit_global_variable_and_write_node(node)
285
+ node.copy(value: visit(node.value))
286
+ end
287
+
288
+ # Copy a GlobalVariableOperatorWriteNode node
289
+ def visit_global_variable_operator_write_node(node)
290
+ node.copy(value: visit(node.value))
291
+ end
292
+
293
+ # Copy a GlobalVariableOrWriteNode node
294
+ def visit_global_variable_or_write_node(node)
295
+ node.copy(value: visit(node.value))
296
+ end
297
+
298
+ # Copy a GlobalVariableReadNode node
299
+ def visit_global_variable_read_node(node)
300
+ node.copy
301
+ end
302
+
303
+ # Copy a GlobalVariableTargetNode node
304
+ def visit_global_variable_target_node(node)
305
+ node.copy
306
+ end
307
+
308
+ # Copy a GlobalVariableWriteNode node
309
+ def visit_global_variable_write_node(node)
310
+ node.copy(value: visit(node.value))
311
+ end
312
+
313
+ # Copy a HashNode node
314
+ def visit_hash_node(node)
315
+ node.copy(elements: visit_all(node.elements))
316
+ end
317
+
318
+ # Copy a HashPatternNode node
319
+ def visit_hash_pattern_node(node)
320
+ node.copy(constant: visit(node.constant), assocs: visit_all(node.assocs), kwrest: visit(node.kwrest))
321
+ end
322
+
323
+ # Copy a IfNode node
324
+ def visit_if_node(node)
325
+ node.copy(predicate: visit(node.predicate), statements: visit(node.statements), consequent: visit(node.consequent))
326
+ end
327
+
328
+ # Copy a ImaginaryNode node
329
+ def visit_imaginary_node(node)
330
+ node.copy(numeric: visit(node.numeric))
331
+ end
332
+
333
+ # Copy a InNode node
334
+ def visit_in_node(node)
335
+ node.copy(pattern: visit(node.pattern), statements: visit(node.statements))
336
+ end
337
+
338
+ # Copy a InstanceVariableAndWriteNode node
339
+ def visit_instance_variable_and_write_node(node)
340
+ node.copy(value: visit(node.value))
341
+ end
342
+
343
+ # Copy a InstanceVariableOperatorWriteNode node
344
+ def visit_instance_variable_operator_write_node(node)
345
+ node.copy(value: visit(node.value))
346
+ end
347
+
348
+ # Copy a InstanceVariableOrWriteNode node
349
+ def visit_instance_variable_or_write_node(node)
350
+ node.copy(value: visit(node.value))
351
+ end
352
+
353
+ # Copy a InstanceVariableReadNode node
354
+ def visit_instance_variable_read_node(node)
355
+ node.copy
356
+ end
357
+
358
+ # Copy a InstanceVariableTargetNode node
359
+ def visit_instance_variable_target_node(node)
360
+ node.copy
361
+ end
362
+
363
+ # Copy a InstanceVariableWriteNode node
364
+ def visit_instance_variable_write_node(node)
365
+ node.copy(value: visit(node.value))
366
+ end
367
+
368
+ # Copy a IntegerNode node
369
+ def visit_integer_node(node)
370
+ node.copy
371
+ end
372
+
373
+ # Copy a InterpolatedRegularExpressionNode node
374
+ def visit_interpolated_regular_expression_node(node)
375
+ node.copy(parts: visit_all(node.parts))
376
+ end
377
+
378
+ # Copy a InterpolatedStringNode node
379
+ def visit_interpolated_string_node(node)
380
+ node.copy(parts: visit_all(node.parts))
381
+ end
382
+
383
+ # Copy a InterpolatedSymbolNode node
384
+ def visit_interpolated_symbol_node(node)
385
+ node.copy(parts: visit_all(node.parts))
386
+ end
387
+
388
+ # Copy a InterpolatedXStringNode node
389
+ def visit_interpolated_x_string_node(node)
390
+ node.copy(parts: visit_all(node.parts))
391
+ end
392
+
393
+ # Copy a KeywordHashNode node
394
+ def visit_keyword_hash_node(node)
395
+ node.copy(elements: visit_all(node.elements))
396
+ end
397
+
398
+ # Copy a KeywordParameterNode node
399
+ def visit_keyword_parameter_node(node)
400
+ node.copy(value: visit(node.value))
401
+ end
402
+
403
+ # Copy a KeywordRestParameterNode node
404
+ def visit_keyword_rest_parameter_node(node)
405
+ node.copy
406
+ end
407
+
408
+ # Copy a LambdaNode node
409
+ def visit_lambda_node(node)
410
+ node.copy(parameters: visit(node.parameters), body: visit(node.body))
411
+ end
412
+
413
+ # Copy a LocalVariableAndWriteNode node
414
+ def visit_local_variable_and_write_node(node)
415
+ node.copy(value: visit(node.value))
416
+ end
417
+
418
+ # Copy a LocalVariableOperatorWriteNode node
419
+ def visit_local_variable_operator_write_node(node)
420
+ node.copy(value: visit(node.value))
421
+ end
422
+
423
+ # Copy a LocalVariableOrWriteNode node
424
+ def visit_local_variable_or_write_node(node)
425
+ node.copy(value: visit(node.value))
426
+ end
427
+
428
+ # Copy a LocalVariableReadNode node
429
+ def visit_local_variable_read_node(node)
430
+ node.copy
431
+ end
432
+
433
+ # Copy a LocalVariableTargetNode node
434
+ def visit_local_variable_target_node(node)
435
+ node.copy
436
+ end
437
+
438
+ # Copy a LocalVariableWriteNode node
439
+ def visit_local_variable_write_node(node)
440
+ node.copy(value: visit(node.value))
441
+ end
442
+
443
+ # Copy a MatchPredicateNode node
444
+ def visit_match_predicate_node(node)
445
+ node.copy(value: visit(node.value), pattern: visit(node.pattern))
446
+ end
447
+
448
+ # Copy a MatchRequiredNode node
449
+ def visit_match_required_node(node)
450
+ node.copy(value: visit(node.value), pattern: visit(node.pattern))
451
+ end
452
+
453
+ # Copy a MissingNode node
454
+ def visit_missing_node(node)
455
+ node.copy
456
+ end
457
+
458
+ # Copy a ModuleNode node
459
+ def visit_module_node(node)
460
+ node.copy(constant_path: visit(node.constant_path), body: visit(node.body))
461
+ end
462
+
463
+ # Copy a MultiWriteNode node
464
+ def visit_multi_write_node(node)
465
+ node.copy(targets: visit_all(node.targets), value: visit(node.value))
466
+ end
467
+
468
+ # Copy a NextNode node
469
+ def visit_next_node(node)
470
+ node.copy(arguments: visit(node.arguments))
471
+ end
472
+
473
+ # Copy a NilNode node
474
+ def visit_nil_node(node)
475
+ node.copy
476
+ end
477
+
478
+ # Copy a NoKeywordsParameterNode node
479
+ def visit_no_keywords_parameter_node(node)
480
+ node.copy
481
+ end
482
+
483
+ # Copy a NumberedReferenceReadNode node
484
+ def visit_numbered_reference_read_node(node)
485
+ node.copy
486
+ end
487
+
488
+ # Copy a OptionalParameterNode node
489
+ def visit_optional_parameter_node(node)
490
+ node.copy(value: visit(node.value))
491
+ end
492
+
493
+ # Copy a OrNode node
494
+ def visit_or_node(node)
495
+ node.copy(left: visit(node.left), right: visit(node.right))
496
+ end
497
+
498
+ # Copy a ParametersNode node
499
+ def visit_parameters_node(node)
500
+ node.copy(requireds: visit_all(node.requireds), optionals: visit_all(node.optionals), posts: visit_all(node.posts), rest: visit(node.rest), keywords: visit_all(node.keywords), keyword_rest: visit(node.keyword_rest), block: visit(node.block))
501
+ end
502
+
503
+ # Copy a ParenthesesNode node
504
+ def visit_parentheses_node(node)
505
+ node.copy(body: visit(node.body))
506
+ end
507
+
508
+ # Copy a PinnedExpressionNode node
509
+ def visit_pinned_expression_node(node)
510
+ node.copy(expression: visit(node.expression))
511
+ end
512
+
513
+ # Copy a PinnedVariableNode node
514
+ def visit_pinned_variable_node(node)
515
+ node.copy(variable: visit(node.variable))
516
+ end
517
+
518
+ # Copy a PostExecutionNode node
519
+ def visit_post_execution_node(node)
520
+ node.copy(statements: visit(node.statements))
521
+ end
522
+
523
+ # Copy a PreExecutionNode node
524
+ def visit_pre_execution_node(node)
525
+ node.copy(statements: visit(node.statements))
526
+ end
527
+
528
+ # Copy a ProgramNode node
529
+ def visit_program_node(node)
530
+ node.copy(statements: visit(node.statements))
531
+ end
532
+
533
+ # Copy a RangeNode node
534
+ def visit_range_node(node)
535
+ node.copy(left: visit(node.left), right: visit(node.right))
536
+ end
537
+
538
+ # Copy a RationalNode node
539
+ def visit_rational_node(node)
540
+ node.copy(numeric: visit(node.numeric))
541
+ end
542
+
543
+ # Copy a RedoNode node
544
+ def visit_redo_node(node)
545
+ node.copy
546
+ end
547
+
548
+ # Copy a RegularExpressionNode node
549
+ def visit_regular_expression_node(node)
550
+ node.copy
551
+ end
552
+
553
+ # Copy a RequiredDestructuredParameterNode node
554
+ def visit_required_destructured_parameter_node(node)
555
+ node.copy(parameters: visit_all(node.parameters))
556
+ end
557
+
558
+ # Copy a RequiredParameterNode node
559
+ def visit_required_parameter_node(node)
560
+ node.copy
561
+ end
562
+
563
+ # Copy a RescueModifierNode node
564
+ def visit_rescue_modifier_node(node)
565
+ node.copy(expression: visit(node.expression), rescue_expression: visit(node.rescue_expression))
566
+ end
567
+
568
+ # Copy a RescueNode node
569
+ def visit_rescue_node(node)
570
+ node.copy(exceptions: visit_all(node.exceptions), reference: visit(node.reference), statements: visit(node.statements), consequent: visit(node.consequent))
571
+ end
572
+
573
+ # Copy a RestParameterNode node
574
+ def visit_rest_parameter_node(node)
575
+ node.copy
576
+ end
577
+
578
+ # Copy a RetryNode node
579
+ def visit_retry_node(node)
580
+ node.copy
581
+ end
582
+
583
+ # Copy a ReturnNode node
584
+ def visit_return_node(node)
585
+ node.copy(arguments: visit(node.arguments))
586
+ end
587
+
588
+ # Copy a SelfNode node
589
+ def visit_self_node(node)
590
+ node.copy
591
+ end
592
+
593
+ # Copy a SingletonClassNode node
594
+ def visit_singleton_class_node(node)
595
+ node.copy(expression: visit(node.expression), body: visit(node.body))
596
+ end
597
+
598
+ # Copy a SourceEncodingNode node
599
+ def visit_source_encoding_node(node)
600
+ node.copy
601
+ end
602
+
603
+ # Copy a SourceFileNode node
604
+ def visit_source_file_node(node)
605
+ node.copy
606
+ end
607
+
608
+ # Copy a SourceLineNode node
609
+ def visit_source_line_node(node)
610
+ node.copy
611
+ end
612
+
613
+ # Copy a SplatNode node
614
+ def visit_splat_node(node)
615
+ node.copy(expression: visit(node.expression))
616
+ end
617
+
618
+ # Copy a StatementsNode node
619
+ def visit_statements_node(node)
620
+ node.copy(body: visit_all(node.body))
621
+ end
622
+
623
+ # Copy a StringConcatNode node
624
+ def visit_string_concat_node(node)
625
+ node.copy(left: visit(node.left), right: visit(node.right))
626
+ end
627
+
628
+ # Copy a StringNode node
629
+ def visit_string_node(node)
630
+ node.copy
631
+ end
632
+
633
+ # Copy a SuperNode node
634
+ def visit_super_node(node)
635
+ node.copy(arguments: visit(node.arguments), block: visit(node.block))
636
+ end
637
+
638
+ # Copy a SymbolNode node
639
+ def visit_symbol_node(node)
640
+ node.copy
641
+ end
642
+
643
+ # Copy a TrueNode node
644
+ def visit_true_node(node)
645
+ node.copy
646
+ end
647
+
648
+ # Copy a UndefNode node
649
+ def visit_undef_node(node)
650
+ node.copy(names: visit_all(node.names))
651
+ end
652
+
653
+ # Copy a UnlessNode node
654
+ def visit_unless_node(node)
655
+ node.copy(predicate: visit(node.predicate), statements: visit(node.statements), consequent: visit(node.consequent))
656
+ end
657
+
658
+ # Copy a UntilNode node
659
+ def visit_until_node(node)
660
+ node.copy(predicate: visit(node.predicate), statements: visit(node.statements))
661
+ end
662
+
663
+ # Copy a WhenNode node
664
+ def visit_when_node(node)
665
+ node.copy(conditions: visit_all(node.conditions), statements: visit(node.statements))
666
+ end
667
+
668
+ # Copy a WhileNode node
669
+ def visit_while_node(node)
670
+ node.copy(predicate: visit(node.predicate), statements: visit(node.statements))
671
+ end
672
+
673
+ # Copy a XStringNode node
674
+ def visit_x_string_node(node)
675
+ node.copy
676
+ end
677
+
678
+ # Copy a YieldNode node
679
+ def visit_yield_node(node)
680
+ node.copy(arguments: visit(node.arguments))
681
+ end
682
+ end
683
+ end