yarp 0.7.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +54 -2
- data/Makefile +2 -0
- data/README.md +9 -5
- data/config.yml +160 -93
- data/docs/configuration.md +1 -0
- data/docs/ruby_api.md +2 -0
- data/docs/serialization.md +1 -1
- data/docs/testing.md +2 -2
- data/ext/yarp/api_node.c +361 -238
- data/ext/yarp/extension.c +75 -26
- data/ext/yarp/extension.h +2 -2
- data/include/yarp/ast.h +226 -175
- data/include/yarp/defines.h +5 -0
- data/include/yarp/node.h +10 -0
- data/include/yarp/unescape.h +4 -2
- data/include/yarp/util/yp_buffer.h +9 -1
- data/include/yarp/util/yp_constant_pool.h +3 -0
- data/include/yarp/util/yp_list.h +7 -7
- data/include/yarp/util/yp_newline_list.h +7 -0
- data/include/yarp/util/yp_state_stack.h +1 -1
- data/include/yarp/version.h +2 -2
- data/include/yarp.h +10 -0
- data/lib/yarp/desugar_visitor.rb +267 -0
- data/lib/yarp/ffi.rb +89 -48
- data/lib/yarp/lex_compat.rb +93 -25
- data/lib/yarp/mutation_visitor.rb +683 -0
- data/lib/yarp/node.rb +2061 -422
- data/lib/yarp/serialize.rb +162 -120
- data/lib/yarp.rb +54 -8
- data/src/node.c +360 -304
- data/src/prettyprint.c +190 -152
- data/src/serialize.c +382 -340
- data/src/token_type.c +2 -2
- data/src/unescape.c +89 -77
- data/src/util/yp_buffer.c +18 -0
- data/src/util/yp_list.c +7 -16
- data/src/util/yp_newline_list.c +10 -0
- data/src/util/yp_state_stack.c +0 -6
- data/src/yarp.c +941 -596
- data/yarp.gemspec +3 -1
- metadata +4 -2
data/lib/yarp/node.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
=begin
|
3
|
-
This file is generated by the
|
3
|
+
This file is generated by the templates/template.rb script and should not be
|
4
4
|
modified manually. See templates/lib/yarp/node.rb.erb
|
5
5
|
if you are looking to modify the template
|
6
6
|
=end
|
@@ -38,6 +38,16 @@ module YARP
|
|
38
38
|
[new_name, old_name]
|
39
39
|
end
|
40
40
|
|
41
|
+
# def copy: (**params) -> AliasNode
|
42
|
+
def copy(**params)
|
43
|
+
AliasNode.new(
|
44
|
+
params.fetch(:new_name) { new_name },
|
45
|
+
params.fetch(:old_name) { old_name },
|
46
|
+
params.fetch(:keyword_loc) { keyword_loc },
|
47
|
+
params.fetch(:location) { location },
|
48
|
+
)
|
49
|
+
end
|
50
|
+
|
41
51
|
# def deconstruct: () -> Array[nil | Node]
|
42
52
|
alias deconstruct child_nodes
|
43
53
|
|
@@ -84,6 +94,16 @@ module YARP
|
|
84
94
|
[left, right]
|
85
95
|
end
|
86
96
|
|
97
|
+
# def copy: (**params) -> AlternationPatternNode
|
98
|
+
def copy(**params)
|
99
|
+
AlternationPatternNode.new(
|
100
|
+
params.fetch(:left) { left },
|
101
|
+
params.fetch(:right) { right },
|
102
|
+
params.fetch(:operator_loc) { operator_loc },
|
103
|
+
params.fetch(:location) { location },
|
104
|
+
)
|
105
|
+
end
|
106
|
+
|
87
107
|
# def deconstruct: () -> Array[nil | Node]
|
88
108
|
alias deconstruct child_nodes
|
89
109
|
|
@@ -130,6 +150,16 @@ module YARP
|
|
130
150
|
[left, right]
|
131
151
|
end
|
132
152
|
|
153
|
+
# def copy: (**params) -> AndNode
|
154
|
+
def copy(**params)
|
155
|
+
AndNode.new(
|
156
|
+
params.fetch(:left) { left },
|
157
|
+
params.fetch(:right) { right },
|
158
|
+
params.fetch(:operator_loc) { operator_loc },
|
159
|
+
params.fetch(:location) { location },
|
160
|
+
)
|
161
|
+
end
|
162
|
+
|
133
163
|
# def deconstruct: () -> Array[nil | Node]
|
134
164
|
alias deconstruct child_nodes
|
135
165
|
|
@@ -168,6 +198,14 @@ module YARP
|
|
168
198
|
[*arguments]
|
169
199
|
end
|
170
200
|
|
201
|
+
# def copy: (**params) -> ArgumentsNode
|
202
|
+
def copy(**params)
|
203
|
+
ArgumentsNode.new(
|
204
|
+
params.fetch(:arguments) { arguments },
|
205
|
+
params.fetch(:location) { location },
|
206
|
+
)
|
207
|
+
end
|
208
|
+
|
171
209
|
# def deconstruct: () -> Array[nil | Node]
|
172
210
|
alias deconstruct child_nodes
|
173
211
|
|
@@ -210,6 +248,16 @@ module YARP
|
|
210
248
|
[*elements]
|
211
249
|
end
|
212
250
|
|
251
|
+
# def copy: (**params) -> ArrayNode
|
252
|
+
def copy(**params)
|
253
|
+
ArrayNode.new(
|
254
|
+
params.fetch(:elements) { elements },
|
255
|
+
params.fetch(:opening_loc) { opening_loc },
|
256
|
+
params.fetch(:closing_loc) { closing_loc },
|
257
|
+
params.fetch(:location) { location },
|
258
|
+
)
|
259
|
+
end
|
260
|
+
|
213
261
|
# def deconstruct: () -> Array[nil | Node]
|
214
262
|
alias deconstruct child_nodes
|
215
263
|
|
@@ -285,6 +333,19 @@ module YARP
|
|
285
333
|
[constant, *requireds, rest, *posts]
|
286
334
|
end
|
287
335
|
|
336
|
+
# def copy: (**params) -> ArrayPatternNode
|
337
|
+
def copy(**params)
|
338
|
+
ArrayPatternNode.new(
|
339
|
+
params.fetch(:constant) { constant },
|
340
|
+
params.fetch(:requireds) { requireds },
|
341
|
+
params.fetch(:rest) { rest },
|
342
|
+
params.fetch(:posts) { posts },
|
343
|
+
params.fetch(:opening_loc) { opening_loc },
|
344
|
+
params.fetch(:closing_loc) { closing_loc },
|
345
|
+
params.fetch(:location) { location },
|
346
|
+
)
|
347
|
+
end
|
348
|
+
|
288
349
|
# def deconstruct: () -> Array[nil | Node]
|
289
350
|
alias deconstruct child_nodes
|
290
351
|
|
@@ -336,6 +397,16 @@ module YARP
|
|
336
397
|
[key, value]
|
337
398
|
end
|
338
399
|
|
400
|
+
# def copy: (**params) -> AssocNode
|
401
|
+
def copy(**params)
|
402
|
+
AssocNode.new(
|
403
|
+
params.fetch(:key) { key },
|
404
|
+
params.fetch(:value) { value },
|
405
|
+
params.fetch(:operator_loc) { operator_loc },
|
406
|
+
params.fetch(:location) { location },
|
407
|
+
)
|
408
|
+
end
|
409
|
+
|
339
410
|
# def deconstruct: () -> Array[nil | Node]
|
340
411
|
alias deconstruct child_nodes
|
341
412
|
|
@@ -378,6 +449,15 @@ module YARP
|
|
378
449
|
[value]
|
379
450
|
end
|
380
451
|
|
452
|
+
# def copy: (**params) -> AssocSplatNode
|
453
|
+
def copy(**params)
|
454
|
+
AssocSplatNode.new(
|
455
|
+
params.fetch(:value) { value },
|
456
|
+
params.fetch(:operator_loc) { operator_loc },
|
457
|
+
params.fetch(:location) { location },
|
458
|
+
)
|
459
|
+
end
|
460
|
+
|
381
461
|
# def deconstruct: () -> Array[nil | Node]
|
382
462
|
alias deconstruct child_nodes
|
383
463
|
|
@@ -412,6 +492,13 @@ module YARP
|
|
412
492
|
[]
|
413
493
|
end
|
414
494
|
|
495
|
+
# def copy: (**params) -> BackReferenceReadNode
|
496
|
+
def copy(**params)
|
497
|
+
BackReferenceReadNode.new(
|
498
|
+
params.fetch(:location) { location },
|
499
|
+
)
|
500
|
+
end
|
501
|
+
|
415
502
|
# def deconstruct: () -> Array[nil | Node]
|
416
503
|
alias deconstruct child_nodes
|
417
504
|
|
@@ -431,22 +518,22 @@ module YARP
|
|
431
518
|
# attr_reader begin_keyword_loc: Location?
|
432
519
|
attr_reader :begin_keyword_loc
|
433
520
|
|
434
|
-
# attr_reader statements:
|
521
|
+
# attr_reader statements: StatementsNode?
|
435
522
|
attr_reader :statements
|
436
523
|
|
437
|
-
# attr_reader rescue_clause:
|
524
|
+
# attr_reader rescue_clause: RescueNode?
|
438
525
|
attr_reader :rescue_clause
|
439
526
|
|
440
|
-
# attr_reader else_clause:
|
527
|
+
# attr_reader else_clause: ElseNode?
|
441
528
|
attr_reader :else_clause
|
442
529
|
|
443
|
-
# attr_reader ensure_clause:
|
530
|
+
# attr_reader ensure_clause: EnsureNode?
|
444
531
|
attr_reader :ensure_clause
|
445
532
|
|
446
533
|
# attr_reader end_keyword_loc: Location?
|
447
534
|
attr_reader :end_keyword_loc
|
448
535
|
|
449
|
-
# def initialize: (begin_keyword_loc: Location?, statements:
|
536
|
+
# def initialize: (begin_keyword_loc: Location?, statements: StatementsNode?, rescue_clause: RescueNode?, else_clause: ElseNode?, ensure_clause: EnsureNode?, end_keyword_loc: Location?, location: Location) -> void
|
450
537
|
def initialize(begin_keyword_loc, statements, rescue_clause, else_clause, ensure_clause, end_keyword_loc, location)
|
451
538
|
@begin_keyword_loc = begin_keyword_loc
|
452
539
|
@statements = statements
|
@@ -471,6 +558,19 @@ module YARP
|
|
471
558
|
[statements, rescue_clause, else_clause, ensure_clause]
|
472
559
|
end
|
473
560
|
|
561
|
+
# def copy: (**params) -> BeginNode
|
562
|
+
def copy(**params)
|
563
|
+
BeginNode.new(
|
564
|
+
params.fetch(:begin_keyword_loc) { begin_keyword_loc },
|
565
|
+
params.fetch(:statements) { statements },
|
566
|
+
params.fetch(:rescue_clause) { rescue_clause },
|
567
|
+
params.fetch(:else_clause) { else_clause },
|
568
|
+
params.fetch(:ensure_clause) { ensure_clause },
|
569
|
+
params.fetch(:end_keyword_loc) { end_keyword_loc },
|
570
|
+
params.fetch(:location) { location },
|
571
|
+
)
|
572
|
+
end
|
573
|
+
|
474
574
|
# def deconstruct: () -> Array[nil | Node]
|
475
575
|
alias deconstruct child_nodes
|
476
576
|
|
@@ -518,6 +618,15 @@ module YARP
|
|
518
618
|
[expression]
|
519
619
|
end
|
520
620
|
|
621
|
+
# def copy: (**params) -> BlockArgumentNode
|
622
|
+
def copy(**params)
|
623
|
+
BlockArgumentNode.new(
|
624
|
+
params.fetch(:expression) { expression },
|
625
|
+
params.fetch(:operator_loc) { operator_loc },
|
626
|
+
params.fetch(:location) { location },
|
627
|
+
)
|
628
|
+
end
|
629
|
+
|
521
630
|
# def deconstruct: () -> Array[nil | Node]
|
522
631
|
alias deconstruct child_nodes
|
523
632
|
|
@@ -540,11 +649,11 @@ module YARP
|
|
540
649
|
# attr_reader locals: Array[Symbol]
|
541
650
|
attr_reader :locals
|
542
651
|
|
543
|
-
# attr_reader parameters:
|
652
|
+
# attr_reader parameters: BlockParametersNode?
|
544
653
|
attr_reader :parameters
|
545
654
|
|
546
|
-
# attr_reader
|
547
|
-
attr_reader :
|
655
|
+
# attr_reader body: Node?
|
656
|
+
attr_reader :body
|
548
657
|
|
549
658
|
# attr_reader opening_loc: Location
|
550
659
|
attr_reader :opening_loc
|
@@ -552,11 +661,11 @@ module YARP
|
|
552
661
|
# attr_reader closing_loc: Location
|
553
662
|
attr_reader :closing_loc
|
554
663
|
|
555
|
-
# def initialize: (locals: Array[Symbol], parameters:
|
556
|
-
def initialize(locals, parameters,
|
664
|
+
# def initialize: (locals: Array[Symbol], parameters: BlockParametersNode?, body: Node?, opening_loc: Location, closing_loc: Location, location: Location) -> void
|
665
|
+
def initialize(locals, parameters, body, opening_loc, closing_loc, location)
|
557
666
|
@locals = locals
|
558
667
|
@parameters = parameters
|
559
|
-
@
|
668
|
+
@body = body
|
560
669
|
@opening_loc = opening_loc
|
561
670
|
@closing_loc = closing_loc
|
562
671
|
@location = location
|
@@ -569,7 +678,19 @@ module YARP
|
|
569
678
|
|
570
679
|
# def child_nodes: () -> Array[nil | Node]
|
571
680
|
def child_nodes
|
572
|
-
[parameters,
|
681
|
+
[parameters, body]
|
682
|
+
end
|
683
|
+
|
684
|
+
# def copy: (**params) -> BlockNode
|
685
|
+
def copy(**params)
|
686
|
+
BlockNode.new(
|
687
|
+
params.fetch(:locals) { locals },
|
688
|
+
params.fetch(:parameters) { parameters },
|
689
|
+
params.fetch(:body) { body },
|
690
|
+
params.fetch(:opening_loc) { opening_loc },
|
691
|
+
params.fetch(:closing_loc) { closing_loc },
|
692
|
+
params.fetch(:location) { location },
|
693
|
+
)
|
573
694
|
end
|
574
695
|
|
575
696
|
# def deconstruct: () -> Array[nil | Node]
|
@@ -577,7 +698,7 @@ module YARP
|
|
577
698
|
|
578
699
|
# def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
|
579
700
|
def deconstruct_keys(keys)
|
580
|
-
{ locals: locals, parameters: parameters,
|
701
|
+
{ locals: locals, parameters: parameters, body: body, opening_loc: opening_loc, closing_loc: closing_loc, location: location }
|
581
702
|
end
|
582
703
|
|
583
704
|
# def opening: () -> String
|
@@ -620,6 +741,15 @@ module YARP
|
|
620
741
|
[]
|
621
742
|
end
|
622
743
|
|
744
|
+
# def copy: (**params) -> BlockParameterNode
|
745
|
+
def copy(**params)
|
746
|
+
BlockParameterNode.new(
|
747
|
+
params.fetch(:name_loc) { name_loc },
|
748
|
+
params.fetch(:operator_loc) { operator_loc },
|
749
|
+
params.fetch(:location) { location },
|
750
|
+
)
|
751
|
+
end
|
752
|
+
|
623
753
|
# def deconstruct: () -> Array[nil | Node]
|
624
754
|
alias deconstruct child_nodes
|
625
755
|
|
@@ -648,7 +778,7 @@ module YARP
|
|
648
778
|
# ^^^^^^^^^^^^^^^^^
|
649
779
|
# end
|
650
780
|
class BlockParametersNode < Node
|
651
|
-
# attr_reader parameters:
|
781
|
+
# attr_reader parameters: ParametersNode?
|
652
782
|
attr_reader :parameters
|
653
783
|
|
654
784
|
# attr_reader locals: Array[Location]
|
@@ -660,7 +790,7 @@ module YARP
|
|
660
790
|
# attr_reader closing_loc: Location?
|
661
791
|
attr_reader :closing_loc
|
662
792
|
|
663
|
-
# def initialize: (parameters:
|
793
|
+
# def initialize: (parameters: ParametersNode?, locals: Array[Location], opening_loc: Location?, closing_loc: Location?, location: Location) -> void
|
664
794
|
def initialize(parameters, locals, opening_loc, closing_loc, location)
|
665
795
|
@parameters = parameters
|
666
796
|
@locals = locals
|
@@ -679,6 +809,17 @@ module YARP
|
|
679
809
|
[parameters]
|
680
810
|
end
|
681
811
|
|
812
|
+
# def copy: (**params) -> BlockParametersNode
|
813
|
+
def copy(**params)
|
814
|
+
BlockParametersNode.new(
|
815
|
+
params.fetch(:parameters) { parameters },
|
816
|
+
params.fetch(:locals) { locals },
|
817
|
+
params.fetch(:opening_loc) { opening_loc },
|
818
|
+
params.fetch(:closing_loc) { closing_loc },
|
819
|
+
params.fetch(:location) { location },
|
820
|
+
)
|
821
|
+
end
|
822
|
+
|
682
823
|
# def deconstruct: () -> Array[nil | Node]
|
683
824
|
alias deconstruct child_nodes
|
684
825
|
|
@@ -703,13 +844,13 @@ module YARP
|
|
703
844
|
# break foo
|
704
845
|
# ^^^^^^^^^
|
705
846
|
class BreakNode < Node
|
706
|
-
# attr_reader arguments:
|
847
|
+
# attr_reader arguments: ArgumentsNode?
|
707
848
|
attr_reader :arguments
|
708
849
|
|
709
850
|
# attr_reader keyword_loc: Location
|
710
851
|
attr_reader :keyword_loc
|
711
852
|
|
712
|
-
# def initialize: (arguments:
|
853
|
+
# def initialize: (arguments: ArgumentsNode?, keyword_loc: Location, location: Location) -> void
|
713
854
|
def initialize(arguments, keyword_loc, location)
|
714
855
|
@arguments = arguments
|
715
856
|
@keyword_loc = keyword_loc
|
@@ -726,6 +867,15 @@ module YARP
|
|
726
867
|
[arguments]
|
727
868
|
end
|
728
869
|
|
870
|
+
# def copy: (**params) -> BreakNode
|
871
|
+
def copy(**params)
|
872
|
+
BreakNode.new(
|
873
|
+
params.fetch(:arguments) { arguments },
|
874
|
+
params.fetch(:keyword_loc) { keyword_loc },
|
875
|
+
params.fetch(:location) { location },
|
876
|
+
)
|
877
|
+
end
|
878
|
+
|
729
879
|
# def deconstruct: () -> Array[nil | Node]
|
730
880
|
alias deconstruct child_nodes
|
731
881
|
|
@@ -772,13 +922,13 @@ module YARP
|
|
772
922
|
# attr_reader opening_loc: Location?
|
773
923
|
attr_reader :opening_loc
|
774
924
|
|
775
|
-
# attr_reader arguments:
|
925
|
+
# attr_reader arguments: ArgumentsNode?
|
776
926
|
attr_reader :arguments
|
777
927
|
|
778
928
|
# attr_reader closing_loc: Location?
|
779
929
|
attr_reader :closing_loc
|
780
930
|
|
781
|
-
# attr_reader block:
|
931
|
+
# attr_reader block: BlockNode?
|
782
932
|
attr_reader :block
|
783
933
|
|
784
934
|
# attr_reader flags: Integer
|
@@ -787,7 +937,7 @@ module YARP
|
|
787
937
|
# attr_reader name: String
|
788
938
|
attr_reader :name
|
789
939
|
|
790
|
-
# def initialize: (receiver: Node?, operator_loc: Location?, message_loc: Location?, opening_loc: Location?, arguments:
|
940
|
+
# def initialize: (receiver: Node?, operator_loc: Location?, message_loc: Location?, opening_loc: Location?, arguments: ArgumentsNode?, closing_loc: Location?, block: BlockNode?, flags: Integer, name: String, location: Location) -> void
|
791
941
|
def initialize(receiver, operator_loc, message_loc, opening_loc, arguments, closing_loc, block, flags, name, location)
|
792
942
|
@receiver = receiver
|
793
943
|
@operator_loc = operator_loc
|
@@ -811,6 +961,22 @@ module YARP
|
|
811
961
|
[receiver, arguments, block]
|
812
962
|
end
|
813
963
|
|
964
|
+
# def copy: (**params) -> CallNode
|
965
|
+
def copy(**params)
|
966
|
+
CallNode.new(
|
967
|
+
params.fetch(:receiver) { receiver },
|
968
|
+
params.fetch(:operator_loc) { operator_loc },
|
969
|
+
params.fetch(:message_loc) { message_loc },
|
970
|
+
params.fetch(:opening_loc) { opening_loc },
|
971
|
+
params.fetch(:arguments) { arguments },
|
972
|
+
params.fetch(:closing_loc) { closing_loc },
|
973
|
+
params.fetch(:block) { block },
|
974
|
+
params.fetch(:flags) { flags },
|
975
|
+
params.fetch(:name) { name },
|
976
|
+
params.fetch(:location) { location },
|
977
|
+
)
|
978
|
+
end
|
979
|
+
|
814
980
|
# def deconstruct: () -> Array[nil | Node]
|
815
981
|
alias deconstruct child_nodes
|
816
982
|
|
@@ -855,7 +1021,7 @@ module YARP
|
|
855
1021
|
# foo.bar &&= value
|
856
1022
|
# ^^^^^^^^^^^^^^^^^
|
857
1023
|
class CallOperatorAndWriteNode < Node
|
858
|
-
# attr_reader target:
|
1024
|
+
# attr_reader target: CallNode
|
859
1025
|
attr_reader :target
|
860
1026
|
|
861
1027
|
# attr_reader operator_loc: Location
|
@@ -864,7 +1030,7 @@ module YARP
|
|
864
1030
|
# attr_reader value: Node
|
865
1031
|
attr_reader :value
|
866
1032
|
|
867
|
-
# def initialize: (target:
|
1033
|
+
# def initialize: (target: CallNode, operator_loc: Location, value: Node, location: Location) -> void
|
868
1034
|
def initialize(target, operator_loc, value, location)
|
869
1035
|
@target = target
|
870
1036
|
@operator_loc = operator_loc
|
@@ -882,6 +1048,16 @@ module YARP
|
|
882
1048
|
[target, value]
|
883
1049
|
end
|
884
1050
|
|
1051
|
+
# def copy: (**params) -> CallOperatorAndWriteNode
|
1052
|
+
def copy(**params)
|
1053
|
+
CallOperatorAndWriteNode.new(
|
1054
|
+
params.fetch(:target) { target },
|
1055
|
+
params.fetch(:operator_loc) { operator_loc },
|
1056
|
+
params.fetch(:value) { value },
|
1057
|
+
params.fetch(:location) { location },
|
1058
|
+
)
|
1059
|
+
end
|
1060
|
+
|
885
1061
|
# def deconstruct: () -> Array[nil | Node]
|
886
1062
|
alias deconstruct child_nodes
|
887
1063
|
|
@@ -901,7 +1077,7 @@ module YARP
|
|
901
1077
|
# foo.bar ||= value
|
902
1078
|
# ^^^^^^^^^^^^^^^^^
|
903
1079
|
class CallOperatorOrWriteNode < Node
|
904
|
-
# attr_reader target:
|
1080
|
+
# attr_reader target: CallNode
|
905
1081
|
attr_reader :target
|
906
1082
|
|
907
1083
|
# attr_reader value: Node
|
@@ -910,7 +1086,7 @@ module YARP
|
|
910
1086
|
# attr_reader operator_loc: Location
|
911
1087
|
attr_reader :operator_loc
|
912
1088
|
|
913
|
-
# def initialize: (target:
|
1089
|
+
# def initialize: (target: CallNode, value: Node, operator_loc: Location, location: Location) -> void
|
914
1090
|
def initialize(target, value, operator_loc, location)
|
915
1091
|
@target = target
|
916
1092
|
@value = value
|
@@ -928,6 +1104,16 @@ module YARP
|
|
928
1104
|
[target, value]
|
929
1105
|
end
|
930
1106
|
|
1107
|
+
# def copy: (**params) -> CallOperatorOrWriteNode
|
1108
|
+
def copy(**params)
|
1109
|
+
CallOperatorOrWriteNode.new(
|
1110
|
+
params.fetch(:target) { target },
|
1111
|
+
params.fetch(:value) { value },
|
1112
|
+
params.fetch(:operator_loc) { operator_loc },
|
1113
|
+
params.fetch(:location) { location },
|
1114
|
+
)
|
1115
|
+
end
|
1116
|
+
|
931
1117
|
# def deconstruct: () -> Array[nil | Node]
|
932
1118
|
alias deconstruct child_nodes
|
933
1119
|
|
@@ -947,7 +1133,7 @@ module YARP
|
|
947
1133
|
# foo.bar += baz
|
948
1134
|
# ^^^^^^^^^^^^^^
|
949
1135
|
class CallOperatorWriteNode < Node
|
950
|
-
# attr_reader target:
|
1136
|
+
# attr_reader target: CallNode
|
951
1137
|
attr_reader :target
|
952
1138
|
|
953
1139
|
# attr_reader operator_loc: Location
|
@@ -959,7 +1145,7 @@ module YARP
|
|
959
1145
|
# attr_reader operator_id: Symbol
|
960
1146
|
attr_reader :operator_id
|
961
1147
|
|
962
|
-
# def initialize: (target:
|
1148
|
+
# def initialize: (target: CallNode, operator_loc: Location, value: Node, operator_id: Symbol, location: Location) -> void
|
963
1149
|
def initialize(target, operator_loc, value, operator_id, location)
|
964
1150
|
@target = target
|
965
1151
|
@operator_loc = operator_loc
|
@@ -978,6 +1164,17 @@ module YARP
|
|
978
1164
|
[target, value]
|
979
1165
|
end
|
980
1166
|
|
1167
|
+
# def copy: (**params) -> CallOperatorWriteNode
|
1168
|
+
def copy(**params)
|
1169
|
+
CallOperatorWriteNode.new(
|
1170
|
+
params.fetch(:target) { target },
|
1171
|
+
params.fetch(:operator_loc) { operator_loc },
|
1172
|
+
params.fetch(:value) { value },
|
1173
|
+
params.fetch(:operator_id) { operator_id },
|
1174
|
+
params.fetch(:location) { location },
|
1175
|
+
)
|
1176
|
+
end
|
1177
|
+
|
981
1178
|
# def deconstruct: () -> Array[nil | Node]
|
982
1179
|
alias deconstruct child_nodes
|
983
1180
|
|
@@ -1024,6 +1221,16 @@ module YARP
|
|
1024
1221
|
[value, target]
|
1025
1222
|
end
|
1026
1223
|
|
1224
|
+
# def copy: (**params) -> CapturePatternNode
|
1225
|
+
def copy(**params)
|
1226
|
+
CapturePatternNode.new(
|
1227
|
+
params.fetch(:value) { value },
|
1228
|
+
params.fetch(:target) { target },
|
1229
|
+
params.fetch(:operator_loc) { operator_loc },
|
1230
|
+
params.fetch(:location) { location },
|
1231
|
+
)
|
1232
|
+
end
|
1233
|
+
|
1027
1234
|
# def deconstruct: () -> Array[nil | Node]
|
1028
1235
|
alias deconstruct child_nodes
|
1029
1236
|
|
@@ -1051,7 +1258,7 @@ module YARP
|
|
1051
1258
|
# attr_reader conditions: Array[Node]
|
1052
1259
|
attr_reader :conditions
|
1053
1260
|
|
1054
|
-
# attr_reader consequent:
|
1261
|
+
# attr_reader consequent: ElseNode?
|
1055
1262
|
attr_reader :consequent
|
1056
1263
|
|
1057
1264
|
# attr_reader case_keyword_loc: Location
|
@@ -1060,7 +1267,7 @@ module YARP
|
|
1060
1267
|
# attr_reader end_keyword_loc: Location
|
1061
1268
|
attr_reader :end_keyword_loc
|
1062
1269
|
|
1063
|
-
# def initialize: (predicate: Node?, conditions: Array[Node], consequent:
|
1270
|
+
# def initialize: (predicate: Node?, conditions: Array[Node], consequent: ElseNode?, case_keyword_loc: Location, end_keyword_loc: Location, location: Location) -> void
|
1064
1271
|
def initialize(predicate, conditions, consequent, case_keyword_loc, end_keyword_loc, location)
|
1065
1272
|
@predicate = predicate
|
1066
1273
|
@conditions = conditions
|
@@ -1080,6 +1287,18 @@ module YARP
|
|
1080
1287
|
[predicate, *conditions, consequent]
|
1081
1288
|
end
|
1082
1289
|
|
1290
|
+
# def copy: (**params) -> CaseNode
|
1291
|
+
def copy(**params)
|
1292
|
+
CaseNode.new(
|
1293
|
+
params.fetch(:predicate) { predicate },
|
1294
|
+
params.fetch(:conditions) { conditions },
|
1295
|
+
params.fetch(:consequent) { consequent },
|
1296
|
+
params.fetch(:case_keyword_loc) { case_keyword_loc },
|
1297
|
+
params.fetch(:end_keyword_loc) { end_keyword_loc },
|
1298
|
+
params.fetch(:location) { location },
|
1299
|
+
)
|
1300
|
+
end
|
1301
|
+
|
1083
1302
|
# def deconstruct: () -> Array[nil | Node]
|
1084
1303
|
alias deconstruct child_nodes
|
1085
1304
|
|
@@ -1119,21 +1338,25 @@ module YARP
|
|
1119
1338
|
# attr_reader superclass: Node?
|
1120
1339
|
attr_reader :superclass
|
1121
1340
|
|
1122
|
-
# attr_reader
|
1123
|
-
attr_reader :
|
1341
|
+
# attr_reader body: Node?
|
1342
|
+
attr_reader :body
|
1124
1343
|
|
1125
1344
|
# attr_reader end_keyword_loc: Location
|
1126
1345
|
attr_reader :end_keyword_loc
|
1127
1346
|
|
1128
|
-
#
|
1129
|
-
|
1347
|
+
# attr_reader name: String
|
1348
|
+
attr_reader :name
|
1349
|
+
|
1350
|
+
# def initialize: (locals: Array[Symbol], class_keyword_loc: Location, constant_path: Node, inheritance_operator_loc: Location?, superclass: Node?, body: Node?, end_keyword_loc: Location, name: String, location: Location) -> void
|
1351
|
+
def initialize(locals, class_keyword_loc, constant_path, inheritance_operator_loc, superclass, body, end_keyword_loc, name, location)
|
1130
1352
|
@locals = locals
|
1131
1353
|
@class_keyword_loc = class_keyword_loc
|
1132
1354
|
@constant_path = constant_path
|
1133
1355
|
@inheritance_operator_loc = inheritance_operator_loc
|
1134
1356
|
@superclass = superclass
|
1135
|
-
@
|
1357
|
+
@body = body
|
1136
1358
|
@end_keyword_loc = end_keyword_loc
|
1359
|
+
@name = name
|
1137
1360
|
@location = location
|
1138
1361
|
end
|
1139
1362
|
|
@@ -1144,7 +1367,22 @@ module YARP
|
|
1144
1367
|
|
1145
1368
|
# def child_nodes: () -> Array[nil | Node]
|
1146
1369
|
def child_nodes
|
1147
|
-
[constant_path, superclass,
|
1370
|
+
[constant_path, superclass, body]
|
1371
|
+
end
|
1372
|
+
|
1373
|
+
# def copy: (**params) -> ClassNode
|
1374
|
+
def copy(**params)
|
1375
|
+
ClassNode.new(
|
1376
|
+
params.fetch(:locals) { locals },
|
1377
|
+
params.fetch(:class_keyword_loc) { class_keyword_loc },
|
1378
|
+
params.fetch(:constant_path) { constant_path },
|
1379
|
+
params.fetch(:inheritance_operator_loc) { inheritance_operator_loc },
|
1380
|
+
params.fetch(:superclass) { superclass },
|
1381
|
+
params.fetch(:body) { body },
|
1382
|
+
params.fetch(:end_keyword_loc) { end_keyword_loc },
|
1383
|
+
params.fetch(:name) { name },
|
1384
|
+
params.fetch(:location) { location },
|
1385
|
+
)
|
1148
1386
|
end
|
1149
1387
|
|
1150
1388
|
# def deconstruct: () -> Array[nil | Node]
|
@@ -1152,7 +1390,7 @@ module YARP
|
|
1152
1390
|
|
1153
1391
|
# def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
|
1154
1392
|
def deconstruct_keys(keys)
|
1155
|
-
{ locals: locals, class_keyword_loc: class_keyword_loc, constant_path: constant_path, inheritance_operator_loc: inheritance_operator_loc, superclass: superclass,
|
1393
|
+
{ locals: locals, class_keyword_loc: class_keyword_loc, constant_path: constant_path, inheritance_operator_loc: inheritance_operator_loc, superclass: superclass, body: body, end_keyword_loc: end_keyword_loc, name: name, location: location }
|
1156
1394
|
end
|
1157
1395
|
|
1158
1396
|
# def class_keyword: () -> String
|
@@ -1175,7 +1413,7 @@ module YARP
|
|
1175
1413
|
#
|
1176
1414
|
# @@target &&= value
|
1177
1415
|
# ^^^^^^^^^^^^^^^^
|
1178
|
-
class
|
1416
|
+
class ClassVariableAndWriteNode < Node
|
1179
1417
|
# attr_reader name_loc: Location
|
1180
1418
|
attr_reader :name_loc
|
1181
1419
|
|
@@ -1195,7 +1433,7 @@ module YARP
|
|
1195
1433
|
|
1196
1434
|
# def accept: (visitor: Visitor) -> void
|
1197
1435
|
def accept(visitor)
|
1198
|
-
visitor.
|
1436
|
+
visitor.visit_class_variable_and_write_node(self)
|
1199
1437
|
end
|
1200
1438
|
|
1201
1439
|
# def child_nodes: () -> Array[nil | Node]
|
@@ -1203,6 +1441,16 @@ module YARP
|
|
1203
1441
|
[value]
|
1204
1442
|
end
|
1205
1443
|
|
1444
|
+
# def copy: (**params) -> ClassVariableAndWriteNode
|
1445
|
+
def copy(**params)
|
1446
|
+
ClassVariableAndWriteNode.new(
|
1447
|
+
params.fetch(:name_loc) { name_loc },
|
1448
|
+
params.fetch(:operator_loc) { operator_loc },
|
1449
|
+
params.fetch(:value) { value },
|
1450
|
+
params.fetch(:location) { location },
|
1451
|
+
)
|
1452
|
+
end
|
1453
|
+
|
1206
1454
|
# def deconstruct: () -> Array[nil | Node]
|
1207
1455
|
alias deconstruct child_nodes
|
1208
1456
|
|
@@ -1222,11 +1470,11 @@ module YARP
|
|
1222
1470
|
end
|
1223
1471
|
end
|
1224
1472
|
|
1225
|
-
# Represents
|
1473
|
+
# Represents assigning to a class variable using an operator that isn't `=`.
|
1226
1474
|
#
|
1227
|
-
# @@target
|
1228
|
-
#
|
1229
|
-
class
|
1475
|
+
# @@target += value
|
1476
|
+
# ^^^^^^^^^^^^^^^^^
|
1477
|
+
class ClassVariableOperatorWriteNode < Node
|
1230
1478
|
# attr_reader name_loc: Location
|
1231
1479
|
attr_reader :name_loc
|
1232
1480
|
|
@@ -1236,17 +1484,21 @@ module YARP
|
|
1236
1484
|
# attr_reader value: Node
|
1237
1485
|
attr_reader :value
|
1238
1486
|
|
1239
|
-
#
|
1240
|
-
|
1487
|
+
# attr_reader operator: Symbol
|
1488
|
+
attr_reader :operator
|
1489
|
+
|
1490
|
+
# def initialize: (name_loc: Location, operator_loc: Location, value: Node, operator: Symbol, location: Location) -> void
|
1491
|
+
def initialize(name_loc, operator_loc, value, operator, location)
|
1241
1492
|
@name_loc = name_loc
|
1242
1493
|
@operator_loc = operator_loc
|
1243
1494
|
@value = value
|
1495
|
+
@operator = operator
|
1244
1496
|
@location = location
|
1245
1497
|
end
|
1246
1498
|
|
1247
1499
|
# def accept: (visitor: Visitor) -> void
|
1248
1500
|
def accept(visitor)
|
1249
|
-
visitor.
|
1501
|
+
visitor.visit_class_variable_operator_write_node(self)
|
1250
1502
|
end
|
1251
1503
|
|
1252
1504
|
# def child_nodes: () -> Array[nil | Node]
|
@@ -1254,30 +1506,36 @@ module YARP
|
|
1254
1506
|
[value]
|
1255
1507
|
end
|
1256
1508
|
|
1509
|
+
# def copy: (**params) -> ClassVariableOperatorWriteNode
|
1510
|
+
def copy(**params)
|
1511
|
+
ClassVariableOperatorWriteNode.new(
|
1512
|
+
params.fetch(:name_loc) { name_loc },
|
1513
|
+
params.fetch(:operator_loc) { operator_loc },
|
1514
|
+
params.fetch(:value) { value },
|
1515
|
+
params.fetch(:operator) { operator },
|
1516
|
+
params.fetch(:location) { location },
|
1517
|
+
)
|
1518
|
+
end
|
1519
|
+
|
1257
1520
|
# def deconstruct: () -> Array[nil | Node]
|
1258
1521
|
alias deconstruct child_nodes
|
1259
1522
|
|
1260
1523
|
# def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
|
1261
1524
|
def deconstruct_keys(keys)
|
1262
|
-
{ name_loc: name_loc, operator_loc: operator_loc, value: value, location: location }
|
1525
|
+
{ name_loc: name_loc, operator_loc: operator_loc, value: value, operator: operator, location: location }
|
1263
1526
|
end
|
1264
1527
|
|
1265
1528
|
# def name: () -> String
|
1266
1529
|
def name
|
1267
1530
|
name_loc.slice
|
1268
1531
|
end
|
1269
|
-
|
1270
|
-
# def operator: () -> String
|
1271
|
-
def operator
|
1272
|
-
operator_loc.slice
|
1273
|
-
end
|
1274
1532
|
end
|
1275
1533
|
|
1276
|
-
# Represents
|
1534
|
+
# Represents the use of the `||=` operator for assignment to a class variable.
|
1277
1535
|
#
|
1278
|
-
# @@target
|
1279
|
-
#
|
1280
|
-
class
|
1536
|
+
# @@target ||= value
|
1537
|
+
# ^^^^^^^^^^^^^^^^^^
|
1538
|
+
class ClassVariableOrWriteNode < Node
|
1281
1539
|
# attr_reader name_loc: Location
|
1282
1540
|
attr_reader :name_loc
|
1283
1541
|
|
@@ -1287,21 +1545,17 @@ module YARP
|
|
1287
1545
|
# attr_reader value: Node
|
1288
1546
|
attr_reader :value
|
1289
1547
|
|
1290
|
-
#
|
1291
|
-
|
1292
|
-
|
1293
|
-
# def initialize: (name_loc: Location, operator_loc: Location, value: Node, operator: Symbol, location: Location) -> void
|
1294
|
-
def initialize(name_loc, operator_loc, value, operator, location)
|
1548
|
+
# def initialize: (name_loc: Location, operator_loc: Location, value: Node, location: Location) -> void
|
1549
|
+
def initialize(name_loc, operator_loc, value, location)
|
1295
1550
|
@name_loc = name_loc
|
1296
1551
|
@operator_loc = operator_loc
|
1297
1552
|
@value = value
|
1298
|
-
@operator = operator
|
1299
1553
|
@location = location
|
1300
1554
|
end
|
1301
1555
|
|
1302
1556
|
# def accept: (visitor: Visitor) -> void
|
1303
1557
|
def accept(visitor)
|
1304
|
-
visitor.
|
1558
|
+
visitor.visit_class_variable_or_write_node(self)
|
1305
1559
|
end
|
1306
1560
|
|
1307
1561
|
# def child_nodes: () -> Array[nil | Node]
|
@@ -1309,18 +1563,33 @@ module YARP
|
|
1309
1563
|
[value]
|
1310
1564
|
end
|
1311
1565
|
|
1566
|
+
# def copy: (**params) -> ClassVariableOrWriteNode
|
1567
|
+
def copy(**params)
|
1568
|
+
ClassVariableOrWriteNode.new(
|
1569
|
+
params.fetch(:name_loc) { name_loc },
|
1570
|
+
params.fetch(:operator_loc) { operator_loc },
|
1571
|
+
params.fetch(:value) { value },
|
1572
|
+
params.fetch(:location) { location },
|
1573
|
+
)
|
1574
|
+
end
|
1575
|
+
|
1312
1576
|
# def deconstruct: () -> Array[nil | Node]
|
1313
1577
|
alias deconstruct child_nodes
|
1314
1578
|
|
1315
1579
|
# def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
|
1316
1580
|
def deconstruct_keys(keys)
|
1317
|
-
{ name_loc: name_loc, operator_loc: operator_loc, value: value,
|
1581
|
+
{ name_loc: name_loc, operator_loc: operator_loc, value: value, location: location }
|
1318
1582
|
end
|
1319
1583
|
|
1320
1584
|
# def name: () -> String
|
1321
1585
|
def name
|
1322
1586
|
name_loc.slice
|
1323
1587
|
end
|
1588
|
+
|
1589
|
+
# def operator: () -> String
|
1590
|
+
def operator
|
1591
|
+
operator_loc.slice
|
1592
|
+
end
|
1324
1593
|
end
|
1325
1594
|
|
1326
1595
|
# Represents referencing a class variable.
|
@@ -1343,6 +1612,49 @@ module YARP
|
|
1343
1612
|
[]
|
1344
1613
|
end
|
1345
1614
|
|
1615
|
+
# def copy: (**params) -> ClassVariableReadNode
|
1616
|
+
def copy(**params)
|
1617
|
+
ClassVariableReadNode.new(
|
1618
|
+
params.fetch(:location) { location },
|
1619
|
+
)
|
1620
|
+
end
|
1621
|
+
|
1622
|
+
# def deconstruct: () -> Array[nil | Node]
|
1623
|
+
alias deconstruct child_nodes
|
1624
|
+
|
1625
|
+
# def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
|
1626
|
+
def deconstruct_keys(keys)
|
1627
|
+
{ location: location }
|
1628
|
+
end
|
1629
|
+
end
|
1630
|
+
|
1631
|
+
# Represents writing to a class variable in a context that doesn't have an explicit value.
|
1632
|
+
#
|
1633
|
+
# @@foo, @@bar = baz
|
1634
|
+
# ^^^^^ ^^^^^
|
1635
|
+
class ClassVariableTargetNode < Node
|
1636
|
+
# def initialize: (location: Location) -> void
|
1637
|
+
def initialize(location)
|
1638
|
+
@location = location
|
1639
|
+
end
|
1640
|
+
|
1641
|
+
# def accept: (visitor: Visitor) -> void
|
1642
|
+
def accept(visitor)
|
1643
|
+
visitor.visit_class_variable_target_node(self)
|
1644
|
+
end
|
1645
|
+
|
1646
|
+
# def child_nodes: () -> Array[nil | Node]
|
1647
|
+
def child_nodes
|
1648
|
+
[]
|
1649
|
+
end
|
1650
|
+
|
1651
|
+
# def copy: (**params) -> ClassVariableTargetNode
|
1652
|
+
def copy(**params)
|
1653
|
+
ClassVariableTargetNode.new(
|
1654
|
+
params.fetch(:location) { location },
|
1655
|
+
)
|
1656
|
+
end
|
1657
|
+
|
1346
1658
|
# def deconstruct: () -> Array[nil | Node]
|
1347
1659
|
alias deconstruct child_nodes
|
1348
1660
|
|
@@ -1384,6 +1696,16 @@ module YARP
|
|
1384
1696
|
[value]
|
1385
1697
|
end
|
1386
1698
|
|
1699
|
+
# def copy: (**params) -> ClassVariableWriteNode
|
1700
|
+
def copy(**params)
|
1701
|
+
ClassVariableWriteNode.new(
|
1702
|
+
params.fetch(:name_loc) { name_loc },
|
1703
|
+
params.fetch(:value) { value },
|
1704
|
+
params.fetch(:operator_loc) { operator_loc },
|
1705
|
+
params.fetch(:location) { location },
|
1706
|
+
)
|
1707
|
+
end
|
1708
|
+
|
1387
1709
|
# def deconstruct: () -> Array[nil | Node]
|
1388
1710
|
alias deconstruct child_nodes
|
1389
1711
|
|
@@ -1407,7 +1729,7 @@ module YARP
|
|
1407
1729
|
#
|
1408
1730
|
# Target &&= value
|
1409
1731
|
# ^^^^^^^^^^^^^^^^
|
1410
|
-
class
|
1732
|
+
class ConstantAndWriteNode < Node
|
1411
1733
|
# attr_reader name_loc: Location
|
1412
1734
|
attr_reader :name_loc
|
1413
1735
|
|
@@ -1427,7 +1749,7 @@ module YARP
|
|
1427
1749
|
|
1428
1750
|
# def accept: (visitor: Visitor) -> void
|
1429
1751
|
def accept(visitor)
|
1430
|
-
visitor.
|
1752
|
+
visitor.visit_constant_and_write_node(self)
|
1431
1753
|
end
|
1432
1754
|
|
1433
1755
|
# def child_nodes: () -> Array[nil | Node]
|
@@ -1435,6 +1757,16 @@ module YARP
|
|
1435
1757
|
[value]
|
1436
1758
|
end
|
1437
1759
|
|
1760
|
+
# def copy: (**params) -> ConstantAndWriteNode
|
1761
|
+
def copy(**params)
|
1762
|
+
ConstantAndWriteNode.new(
|
1763
|
+
params.fetch(:name_loc) { name_loc },
|
1764
|
+
params.fetch(:operator_loc) { operator_loc },
|
1765
|
+
params.fetch(:value) { value },
|
1766
|
+
params.fetch(:location) { location },
|
1767
|
+
)
|
1768
|
+
end
|
1769
|
+
|
1438
1770
|
# def deconstruct: () -> Array[nil | Node]
|
1439
1771
|
alias deconstruct child_nodes
|
1440
1772
|
|
@@ -1454,11 +1786,72 @@ module YARP
|
|
1454
1786
|
end
|
1455
1787
|
end
|
1456
1788
|
|
1789
|
+
# Represents assigning to a constant using an operator that isn't `=`.
|
1790
|
+
#
|
1791
|
+
# Target += value
|
1792
|
+
# ^^^^^^^^^^^^^^^
|
1793
|
+
class ConstantOperatorWriteNode < Node
|
1794
|
+
# attr_reader name_loc: Location
|
1795
|
+
attr_reader :name_loc
|
1796
|
+
|
1797
|
+
# attr_reader operator_loc: Location
|
1798
|
+
attr_reader :operator_loc
|
1799
|
+
|
1800
|
+
# attr_reader value: Node
|
1801
|
+
attr_reader :value
|
1802
|
+
|
1803
|
+
# attr_reader operator: Symbol
|
1804
|
+
attr_reader :operator
|
1805
|
+
|
1806
|
+
# def initialize: (name_loc: Location, operator_loc: Location, value: Node, operator: Symbol, location: Location) -> void
|
1807
|
+
def initialize(name_loc, operator_loc, value, operator, location)
|
1808
|
+
@name_loc = name_loc
|
1809
|
+
@operator_loc = operator_loc
|
1810
|
+
@value = value
|
1811
|
+
@operator = operator
|
1812
|
+
@location = location
|
1813
|
+
end
|
1814
|
+
|
1815
|
+
# def accept: (visitor: Visitor) -> void
|
1816
|
+
def accept(visitor)
|
1817
|
+
visitor.visit_constant_operator_write_node(self)
|
1818
|
+
end
|
1819
|
+
|
1820
|
+
# def child_nodes: () -> Array[nil | Node]
|
1821
|
+
def child_nodes
|
1822
|
+
[value]
|
1823
|
+
end
|
1824
|
+
|
1825
|
+
# def copy: (**params) -> ConstantOperatorWriteNode
|
1826
|
+
def copy(**params)
|
1827
|
+
ConstantOperatorWriteNode.new(
|
1828
|
+
params.fetch(:name_loc) { name_loc },
|
1829
|
+
params.fetch(:operator_loc) { operator_loc },
|
1830
|
+
params.fetch(:value) { value },
|
1831
|
+
params.fetch(:operator) { operator },
|
1832
|
+
params.fetch(:location) { location },
|
1833
|
+
)
|
1834
|
+
end
|
1835
|
+
|
1836
|
+
# def deconstruct: () -> Array[nil | Node]
|
1837
|
+
alias deconstruct child_nodes
|
1838
|
+
|
1839
|
+
# def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
|
1840
|
+
def deconstruct_keys(keys)
|
1841
|
+
{ name_loc: name_loc, operator_loc: operator_loc, value: value, operator: operator, location: location }
|
1842
|
+
end
|
1843
|
+
|
1844
|
+
# def name: () -> String
|
1845
|
+
def name
|
1846
|
+
name_loc.slice
|
1847
|
+
end
|
1848
|
+
end
|
1849
|
+
|
1457
1850
|
# Represents the use of the `||=` operator for assignment to a constant.
|
1458
1851
|
#
|
1459
1852
|
# Target ||= value
|
1460
1853
|
# ^^^^^^^^^^^^^^^^
|
1461
|
-
class
|
1854
|
+
class ConstantOrWriteNode < Node
|
1462
1855
|
# attr_reader name_loc: Location
|
1463
1856
|
attr_reader :name_loc
|
1464
1857
|
|
@@ -1478,7 +1871,7 @@ module YARP
|
|
1478
1871
|
|
1479
1872
|
# def accept: (visitor: Visitor) -> void
|
1480
1873
|
def accept(visitor)
|
1481
|
-
visitor.
|
1874
|
+
visitor.visit_constant_or_write_node(self)
|
1482
1875
|
end
|
1483
1876
|
|
1484
1877
|
# def child_nodes: () -> Array[nil | Node]
|
@@ -1486,6 +1879,16 @@ module YARP
|
|
1486
1879
|
[value]
|
1487
1880
|
end
|
1488
1881
|
|
1882
|
+
# def copy: (**params) -> ConstantOrWriteNode
|
1883
|
+
def copy(**params)
|
1884
|
+
ConstantOrWriteNode.new(
|
1885
|
+
params.fetch(:name_loc) { name_loc },
|
1886
|
+
params.fetch(:operator_loc) { operator_loc },
|
1887
|
+
params.fetch(:value) { value },
|
1888
|
+
params.fetch(:location) { location },
|
1889
|
+
)
|
1890
|
+
end
|
1891
|
+
|
1489
1892
|
# def deconstruct: () -> Array[nil | Node]
|
1490
1893
|
alias deconstruct child_nodes
|
1491
1894
|
|
@@ -1505,13 +1908,13 @@ module YARP
|
|
1505
1908
|
end
|
1506
1909
|
end
|
1507
1910
|
|
1508
|
-
# Represents
|
1911
|
+
# Represents the use of the `&&=` operator for assignment to a constant path.
|
1509
1912
|
#
|
1510
|
-
#
|
1511
|
-
#
|
1512
|
-
class
|
1513
|
-
# attr_reader
|
1514
|
-
attr_reader :
|
1913
|
+
# Parent::Child &&= value
|
1914
|
+
# ^^^^^^^^^^^^^^^^^^^^^^^
|
1915
|
+
class ConstantPathAndWriteNode < Node
|
1916
|
+
# attr_reader target: ConstantPathNode
|
1917
|
+
attr_reader :target
|
1515
1918
|
|
1516
1919
|
# attr_reader operator_loc: Location
|
1517
1920
|
attr_reader :operator_loc
|
@@ -1519,26 +1922,32 @@ module YARP
|
|
1519
1922
|
# attr_reader value: Node
|
1520
1923
|
attr_reader :value
|
1521
1924
|
|
1522
|
-
#
|
1523
|
-
|
1524
|
-
|
1525
|
-
# def initialize: (name_loc: Location, operator_loc: Location, value: Node, operator: Symbol, location: Location) -> void
|
1526
|
-
def initialize(name_loc, operator_loc, value, operator, location)
|
1527
|
-
@name_loc = name_loc
|
1925
|
+
# def initialize: (target: ConstantPathNode, operator_loc: Location, value: Node, location: Location) -> void
|
1926
|
+
def initialize(target, operator_loc, value, location)
|
1927
|
+
@target = target
|
1528
1928
|
@operator_loc = operator_loc
|
1529
1929
|
@value = value
|
1530
|
-
@operator = operator
|
1531
1930
|
@location = location
|
1532
1931
|
end
|
1533
1932
|
|
1534
1933
|
# def accept: (visitor: Visitor) -> void
|
1535
1934
|
def accept(visitor)
|
1536
|
-
visitor.
|
1935
|
+
visitor.visit_constant_path_and_write_node(self)
|
1537
1936
|
end
|
1538
1937
|
|
1539
1938
|
# def child_nodes: () -> Array[nil | Node]
|
1540
1939
|
def child_nodes
|
1541
|
-
[value]
|
1940
|
+
[target, value]
|
1941
|
+
end
|
1942
|
+
|
1943
|
+
# def copy: (**params) -> ConstantPathAndWriteNode
|
1944
|
+
def copy(**params)
|
1945
|
+
ConstantPathAndWriteNode.new(
|
1946
|
+
params.fetch(:target) { target },
|
1947
|
+
params.fetch(:operator_loc) { operator_loc },
|
1948
|
+
params.fetch(:value) { value },
|
1949
|
+
params.fetch(:location) { location },
|
1950
|
+
)
|
1542
1951
|
end
|
1543
1952
|
|
1544
1953
|
# def deconstruct: () -> Array[nil | Node]
|
@@ -1546,12 +1955,12 @@ module YARP
|
|
1546
1955
|
|
1547
1956
|
# def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
|
1548
1957
|
def deconstruct_keys(keys)
|
1549
|
-
{
|
1958
|
+
{ target: target, operator_loc: operator_loc, value: value, location: location }
|
1550
1959
|
end
|
1551
1960
|
|
1552
|
-
# def
|
1553
|
-
def
|
1554
|
-
|
1961
|
+
# def operator: () -> String
|
1962
|
+
def operator
|
1963
|
+
operator_loc.slice
|
1555
1964
|
end
|
1556
1965
|
end
|
1557
1966
|
|
@@ -1587,6 +1996,16 @@ module YARP
|
|
1587
1996
|
[parent, child]
|
1588
1997
|
end
|
1589
1998
|
|
1999
|
+
# def copy: (**params) -> ConstantPathNode
|
2000
|
+
def copy(**params)
|
2001
|
+
ConstantPathNode.new(
|
2002
|
+
params.fetch(:parent) { parent },
|
2003
|
+
params.fetch(:child) { child },
|
2004
|
+
params.fetch(:delimiter_loc) { delimiter_loc },
|
2005
|
+
params.fetch(:location) { location },
|
2006
|
+
)
|
2007
|
+
end
|
2008
|
+
|
1590
2009
|
# def deconstruct: () -> Array[nil | Node]
|
1591
2010
|
alias deconstruct child_nodes
|
1592
2011
|
|
@@ -1601,12 +2020,12 @@ module YARP
|
|
1601
2020
|
end
|
1602
2021
|
end
|
1603
2022
|
|
1604
|
-
# Represents
|
2023
|
+
# Represents assigning to a constant path using an operator that isn't `=`.
|
1605
2024
|
#
|
1606
|
-
# Parent::Child
|
1607
|
-
#
|
1608
|
-
class
|
1609
|
-
# attr_reader target:
|
2025
|
+
# Parent::Child += value
|
2026
|
+
# ^^^^^^^^^^^^^^^^^^^^^^
|
2027
|
+
class ConstantPathOperatorWriteNode < Node
|
2028
|
+
# attr_reader target: ConstantPathNode
|
1610
2029
|
attr_reader :target
|
1611
2030
|
|
1612
2031
|
# attr_reader operator_loc: Location
|
@@ -1615,17 +2034,21 @@ module YARP
|
|
1615
2034
|
# attr_reader value: Node
|
1616
2035
|
attr_reader :value
|
1617
2036
|
|
1618
|
-
#
|
1619
|
-
|
2037
|
+
# attr_reader operator: Symbol
|
2038
|
+
attr_reader :operator
|
2039
|
+
|
2040
|
+
# def initialize: (target: ConstantPathNode, operator_loc: Location, value: Node, operator: Symbol, location: Location) -> void
|
2041
|
+
def initialize(target, operator_loc, value, operator, location)
|
1620
2042
|
@target = target
|
1621
2043
|
@operator_loc = operator_loc
|
1622
2044
|
@value = value
|
2045
|
+
@operator = operator
|
1623
2046
|
@location = location
|
1624
2047
|
end
|
1625
2048
|
|
1626
2049
|
# def accept: (visitor: Visitor) -> void
|
1627
2050
|
def accept(visitor)
|
1628
|
-
visitor.
|
2051
|
+
visitor.visit_constant_path_operator_write_node(self)
|
1629
2052
|
end
|
1630
2053
|
|
1631
2054
|
# def child_nodes: () -> Array[nil | Node]
|
@@ -1633,17 +2056,23 @@ module YARP
|
|
1633
2056
|
[target, value]
|
1634
2057
|
end
|
1635
2058
|
|
2059
|
+
# def copy: (**params) -> ConstantPathOperatorWriteNode
|
2060
|
+
def copy(**params)
|
2061
|
+
ConstantPathOperatorWriteNode.new(
|
2062
|
+
params.fetch(:target) { target },
|
2063
|
+
params.fetch(:operator_loc) { operator_loc },
|
2064
|
+
params.fetch(:value) { value },
|
2065
|
+
params.fetch(:operator) { operator },
|
2066
|
+
params.fetch(:location) { location },
|
2067
|
+
)
|
2068
|
+
end
|
2069
|
+
|
1636
2070
|
# def deconstruct: () -> Array[nil | Node]
|
1637
2071
|
alias deconstruct child_nodes
|
1638
2072
|
|
1639
2073
|
# def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
|
1640
2074
|
def deconstruct_keys(keys)
|
1641
|
-
{ target: target, operator_loc: operator_loc, value: value, location: location }
|
1642
|
-
end
|
1643
|
-
|
1644
|
-
# def operator: () -> String
|
1645
|
-
def operator
|
1646
|
-
operator_loc.slice
|
2075
|
+
{ target: target, operator_loc: operator_loc, value: value, operator: operator, location: location }
|
1647
2076
|
end
|
1648
2077
|
end
|
1649
2078
|
|
@@ -1651,8 +2080,8 @@ module YARP
|
|
1651
2080
|
#
|
1652
2081
|
# Parent::Child ||= value
|
1653
2082
|
# ^^^^^^^^^^^^^^^^^^^^^^^
|
1654
|
-
class
|
1655
|
-
# attr_reader target:
|
2083
|
+
class ConstantPathOrWriteNode < Node
|
2084
|
+
# attr_reader target: ConstantPathNode
|
1656
2085
|
attr_reader :target
|
1657
2086
|
|
1658
2087
|
# attr_reader operator_loc: Location
|
@@ -1661,7 +2090,7 @@ module YARP
|
|
1661
2090
|
# attr_reader value: Node
|
1662
2091
|
attr_reader :value
|
1663
2092
|
|
1664
|
-
# def initialize: (target:
|
2093
|
+
# def initialize: (target: ConstantPathNode, operator_loc: Location, value: Node, location: Location) -> void
|
1665
2094
|
def initialize(target, operator_loc, value, location)
|
1666
2095
|
@target = target
|
1667
2096
|
@operator_loc = operator_loc
|
@@ -1671,7 +2100,7 @@ module YARP
|
|
1671
2100
|
|
1672
2101
|
# def accept: (visitor: Visitor) -> void
|
1673
2102
|
def accept(visitor)
|
1674
|
-
visitor.
|
2103
|
+
visitor.visit_constant_path_or_write_node(self)
|
1675
2104
|
end
|
1676
2105
|
|
1677
2106
|
# def child_nodes: () -> Array[nil | Node]
|
@@ -1679,6 +2108,16 @@ module YARP
|
|
1679
2108
|
[target, value]
|
1680
2109
|
end
|
1681
2110
|
|
2111
|
+
# def copy: (**params) -> ConstantPathOrWriteNode
|
2112
|
+
def copy(**params)
|
2113
|
+
ConstantPathOrWriteNode.new(
|
2114
|
+
params.fetch(:target) { target },
|
2115
|
+
params.fetch(:operator_loc) { operator_loc },
|
2116
|
+
params.fetch(:value) { value },
|
2117
|
+
params.fetch(:location) { location },
|
2118
|
+
)
|
2119
|
+
end
|
2120
|
+
|
1682
2121
|
# def deconstruct: () -> Array[nil | Node]
|
1683
2122
|
alias deconstruct child_nodes
|
1684
2123
|
|
@@ -1693,40 +2132,46 @@ module YARP
|
|
1693
2132
|
end
|
1694
2133
|
end
|
1695
2134
|
|
1696
|
-
# Represents
|
2135
|
+
# Represents writing to a constant path in a context that doesn't have an explicit value.
|
1697
2136
|
#
|
1698
|
-
#
|
1699
|
-
#
|
1700
|
-
class
|
1701
|
-
# attr_reader
|
1702
|
-
attr_reader :
|
1703
|
-
|
1704
|
-
# attr_reader operator_loc: Location
|
1705
|
-
attr_reader :operator_loc
|
2137
|
+
# Foo::Foo, Bar::Bar = baz
|
2138
|
+
# ^^^^^^^^ ^^^^^^^^
|
2139
|
+
class ConstantPathTargetNode < Node
|
2140
|
+
# attr_reader parent: Node?
|
2141
|
+
attr_reader :parent
|
1706
2142
|
|
1707
|
-
# attr_reader
|
1708
|
-
attr_reader :
|
2143
|
+
# attr_reader child: Node
|
2144
|
+
attr_reader :child
|
1709
2145
|
|
1710
|
-
# attr_reader
|
1711
|
-
attr_reader :
|
2146
|
+
# attr_reader delimiter_loc: Location
|
2147
|
+
attr_reader :delimiter_loc
|
1712
2148
|
|
1713
|
-
# def initialize: (
|
1714
|
-
def initialize(
|
1715
|
-
@
|
1716
|
-
@
|
1717
|
-
@
|
1718
|
-
@operator = operator
|
2149
|
+
# def initialize: (parent: Node?, child: Node, delimiter_loc: Location, location: Location) -> void
|
2150
|
+
def initialize(parent, child, delimiter_loc, location)
|
2151
|
+
@parent = parent
|
2152
|
+
@child = child
|
2153
|
+
@delimiter_loc = delimiter_loc
|
1719
2154
|
@location = location
|
1720
2155
|
end
|
1721
2156
|
|
1722
2157
|
# def accept: (visitor: Visitor) -> void
|
1723
2158
|
def accept(visitor)
|
1724
|
-
visitor.
|
2159
|
+
visitor.visit_constant_path_target_node(self)
|
1725
2160
|
end
|
1726
2161
|
|
1727
2162
|
# def child_nodes: () -> Array[nil | Node]
|
1728
2163
|
def child_nodes
|
1729
|
-
[
|
2164
|
+
[parent, child]
|
2165
|
+
end
|
2166
|
+
|
2167
|
+
# def copy: (**params) -> ConstantPathTargetNode
|
2168
|
+
def copy(**params)
|
2169
|
+
ConstantPathTargetNode.new(
|
2170
|
+
params.fetch(:parent) { parent },
|
2171
|
+
params.fetch(:child) { child },
|
2172
|
+
params.fetch(:delimiter_loc) { delimiter_loc },
|
2173
|
+
params.fetch(:location) { location },
|
2174
|
+
)
|
1730
2175
|
end
|
1731
2176
|
|
1732
2177
|
# def deconstruct: () -> Array[nil | Node]
|
@@ -1734,7 +2179,12 @@ module YARP
|
|
1734
2179
|
|
1735
2180
|
# def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
|
1736
2181
|
def deconstruct_keys(keys)
|
1737
|
-
{
|
2182
|
+
{ parent: parent, child: child, delimiter_loc: delimiter_loc, location: location }
|
2183
|
+
end
|
2184
|
+
|
2185
|
+
# def delimiter: () -> String
|
2186
|
+
def delimiter
|
2187
|
+
delimiter_loc.slice
|
1738
2188
|
end
|
1739
2189
|
end
|
1740
2190
|
|
@@ -1749,16 +2199,16 @@ module YARP
|
|
1749
2199
|
# ::Foo::Bar = 1
|
1750
2200
|
# ^^^^^^^^^^^^^^
|
1751
2201
|
class ConstantPathWriteNode < Node
|
1752
|
-
# attr_reader target:
|
2202
|
+
# attr_reader target: ConstantPathNode
|
1753
2203
|
attr_reader :target
|
1754
2204
|
|
1755
|
-
# attr_reader operator_loc: Location
|
2205
|
+
# attr_reader operator_loc: Location
|
1756
2206
|
attr_reader :operator_loc
|
1757
2207
|
|
1758
|
-
# attr_reader value: Node
|
2208
|
+
# attr_reader value: Node
|
1759
2209
|
attr_reader :value
|
1760
2210
|
|
1761
|
-
# def initialize: (target:
|
2211
|
+
# def initialize: (target: ConstantPathNode, operator_loc: Location, value: Node, location: Location) -> void
|
1762
2212
|
def initialize(target, operator_loc, value, location)
|
1763
2213
|
@target = target
|
1764
2214
|
@operator_loc = operator_loc
|
@@ -1776,6 +2226,16 @@ module YARP
|
|
1776
2226
|
[target, value]
|
1777
2227
|
end
|
1778
2228
|
|
2229
|
+
# def copy: (**params) -> ConstantPathWriteNode
|
2230
|
+
def copy(**params)
|
2231
|
+
ConstantPathWriteNode.new(
|
2232
|
+
params.fetch(:target) { target },
|
2233
|
+
params.fetch(:operator_loc) { operator_loc },
|
2234
|
+
params.fetch(:value) { value },
|
2235
|
+
params.fetch(:location) { location },
|
2236
|
+
)
|
2237
|
+
end
|
2238
|
+
|
1779
2239
|
# def deconstruct: () -> Array[nil | Node]
|
1780
2240
|
alias deconstruct child_nodes
|
1781
2241
|
|
@@ -1784,9 +2244,9 @@ module YARP
|
|
1784
2244
|
{ target: target, operator_loc: operator_loc, value: value, location: location }
|
1785
2245
|
end
|
1786
2246
|
|
1787
|
-
# def operator: () -> String
|
2247
|
+
# def operator: () -> String
|
1788
2248
|
def operator
|
1789
|
-
operator_loc
|
2249
|
+
operator_loc.slice
|
1790
2250
|
end
|
1791
2251
|
end
|
1792
2252
|
|
@@ -1810,6 +2270,49 @@ module YARP
|
|
1810
2270
|
[]
|
1811
2271
|
end
|
1812
2272
|
|
2273
|
+
# def copy: (**params) -> ConstantReadNode
|
2274
|
+
def copy(**params)
|
2275
|
+
ConstantReadNode.new(
|
2276
|
+
params.fetch(:location) { location },
|
2277
|
+
)
|
2278
|
+
end
|
2279
|
+
|
2280
|
+
# def deconstruct: () -> Array[nil | Node]
|
2281
|
+
alias deconstruct child_nodes
|
2282
|
+
|
2283
|
+
# def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
|
2284
|
+
def deconstruct_keys(keys)
|
2285
|
+
{ location: location }
|
2286
|
+
end
|
2287
|
+
end
|
2288
|
+
|
2289
|
+
# Represents writing to a constant in a context that doesn't have an explicit value.
|
2290
|
+
#
|
2291
|
+
# Foo, Bar = baz
|
2292
|
+
# ^^^ ^^^
|
2293
|
+
class ConstantTargetNode < Node
|
2294
|
+
# def initialize: (location: Location) -> void
|
2295
|
+
def initialize(location)
|
2296
|
+
@location = location
|
2297
|
+
end
|
2298
|
+
|
2299
|
+
# def accept: (visitor: Visitor) -> void
|
2300
|
+
def accept(visitor)
|
2301
|
+
visitor.visit_constant_target_node(self)
|
2302
|
+
end
|
2303
|
+
|
2304
|
+
# def child_nodes: () -> Array[nil | Node]
|
2305
|
+
def child_nodes
|
2306
|
+
[]
|
2307
|
+
end
|
2308
|
+
|
2309
|
+
# def copy: (**params) -> ConstantTargetNode
|
2310
|
+
def copy(**params)
|
2311
|
+
ConstantTargetNode.new(
|
2312
|
+
params.fetch(:location) { location },
|
2313
|
+
)
|
2314
|
+
end
|
2315
|
+
|
1813
2316
|
# def deconstruct: () -> Array[nil | Node]
|
1814
2317
|
alias deconstruct child_nodes
|
1815
2318
|
|
@@ -1827,13 +2330,13 @@ module YARP
|
|
1827
2330
|
# attr_reader name_loc: Location
|
1828
2331
|
attr_reader :name_loc
|
1829
2332
|
|
1830
|
-
# attr_reader value: Node
|
2333
|
+
# attr_reader value: Node
|
1831
2334
|
attr_reader :value
|
1832
2335
|
|
1833
|
-
# attr_reader operator_loc: Location
|
2336
|
+
# attr_reader operator_loc: Location
|
1834
2337
|
attr_reader :operator_loc
|
1835
2338
|
|
1836
|
-
# def initialize: (name_loc: Location, value: Node
|
2339
|
+
# def initialize: (name_loc: Location, value: Node, operator_loc: Location, location: Location) -> void
|
1837
2340
|
def initialize(name_loc, value, operator_loc, location)
|
1838
2341
|
@name_loc = name_loc
|
1839
2342
|
@value = value
|
@@ -1851,6 +2354,16 @@ module YARP
|
|
1851
2354
|
[value]
|
1852
2355
|
end
|
1853
2356
|
|
2357
|
+
# def copy: (**params) -> ConstantWriteNode
|
2358
|
+
def copy(**params)
|
2359
|
+
ConstantWriteNode.new(
|
2360
|
+
params.fetch(:name_loc) { name_loc },
|
2361
|
+
params.fetch(:value) { value },
|
2362
|
+
params.fetch(:operator_loc) { operator_loc },
|
2363
|
+
params.fetch(:location) { location },
|
2364
|
+
)
|
2365
|
+
end
|
2366
|
+
|
1854
2367
|
# def deconstruct: () -> Array[nil | Node]
|
1855
2368
|
alias deconstruct child_nodes
|
1856
2369
|
|
@@ -1864,9 +2377,9 @@ module YARP
|
|
1864
2377
|
name_loc.slice
|
1865
2378
|
end
|
1866
2379
|
|
1867
|
-
# def operator: () -> String
|
2380
|
+
# def operator: () -> String
|
1868
2381
|
def operator
|
1869
|
-
operator_loc
|
2382
|
+
operator_loc.slice
|
1870
2383
|
end
|
1871
2384
|
end
|
1872
2385
|
|
@@ -1882,11 +2395,11 @@ module YARP
|
|
1882
2395
|
# attr_reader receiver: Node?
|
1883
2396
|
attr_reader :receiver
|
1884
2397
|
|
1885
|
-
# attr_reader parameters:
|
2398
|
+
# attr_reader parameters: ParametersNode?
|
1886
2399
|
attr_reader :parameters
|
1887
2400
|
|
1888
|
-
# attr_reader
|
1889
|
-
attr_reader :
|
2401
|
+
# attr_reader body: Node?
|
2402
|
+
attr_reader :body
|
1890
2403
|
|
1891
2404
|
# attr_reader locals: Array[Symbol]
|
1892
2405
|
attr_reader :locals
|
@@ -1909,12 +2422,12 @@ module YARP
|
|
1909
2422
|
# attr_reader end_keyword_loc: Location?
|
1910
2423
|
attr_reader :end_keyword_loc
|
1911
2424
|
|
1912
|
-
# def initialize: (name_loc: Location, receiver: Node?, parameters:
|
1913
|
-
def initialize(name_loc, receiver, parameters,
|
2425
|
+
# def initialize: (name_loc: Location, receiver: Node?, parameters: ParametersNode?, body: Node?, locals: Array[Symbol], def_keyword_loc: Location, operator_loc: Location?, lparen_loc: Location?, rparen_loc: Location?, equal_loc: Location?, end_keyword_loc: Location?, location: Location) -> void
|
2426
|
+
def initialize(name_loc, receiver, parameters, body, locals, def_keyword_loc, operator_loc, lparen_loc, rparen_loc, equal_loc, end_keyword_loc, location)
|
1914
2427
|
@name_loc = name_loc
|
1915
2428
|
@receiver = receiver
|
1916
2429
|
@parameters = parameters
|
1917
|
-
@
|
2430
|
+
@body = body
|
1918
2431
|
@locals = locals
|
1919
2432
|
@def_keyword_loc = def_keyword_loc
|
1920
2433
|
@operator_loc = operator_loc
|
@@ -1932,7 +2445,25 @@ module YARP
|
|
1932
2445
|
|
1933
2446
|
# def child_nodes: () -> Array[nil | Node]
|
1934
2447
|
def child_nodes
|
1935
|
-
[receiver, parameters,
|
2448
|
+
[receiver, parameters, body]
|
2449
|
+
end
|
2450
|
+
|
2451
|
+
# def copy: (**params) -> DefNode
|
2452
|
+
def copy(**params)
|
2453
|
+
DefNode.new(
|
2454
|
+
params.fetch(:name_loc) { name_loc },
|
2455
|
+
params.fetch(:receiver) { receiver },
|
2456
|
+
params.fetch(:parameters) { parameters },
|
2457
|
+
params.fetch(:body) { body },
|
2458
|
+
params.fetch(:locals) { locals },
|
2459
|
+
params.fetch(:def_keyword_loc) { def_keyword_loc },
|
2460
|
+
params.fetch(:operator_loc) { operator_loc },
|
2461
|
+
params.fetch(:lparen_loc) { lparen_loc },
|
2462
|
+
params.fetch(:rparen_loc) { rparen_loc },
|
2463
|
+
params.fetch(:equal_loc) { equal_loc },
|
2464
|
+
params.fetch(:end_keyword_loc) { end_keyword_loc },
|
2465
|
+
params.fetch(:location) { location },
|
2466
|
+
)
|
1936
2467
|
end
|
1937
2468
|
|
1938
2469
|
# def deconstruct: () -> Array[nil | Node]
|
@@ -1940,7 +2471,7 @@ module YARP
|
|
1940
2471
|
|
1941
2472
|
# def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
|
1942
2473
|
def deconstruct_keys(keys)
|
1943
|
-
{ name_loc: name_loc, receiver: receiver, parameters: parameters,
|
2474
|
+
{ name_loc: name_loc, receiver: receiver, parameters: parameters, body: body, locals: locals, def_keyword_loc: def_keyword_loc, operator_loc: operator_loc, lparen_loc: lparen_loc, rparen_loc: rparen_loc, equal_loc: equal_loc, end_keyword_loc: end_keyword_loc, location: location }
|
1944
2475
|
end
|
1945
2476
|
|
1946
2477
|
# def name: () -> String
|
@@ -2015,6 +2546,17 @@ module YARP
|
|
2015
2546
|
[value]
|
2016
2547
|
end
|
2017
2548
|
|
2549
|
+
# def copy: (**params) -> DefinedNode
|
2550
|
+
def copy(**params)
|
2551
|
+
DefinedNode.new(
|
2552
|
+
params.fetch(:lparen_loc) { lparen_loc },
|
2553
|
+
params.fetch(:value) { value },
|
2554
|
+
params.fetch(:rparen_loc) { rparen_loc },
|
2555
|
+
params.fetch(:keyword_loc) { keyword_loc },
|
2556
|
+
params.fetch(:location) { location },
|
2557
|
+
)
|
2558
|
+
end
|
2559
|
+
|
2018
2560
|
# def deconstruct: () -> Array[nil | Node]
|
2019
2561
|
alias deconstruct child_nodes
|
2020
2562
|
|
@@ -2047,13 +2589,13 @@ module YARP
|
|
2047
2589
|
# attr_reader else_keyword_loc: Location
|
2048
2590
|
attr_reader :else_keyword_loc
|
2049
2591
|
|
2050
|
-
# attr_reader statements:
|
2592
|
+
# attr_reader statements: StatementsNode?
|
2051
2593
|
attr_reader :statements
|
2052
2594
|
|
2053
2595
|
# attr_reader end_keyword_loc: Location?
|
2054
2596
|
attr_reader :end_keyword_loc
|
2055
2597
|
|
2056
|
-
# def initialize: (else_keyword_loc: Location, statements:
|
2598
|
+
# def initialize: (else_keyword_loc: Location, statements: StatementsNode?, end_keyword_loc: Location?, location: Location) -> void
|
2057
2599
|
def initialize(else_keyword_loc, statements, end_keyword_loc, location)
|
2058
2600
|
@else_keyword_loc = else_keyword_loc
|
2059
2601
|
@statements = statements
|
@@ -2071,6 +2613,16 @@ module YARP
|
|
2071
2613
|
[statements]
|
2072
2614
|
end
|
2073
2615
|
|
2616
|
+
# def copy: (**params) -> ElseNode
|
2617
|
+
def copy(**params)
|
2618
|
+
ElseNode.new(
|
2619
|
+
params.fetch(:else_keyword_loc) { else_keyword_loc },
|
2620
|
+
params.fetch(:statements) { statements },
|
2621
|
+
params.fetch(:end_keyword_loc) { end_keyword_loc },
|
2622
|
+
params.fetch(:location) { location },
|
2623
|
+
)
|
2624
|
+
end
|
2625
|
+
|
2074
2626
|
# def deconstruct: () -> Array[nil | Node]
|
2075
2627
|
alias deconstruct child_nodes
|
2076
2628
|
|
@@ -2098,13 +2650,13 @@ module YARP
|
|
2098
2650
|
# attr_reader opening_loc: Location
|
2099
2651
|
attr_reader :opening_loc
|
2100
2652
|
|
2101
|
-
# attr_reader statements:
|
2653
|
+
# attr_reader statements: StatementsNode?
|
2102
2654
|
attr_reader :statements
|
2103
2655
|
|
2104
2656
|
# attr_reader closing_loc: Location
|
2105
2657
|
attr_reader :closing_loc
|
2106
2658
|
|
2107
|
-
# def initialize: (opening_loc: Location, statements:
|
2659
|
+
# def initialize: (opening_loc: Location, statements: StatementsNode?, closing_loc: Location, location: Location) -> void
|
2108
2660
|
def initialize(opening_loc, statements, closing_loc, location)
|
2109
2661
|
@opening_loc = opening_loc
|
2110
2662
|
@statements = statements
|
@@ -2122,6 +2674,16 @@ module YARP
|
|
2122
2674
|
[statements]
|
2123
2675
|
end
|
2124
2676
|
|
2677
|
+
# def copy: (**params) -> EmbeddedStatementsNode
|
2678
|
+
def copy(**params)
|
2679
|
+
EmbeddedStatementsNode.new(
|
2680
|
+
params.fetch(:opening_loc) { opening_loc },
|
2681
|
+
params.fetch(:statements) { statements },
|
2682
|
+
params.fetch(:closing_loc) { closing_loc },
|
2683
|
+
params.fetch(:location) { location },
|
2684
|
+
)
|
2685
|
+
end
|
2686
|
+
|
2125
2687
|
# def deconstruct: () -> Array[nil | Node]
|
2126
2688
|
alias deconstruct child_nodes
|
2127
2689
|
|
@@ -2169,6 +2731,15 @@ module YARP
|
|
2169
2731
|
[variable]
|
2170
2732
|
end
|
2171
2733
|
|
2734
|
+
# def copy: (**params) -> EmbeddedVariableNode
|
2735
|
+
def copy(**params)
|
2736
|
+
EmbeddedVariableNode.new(
|
2737
|
+
params.fetch(:operator_loc) { operator_loc },
|
2738
|
+
params.fetch(:variable) { variable },
|
2739
|
+
params.fetch(:location) { location },
|
2740
|
+
)
|
2741
|
+
end
|
2742
|
+
|
2172
2743
|
# def deconstruct: () -> Array[nil | Node]
|
2173
2744
|
alias deconstruct child_nodes
|
2174
2745
|
|
@@ -2195,13 +2766,13 @@ module YARP
|
|
2195
2766
|
# attr_reader ensure_keyword_loc: Location
|
2196
2767
|
attr_reader :ensure_keyword_loc
|
2197
2768
|
|
2198
|
-
# attr_reader statements:
|
2769
|
+
# attr_reader statements: StatementsNode?
|
2199
2770
|
attr_reader :statements
|
2200
2771
|
|
2201
2772
|
# attr_reader end_keyword_loc: Location
|
2202
2773
|
attr_reader :end_keyword_loc
|
2203
2774
|
|
2204
|
-
# def initialize: (ensure_keyword_loc: Location, statements:
|
2775
|
+
# def initialize: (ensure_keyword_loc: Location, statements: StatementsNode?, end_keyword_loc: Location, location: Location) -> void
|
2205
2776
|
def initialize(ensure_keyword_loc, statements, end_keyword_loc, location)
|
2206
2777
|
@ensure_keyword_loc = ensure_keyword_loc
|
2207
2778
|
@statements = statements
|
@@ -2219,6 +2790,16 @@ module YARP
|
|
2219
2790
|
[statements]
|
2220
2791
|
end
|
2221
2792
|
|
2793
|
+
# def copy: (**params) -> EnsureNode
|
2794
|
+
def copy(**params)
|
2795
|
+
EnsureNode.new(
|
2796
|
+
params.fetch(:ensure_keyword_loc) { ensure_keyword_loc },
|
2797
|
+
params.fetch(:statements) { statements },
|
2798
|
+
params.fetch(:end_keyword_loc) { end_keyword_loc },
|
2799
|
+
params.fetch(:location) { location },
|
2800
|
+
)
|
2801
|
+
end
|
2802
|
+
|
2222
2803
|
# def deconstruct: () -> Array[nil | Node]
|
2223
2804
|
alias deconstruct child_nodes
|
2224
2805
|
|
@@ -2258,6 +2839,13 @@ module YARP
|
|
2258
2839
|
[]
|
2259
2840
|
end
|
2260
2841
|
|
2842
|
+
# def copy: (**params) -> FalseNode
|
2843
|
+
def copy(**params)
|
2844
|
+
FalseNode.new(
|
2845
|
+
params.fetch(:location) { location },
|
2846
|
+
)
|
2847
|
+
end
|
2848
|
+
|
2261
2849
|
# def deconstruct: () -> Array[nil | Node]
|
2262
2850
|
alias deconstruct child_nodes
|
2263
2851
|
|
@@ -2317,6 +2905,19 @@ module YARP
|
|
2317
2905
|
[constant, left, *requireds, right]
|
2318
2906
|
end
|
2319
2907
|
|
2908
|
+
# def copy: (**params) -> FindPatternNode
|
2909
|
+
def copy(**params)
|
2910
|
+
FindPatternNode.new(
|
2911
|
+
params.fetch(:constant) { constant },
|
2912
|
+
params.fetch(:left) { left },
|
2913
|
+
params.fetch(:requireds) { requireds },
|
2914
|
+
params.fetch(:right) { right },
|
2915
|
+
params.fetch(:opening_loc) { opening_loc },
|
2916
|
+
params.fetch(:closing_loc) { closing_loc },
|
2917
|
+
params.fetch(:location) { location },
|
2918
|
+
)
|
2919
|
+
end
|
2920
|
+
|
2320
2921
|
# def deconstruct: () -> Array[nil | Node]
|
2321
2922
|
alias deconstruct child_nodes
|
2322
2923
|
|
@@ -2372,6 +2973,17 @@ module YARP
|
|
2372
2973
|
[left, right]
|
2373
2974
|
end
|
2374
2975
|
|
2976
|
+
# def copy: (**params) -> FlipFlopNode
|
2977
|
+
def copy(**params)
|
2978
|
+
FlipFlopNode.new(
|
2979
|
+
params.fetch(:left) { left },
|
2980
|
+
params.fetch(:right) { right },
|
2981
|
+
params.fetch(:operator_loc) { operator_loc },
|
2982
|
+
params.fetch(:flags) { flags },
|
2983
|
+
params.fetch(:location) { location },
|
2984
|
+
)
|
2985
|
+
end
|
2986
|
+
|
2375
2987
|
# def deconstruct: () -> Array[nil | Node]
|
2376
2988
|
alias deconstruct child_nodes
|
2377
2989
|
|
@@ -2411,6 +3023,13 @@ module YARP
|
|
2411
3023
|
[]
|
2412
3024
|
end
|
2413
3025
|
|
3026
|
+
# def copy: (**params) -> FloatNode
|
3027
|
+
def copy(**params)
|
3028
|
+
FloatNode.new(
|
3029
|
+
params.fetch(:location) { location },
|
3030
|
+
)
|
3031
|
+
end
|
3032
|
+
|
2414
3033
|
# def deconstruct: () -> Array[nil | Node]
|
2415
3034
|
alias deconstruct child_nodes
|
2416
3035
|
|
@@ -2431,7 +3050,7 @@ module YARP
|
|
2431
3050
|
# attr_reader collection: Node
|
2432
3051
|
attr_reader :collection
|
2433
3052
|
|
2434
|
-
# attr_reader statements:
|
3053
|
+
# attr_reader statements: StatementsNode?
|
2435
3054
|
attr_reader :statements
|
2436
3055
|
|
2437
3056
|
# attr_reader for_keyword_loc: Location
|
@@ -2446,7 +3065,7 @@ module YARP
|
|
2446
3065
|
# attr_reader end_keyword_loc: Location
|
2447
3066
|
attr_reader :end_keyword_loc
|
2448
3067
|
|
2449
|
-
# def initialize: (index: Node, collection: Node, statements:
|
3068
|
+
# def initialize: (index: Node, collection: Node, statements: StatementsNode?, for_keyword_loc: Location, in_keyword_loc: Location, do_keyword_loc: Location?, end_keyword_loc: Location, location: Location) -> void
|
2450
3069
|
def initialize(index, collection, statements, for_keyword_loc, in_keyword_loc, do_keyword_loc, end_keyword_loc, location)
|
2451
3070
|
@index = index
|
2452
3071
|
@collection = collection
|
@@ -2468,6 +3087,20 @@ module YARP
|
|
2468
3087
|
[index, collection, statements]
|
2469
3088
|
end
|
2470
3089
|
|
3090
|
+
# def copy: (**params) -> ForNode
|
3091
|
+
def copy(**params)
|
3092
|
+
ForNode.new(
|
3093
|
+
params.fetch(:index) { index },
|
3094
|
+
params.fetch(:collection) { collection },
|
3095
|
+
params.fetch(:statements) { statements },
|
3096
|
+
params.fetch(:for_keyword_loc) { for_keyword_loc },
|
3097
|
+
params.fetch(:in_keyword_loc) { in_keyword_loc },
|
3098
|
+
params.fetch(:do_keyword_loc) { do_keyword_loc },
|
3099
|
+
params.fetch(:end_keyword_loc) { end_keyword_loc },
|
3100
|
+
params.fetch(:location) { location },
|
3101
|
+
)
|
3102
|
+
end
|
3103
|
+
|
2471
3104
|
# def deconstruct: () -> Array[nil | Node]
|
2472
3105
|
alias deconstruct child_nodes
|
2473
3106
|
|
@@ -2519,6 +3152,13 @@ module YARP
|
|
2519
3152
|
[]
|
2520
3153
|
end
|
2521
3154
|
|
3155
|
+
# def copy: (**params) -> ForwardingArgumentsNode
|
3156
|
+
def copy(**params)
|
3157
|
+
ForwardingArgumentsNode.new(
|
3158
|
+
params.fetch(:location) { location },
|
3159
|
+
)
|
3160
|
+
end
|
3161
|
+
|
2522
3162
|
# def deconstruct: () -> Array[nil | Node]
|
2523
3163
|
alias deconstruct child_nodes
|
2524
3164
|
|
@@ -2549,6 +3189,13 @@ module YARP
|
|
2549
3189
|
[]
|
2550
3190
|
end
|
2551
3191
|
|
3192
|
+
# def copy: (**params) -> ForwardingParameterNode
|
3193
|
+
def copy(**params)
|
3194
|
+
ForwardingParameterNode.new(
|
3195
|
+
params.fetch(:location) { location },
|
3196
|
+
)
|
3197
|
+
end
|
3198
|
+
|
2552
3199
|
# def deconstruct: () -> Array[nil | Node]
|
2553
3200
|
alias deconstruct child_nodes
|
2554
3201
|
|
@@ -2563,10 +3210,10 @@ module YARP
|
|
2563
3210
|
# super
|
2564
3211
|
# ^^^^^
|
2565
3212
|
class ForwardingSuperNode < Node
|
2566
|
-
# attr_reader block:
|
3213
|
+
# attr_reader block: BlockNode?
|
2567
3214
|
attr_reader :block
|
2568
3215
|
|
2569
|
-
# def initialize: (block:
|
3216
|
+
# def initialize: (block: BlockNode?, location: Location) -> void
|
2570
3217
|
def initialize(block, location)
|
2571
3218
|
@block = block
|
2572
3219
|
@location = location
|
@@ -2582,6 +3229,14 @@ module YARP
|
|
2582
3229
|
[block]
|
2583
3230
|
end
|
2584
3231
|
|
3232
|
+
# def copy: (**params) -> ForwardingSuperNode
|
3233
|
+
def copy(**params)
|
3234
|
+
ForwardingSuperNode.new(
|
3235
|
+
params.fetch(:block) { block },
|
3236
|
+
params.fetch(:location) { location },
|
3237
|
+
)
|
3238
|
+
end
|
3239
|
+
|
2585
3240
|
# def deconstruct: () -> Array[nil | Node]
|
2586
3241
|
alias deconstruct child_nodes
|
2587
3242
|
|
@@ -2595,7 +3250,7 @@ module YARP
|
|
2595
3250
|
#
|
2596
3251
|
# $target &&= value
|
2597
3252
|
# ^^^^^^^^^^^^^^^^^
|
2598
|
-
class
|
3253
|
+
class GlobalVariableAndWriteNode < Node
|
2599
3254
|
# attr_reader name_loc: Location
|
2600
3255
|
attr_reader :name_loc
|
2601
3256
|
|
@@ -2615,7 +3270,7 @@ module YARP
|
|
2615
3270
|
|
2616
3271
|
# def accept: (visitor: Visitor) -> void
|
2617
3272
|
def accept(visitor)
|
2618
|
-
visitor.
|
3273
|
+
visitor.visit_global_variable_and_write_node(self)
|
2619
3274
|
end
|
2620
3275
|
|
2621
3276
|
# def child_nodes: () -> Array[nil | Node]
|
@@ -2623,6 +3278,16 @@ module YARP
|
|
2623
3278
|
[value]
|
2624
3279
|
end
|
2625
3280
|
|
3281
|
+
# def copy: (**params) -> GlobalVariableAndWriteNode
|
3282
|
+
def copy(**params)
|
3283
|
+
GlobalVariableAndWriteNode.new(
|
3284
|
+
params.fetch(:name_loc) { name_loc },
|
3285
|
+
params.fetch(:operator_loc) { operator_loc },
|
3286
|
+
params.fetch(:value) { value },
|
3287
|
+
params.fetch(:location) { location },
|
3288
|
+
)
|
3289
|
+
end
|
3290
|
+
|
2626
3291
|
# def deconstruct: () -> Array[nil | Node]
|
2627
3292
|
alias deconstruct child_nodes
|
2628
3293
|
|
@@ -2642,11 +3307,11 @@ module YARP
|
|
2642
3307
|
end
|
2643
3308
|
end
|
2644
3309
|
|
2645
|
-
# Represents
|
3310
|
+
# Represents assigning to a global variable using an operator that isn't `=`.
|
2646
3311
|
#
|
2647
|
-
# $target
|
2648
|
-
#
|
2649
|
-
class
|
3312
|
+
# $target += value
|
3313
|
+
# ^^^^^^^^^^^^^^^^
|
3314
|
+
class GlobalVariableOperatorWriteNode < Node
|
2650
3315
|
# attr_reader name_loc: Location
|
2651
3316
|
attr_reader :name_loc
|
2652
3317
|
|
@@ -2656,17 +3321,21 @@ module YARP
|
|
2656
3321
|
# attr_reader value: Node
|
2657
3322
|
attr_reader :value
|
2658
3323
|
|
2659
|
-
#
|
2660
|
-
|
3324
|
+
# attr_reader operator: Symbol
|
3325
|
+
attr_reader :operator
|
3326
|
+
|
3327
|
+
# def initialize: (name_loc: Location, operator_loc: Location, value: Node, operator: Symbol, location: Location) -> void
|
3328
|
+
def initialize(name_loc, operator_loc, value, operator, location)
|
2661
3329
|
@name_loc = name_loc
|
2662
3330
|
@operator_loc = operator_loc
|
2663
3331
|
@value = value
|
3332
|
+
@operator = operator
|
2664
3333
|
@location = location
|
2665
3334
|
end
|
2666
3335
|
|
2667
3336
|
# def accept: (visitor: Visitor) -> void
|
2668
3337
|
def accept(visitor)
|
2669
|
-
visitor.
|
3338
|
+
visitor.visit_global_variable_operator_write_node(self)
|
2670
3339
|
end
|
2671
3340
|
|
2672
3341
|
# def child_nodes: () -> Array[nil | Node]
|
@@ -2674,30 +3343,36 @@ module YARP
|
|
2674
3343
|
[value]
|
2675
3344
|
end
|
2676
3345
|
|
3346
|
+
# def copy: (**params) -> GlobalVariableOperatorWriteNode
|
3347
|
+
def copy(**params)
|
3348
|
+
GlobalVariableOperatorWriteNode.new(
|
3349
|
+
params.fetch(:name_loc) { name_loc },
|
3350
|
+
params.fetch(:operator_loc) { operator_loc },
|
3351
|
+
params.fetch(:value) { value },
|
3352
|
+
params.fetch(:operator) { operator },
|
3353
|
+
params.fetch(:location) { location },
|
3354
|
+
)
|
3355
|
+
end
|
3356
|
+
|
2677
3357
|
# def deconstruct: () -> Array[nil | Node]
|
2678
3358
|
alias deconstruct child_nodes
|
2679
3359
|
|
2680
3360
|
# def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
|
2681
3361
|
def deconstruct_keys(keys)
|
2682
|
-
{ name_loc: name_loc, operator_loc: operator_loc, value: value, location: location }
|
3362
|
+
{ name_loc: name_loc, operator_loc: operator_loc, value: value, operator: operator, location: location }
|
2683
3363
|
end
|
2684
3364
|
|
2685
3365
|
# def name: () -> String
|
2686
3366
|
def name
|
2687
3367
|
name_loc.slice
|
2688
3368
|
end
|
2689
|
-
|
2690
|
-
# def operator: () -> String
|
2691
|
-
def operator
|
2692
|
-
operator_loc.slice
|
2693
|
-
end
|
2694
3369
|
end
|
2695
3370
|
|
2696
|
-
# Represents
|
3371
|
+
# Represents the use of the `||=` operator for assignment to a global variable.
|
2697
3372
|
#
|
2698
|
-
# $target
|
2699
|
-
#
|
2700
|
-
class
|
3373
|
+
# $target ||= value
|
3374
|
+
# ^^^^^^^^^^^^^^^^^
|
3375
|
+
class GlobalVariableOrWriteNode < Node
|
2701
3376
|
# attr_reader name_loc: Location
|
2702
3377
|
attr_reader :name_loc
|
2703
3378
|
|
@@ -2707,21 +3382,17 @@ module YARP
|
|
2707
3382
|
# attr_reader value: Node
|
2708
3383
|
attr_reader :value
|
2709
3384
|
|
2710
|
-
#
|
2711
|
-
|
2712
|
-
|
2713
|
-
# def initialize: (name_loc: Location, operator_loc: Location, value: Node, operator: Symbol, location: Location) -> void
|
2714
|
-
def initialize(name_loc, operator_loc, value, operator, location)
|
3385
|
+
# def initialize: (name_loc: Location, operator_loc: Location, value: Node, location: Location) -> void
|
3386
|
+
def initialize(name_loc, operator_loc, value, location)
|
2715
3387
|
@name_loc = name_loc
|
2716
3388
|
@operator_loc = operator_loc
|
2717
3389
|
@value = value
|
2718
|
-
@operator = operator
|
2719
3390
|
@location = location
|
2720
3391
|
end
|
2721
3392
|
|
2722
3393
|
# def accept: (visitor: Visitor) -> void
|
2723
3394
|
def accept(visitor)
|
2724
|
-
visitor.
|
3395
|
+
visitor.visit_global_variable_or_write_node(self)
|
2725
3396
|
end
|
2726
3397
|
|
2727
3398
|
# def child_nodes: () -> Array[nil | Node]
|
@@ -2729,18 +3400,33 @@ module YARP
|
|
2729
3400
|
[value]
|
2730
3401
|
end
|
2731
3402
|
|
3403
|
+
# def copy: (**params) -> GlobalVariableOrWriteNode
|
3404
|
+
def copy(**params)
|
3405
|
+
GlobalVariableOrWriteNode.new(
|
3406
|
+
params.fetch(:name_loc) { name_loc },
|
3407
|
+
params.fetch(:operator_loc) { operator_loc },
|
3408
|
+
params.fetch(:value) { value },
|
3409
|
+
params.fetch(:location) { location },
|
3410
|
+
)
|
3411
|
+
end
|
3412
|
+
|
2732
3413
|
# def deconstruct: () -> Array[nil | Node]
|
2733
3414
|
alias deconstruct child_nodes
|
2734
3415
|
|
2735
3416
|
# def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
|
2736
3417
|
def deconstruct_keys(keys)
|
2737
|
-
{ name_loc: name_loc, operator_loc: operator_loc, value: value,
|
3418
|
+
{ name_loc: name_loc, operator_loc: operator_loc, value: value, location: location }
|
2738
3419
|
end
|
2739
3420
|
|
2740
3421
|
# def name: () -> String
|
2741
3422
|
def name
|
2742
3423
|
name_loc.slice
|
2743
3424
|
end
|
3425
|
+
|
3426
|
+
# def operator: () -> String
|
3427
|
+
def operator
|
3428
|
+
operator_loc.slice
|
3429
|
+
end
|
2744
3430
|
end
|
2745
3431
|
|
2746
3432
|
# Represents referencing a global variable.
|
@@ -2763,6 +3449,49 @@ module YARP
|
|
2763
3449
|
[]
|
2764
3450
|
end
|
2765
3451
|
|
3452
|
+
# def copy: (**params) -> GlobalVariableReadNode
|
3453
|
+
def copy(**params)
|
3454
|
+
GlobalVariableReadNode.new(
|
3455
|
+
params.fetch(:location) { location },
|
3456
|
+
)
|
3457
|
+
end
|
3458
|
+
|
3459
|
+
# def deconstruct: () -> Array[nil | Node]
|
3460
|
+
alias deconstruct child_nodes
|
3461
|
+
|
3462
|
+
# def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
|
3463
|
+
def deconstruct_keys(keys)
|
3464
|
+
{ location: location }
|
3465
|
+
end
|
3466
|
+
end
|
3467
|
+
|
3468
|
+
# Represents writing to a global variable in a context that doesn't have an explicit value.
|
3469
|
+
#
|
3470
|
+
# $foo, $bar = baz
|
3471
|
+
# ^^^^ ^^^^
|
3472
|
+
class GlobalVariableTargetNode < Node
|
3473
|
+
# def initialize: (location: Location) -> void
|
3474
|
+
def initialize(location)
|
3475
|
+
@location = location
|
3476
|
+
end
|
3477
|
+
|
3478
|
+
# def accept: (visitor: Visitor) -> void
|
3479
|
+
def accept(visitor)
|
3480
|
+
visitor.visit_global_variable_target_node(self)
|
3481
|
+
end
|
3482
|
+
|
3483
|
+
# def child_nodes: () -> Array[nil | Node]
|
3484
|
+
def child_nodes
|
3485
|
+
[]
|
3486
|
+
end
|
3487
|
+
|
3488
|
+
# def copy: (**params) -> GlobalVariableTargetNode
|
3489
|
+
def copy(**params)
|
3490
|
+
GlobalVariableTargetNode.new(
|
3491
|
+
params.fetch(:location) { location },
|
3492
|
+
)
|
3493
|
+
end
|
3494
|
+
|
2766
3495
|
# def deconstruct: () -> Array[nil | Node]
|
2767
3496
|
alias deconstruct child_nodes
|
2768
3497
|
|
@@ -2780,13 +3509,13 @@ module YARP
|
|
2780
3509
|
# attr_reader name_loc: Location
|
2781
3510
|
attr_reader :name_loc
|
2782
3511
|
|
2783
|
-
# attr_reader operator_loc: Location
|
3512
|
+
# attr_reader operator_loc: Location
|
2784
3513
|
attr_reader :operator_loc
|
2785
3514
|
|
2786
|
-
# attr_reader value: Node
|
3515
|
+
# attr_reader value: Node
|
2787
3516
|
attr_reader :value
|
2788
3517
|
|
2789
|
-
# def initialize: (name_loc: Location, operator_loc: Location
|
3518
|
+
# def initialize: (name_loc: Location, operator_loc: Location, value: Node, location: Location) -> void
|
2790
3519
|
def initialize(name_loc, operator_loc, value, location)
|
2791
3520
|
@name_loc = name_loc
|
2792
3521
|
@operator_loc = operator_loc
|
@@ -2804,6 +3533,16 @@ module YARP
|
|
2804
3533
|
[value]
|
2805
3534
|
end
|
2806
3535
|
|
3536
|
+
# def copy: (**params) -> GlobalVariableWriteNode
|
3537
|
+
def copy(**params)
|
3538
|
+
GlobalVariableWriteNode.new(
|
3539
|
+
params.fetch(:name_loc) { name_loc },
|
3540
|
+
params.fetch(:operator_loc) { operator_loc },
|
3541
|
+
params.fetch(:value) { value },
|
3542
|
+
params.fetch(:location) { location },
|
3543
|
+
)
|
3544
|
+
end
|
3545
|
+
|
2807
3546
|
# def deconstruct: () -> Array[nil | Node]
|
2808
3547
|
alias deconstruct child_nodes
|
2809
3548
|
|
@@ -2817,9 +3556,9 @@ module YARP
|
|
2817
3556
|
name_loc.slice
|
2818
3557
|
end
|
2819
3558
|
|
2820
|
-
# def operator: () -> String
|
3559
|
+
# def operator: () -> String
|
2821
3560
|
def operator
|
2822
|
-
operator_loc
|
3561
|
+
operator_loc.slice
|
2823
3562
|
end
|
2824
3563
|
end
|
2825
3564
|
|
@@ -2855,6 +3594,16 @@ module YARP
|
|
2855
3594
|
[*elements]
|
2856
3595
|
end
|
2857
3596
|
|
3597
|
+
# def copy: (**params) -> HashNode
|
3598
|
+
def copy(**params)
|
3599
|
+
HashNode.new(
|
3600
|
+
params.fetch(:opening_loc) { opening_loc },
|
3601
|
+
params.fetch(:elements) { elements },
|
3602
|
+
params.fetch(:closing_loc) { closing_loc },
|
3603
|
+
params.fetch(:location) { location },
|
3604
|
+
)
|
3605
|
+
end
|
3606
|
+
|
2858
3607
|
# def deconstruct: () -> Array[nil | Node]
|
2859
3608
|
alias deconstruct child_nodes
|
2860
3609
|
|
@@ -2917,6 +3666,18 @@ module YARP
|
|
2917
3666
|
[constant, *assocs, kwrest]
|
2918
3667
|
end
|
2919
3668
|
|
3669
|
+
# def copy: (**params) -> HashPatternNode
|
3670
|
+
def copy(**params)
|
3671
|
+
HashPatternNode.new(
|
3672
|
+
params.fetch(:constant) { constant },
|
3673
|
+
params.fetch(:assocs) { assocs },
|
3674
|
+
params.fetch(:kwrest) { kwrest },
|
3675
|
+
params.fetch(:opening_loc) { opening_loc },
|
3676
|
+
params.fetch(:closing_loc) { closing_loc },
|
3677
|
+
params.fetch(:location) { location },
|
3678
|
+
)
|
3679
|
+
end
|
3680
|
+
|
2920
3681
|
# def deconstruct: () -> Array[nil | Node]
|
2921
3682
|
alias deconstruct child_nodes
|
2922
3683
|
|
@@ -2950,7 +3711,7 @@ module YARP
|
|
2950
3711
|
# attr_reader predicate: Node
|
2951
3712
|
attr_reader :predicate
|
2952
3713
|
|
2953
|
-
# attr_reader statements:
|
3714
|
+
# attr_reader statements: StatementsNode?
|
2954
3715
|
attr_reader :statements
|
2955
3716
|
|
2956
3717
|
# attr_reader consequent: Node?
|
@@ -2959,7 +3720,7 @@ module YARP
|
|
2959
3720
|
# attr_reader end_keyword_loc: Location?
|
2960
3721
|
attr_reader :end_keyword_loc
|
2961
3722
|
|
2962
|
-
# def initialize: (if_keyword_loc: Location?, predicate: Node, statements:
|
3723
|
+
# def initialize: (if_keyword_loc: Location?, predicate: Node, statements: StatementsNode?, consequent: Node?, end_keyword_loc: Location?, location: Location) -> void
|
2963
3724
|
def initialize(if_keyword_loc, predicate, statements, consequent, end_keyword_loc, location)
|
2964
3725
|
@if_keyword_loc = if_keyword_loc
|
2965
3726
|
@predicate = predicate
|
@@ -2983,6 +3744,18 @@ module YARP
|
|
2983
3744
|
[predicate, statements, consequent]
|
2984
3745
|
end
|
2985
3746
|
|
3747
|
+
# def copy: (**params) -> IfNode
|
3748
|
+
def copy(**params)
|
3749
|
+
IfNode.new(
|
3750
|
+
params.fetch(:if_keyword_loc) { if_keyword_loc },
|
3751
|
+
params.fetch(:predicate) { predicate },
|
3752
|
+
params.fetch(:statements) { statements },
|
3753
|
+
params.fetch(:consequent) { consequent },
|
3754
|
+
params.fetch(:end_keyword_loc) { end_keyword_loc },
|
3755
|
+
params.fetch(:location) { location },
|
3756
|
+
)
|
3757
|
+
end
|
3758
|
+
|
2986
3759
|
# def deconstruct: () -> Array[nil | Node]
|
2987
3760
|
alias deconstruct child_nodes
|
2988
3761
|
|
@@ -3026,6 +3799,14 @@ module YARP
|
|
3026
3799
|
[numeric]
|
3027
3800
|
end
|
3028
3801
|
|
3802
|
+
# def copy: (**params) -> ImaginaryNode
|
3803
|
+
def copy(**params)
|
3804
|
+
ImaginaryNode.new(
|
3805
|
+
params.fetch(:numeric) { numeric },
|
3806
|
+
params.fetch(:location) { location },
|
3807
|
+
)
|
3808
|
+
end
|
3809
|
+
|
3029
3810
|
# def deconstruct: () -> Array[nil | Node]
|
3030
3811
|
alias deconstruct child_nodes
|
3031
3812
|
|
@@ -3043,7 +3824,7 @@ module YARP
|
|
3043
3824
|
# attr_reader pattern: Node
|
3044
3825
|
attr_reader :pattern
|
3045
3826
|
|
3046
|
-
# attr_reader statements:
|
3827
|
+
# attr_reader statements: StatementsNode?
|
3047
3828
|
attr_reader :statements
|
3048
3829
|
|
3049
3830
|
# attr_reader in_loc: Location
|
@@ -3052,7 +3833,7 @@ module YARP
|
|
3052
3833
|
# attr_reader then_loc: Location?
|
3053
3834
|
attr_reader :then_loc
|
3054
3835
|
|
3055
|
-
# def initialize: (pattern: Node, statements:
|
3836
|
+
# def initialize: (pattern: Node, statements: StatementsNode?, in_loc: Location, then_loc: Location?, location: Location) -> void
|
3056
3837
|
def initialize(pattern, statements, in_loc, then_loc, location)
|
3057
3838
|
@pattern = pattern
|
3058
3839
|
@statements = statements
|
@@ -3071,6 +3852,17 @@ module YARP
|
|
3071
3852
|
[pattern, statements]
|
3072
3853
|
end
|
3073
3854
|
|
3855
|
+
# def copy: (**params) -> InNode
|
3856
|
+
def copy(**params)
|
3857
|
+
InNode.new(
|
3858
|
+
params.fetch(:pattern) { pattern },
|
3859
|
+
params.fetch(:statements) { statements },
|
3860
|
+
params.fetch(:in_loc) { in_loc },
|
3861
|
+
params.fetch(:then_loc) { then_loc },
|
3862
|
+
params.fetch(:location) { location },
|
3863
|
+
)
|
3864
|
+
end
|
3865
|
+
|
3074
3866
|
# def deconstruct: () -> Array[nil | Node]
|
3075
3867
|
alias deconstruct child_nodes
|
3076
3868
|
|
@@ -3094,7 +3886,7 @@ module YARP
|
|
3094
3886
|
#
|
3095
3887
|
# @target &&= value
|
3096
3888
|
# ^^^^^^^^^^^^^^^^^
|
3097
|
-
class
|
3889
|
+
class InstanceVariableAndWriteNode < Node
|
3098
3890
|
# attr_reader name_loc: Location
|
3099
3891
|
attr_reader :name_loc
|
3100
3892
|
|
@@ -3114,7 +3906,7 @@ module YARP
|
|
3114
3906
|
|
3115
3907
|
# def accept: (visitor: Visitor) -> void
|
3116
3908
|
def accept(visitor)
|
3117
|
-
visitor.
|
3909
|
+
visitor.visit_instance_variable_and_write_node(self)
|
3118
3910
|
end
|
3119
3911
|
|
3120
3912
|
# def child_nodes: () -> Array[nil | Node]
|
@@ -3122,6 +3914,16 @@ module YARP
|
|
3122
3914
|
[value]
|
3123
3915
|
end
|
3124
3916
|
|
3917
|
+
# def copy: (**params) -> InstanceVariableAndWriteNode
|
3918
|
+
def copy(**params)
|
3919
|
+
InstanceVariableAndWriteNode.new(
|
3920
|
+
params.fetch(:name_loc) { name_loc },
|
3921
|
+
params.fetch(:operator_loc) { operator_loc },
|
3922
|
+
params.fetch(:value) { value },
|
3923
|
+
params.fetch(:location) { location },
|
3924
|
+
)
|
3925
|
+
end
|
3926
|
+
|
3125
3927
|
# def deconstruct: () -> Array[nil | Node]
|
3126
3928
|
alias deconstruct child_nodes
|
3127
3929
|
|
@@ -3141,11 +3943,11 @@ module YARP
|
|
3141
3943
|
end
|
3142
3944
|
end
|
3143
3945
|
|
3144
|
-
# Represents
|
3946
|
+
# Represents assigning to an instance variable using an operator that isn't `=`.
|
3145
3947
|
#
|
3146
|
-
# @target
|
3147
|
-
#
|
3148
|
-
class
|
3948
|
+
# @target += value
|
3949
|
+
# ^^^^^^^^^^^^^^^^
|
3950
|
+
class InstanceVariableOperatorWriteNode < Node
|
3149
3951
|
# attr_reader name_loc: Location
|
3150
3952
|
attr_reader :name_loc
|
3151
3953
|
|
@@ -3155,17 +3957,21 @@ module YARP
|
|
3155
3957
|
# attr_reader value: Node
|
3156
3958
|
attr_reader :value
|
3157
3959
|
|
3158
|
-
#
|
3159
|
-
|
3960
|
+
# attr_reader operator: Symbol
|
3961
|
+
attr_reader :operator
|
3962
|
+
|
3963
|
+
# def initialize: (name_loc: Location, operator_loc: Location, value: Node, operator: Symbol, location: Location) -> void
|
3964
|
+
def initialize(name_loc, operator_loc, value, operator, location)
|
3160
3965
|
@name_loc = name_loc
|
3161
3966
|
@operator_loc = operator_loc
|
3162
3967
|
@value = value
|
3968
|
+
@operator = operator
|
3163
3969
|
@location = location
|
3164
3970
|
end
|
3165
3971
|
|
3166
3972
|
# def accept: (visitor: Visitor) -> void
|
3167
3973
|
def accept(visitor)
|
3168
|
-
visitor.
|
3974
|
+
visitor.visit_instance_variable_operator_write_node(self)
|
3169
3975
|
end
|
3170
3976
|
|
3171
3977
|
# def child_nodes: () -> Array[nil | Node]
|
@@ -3173,30 +3979,36 @@ module YARP
|
|
3173
3979
|
[value]
|
3174
3980
|
end
|
3175
3981
|
|
3982
|
+
# def copy: (**params) -> InstanceVariableOperatorWriteNode
|
3983
|
+
def copy(**params)
|
3984
|
+
InstanceVariableOperatorWriteNode.new(
|
3985
|
+
params.fetch(:name_loc) { name_loc },
|
3986
|
+
params.fetch(:operator_loc) { operator_loc },
|
3987
|
+
params.fetch(:value) { value },
|
3988
|
+
params.fetch(:operator) { operator },
|
3989
|
+
params.fetch(:location) { location },
|
3990
|
+
)
|
3991
|
+
end
|
3992
|
+
|
3176
3993
|
# def deconstruct: () -> Array[nil | Node]
|
3177
3994
|
alias deconstruct child_nodes
|
3178
3995
|
|
3179
3996
|
# def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
|
3180
3997
|
def deconstruct_keys(keys)
|
3181
|
-
{ name_loc: name_loc, operator_loc: operator_loc, value: value, location: location }
|
3998
|
+
{ name_loc: name_loc, operator_loc: operator_loc, value: value, operator: operator, location: location }
|
3182
3999
|
end
|
3183
4000
|
|
3184
4001
|
# def name: () -> String
|
3185
4002
|
def name
|
3186
4003
|
name_loc.slice
|
3187
4004
|
end
|
3188
|
-
|
3189
|
-
# def operator: () -> String
|
3190
|
-
def operator
|
3191
|
-
operator_loc.slice
|
3192
|
-
end
|
3193
4005
|
end
|
3194
4006
|
|
3195
|
-
# Represents
|
4007
|
+
# Represents the use of the `||=` operator for assignment to an instance variable.
|
3196
4008
|
#
|
3197
|
-
# @target
|
3198
|
-
#
|
3199
|
-
class
|
4009
|
+
# @target ||= value
|
4010
|
+
# ^^^^^^^^^^^^^^^^^
|
4011
|
+
class InstanceVariableOrWriteNode < Node
|
3200
4012
|
# attr_reader name_loc: Location
|
3201
4013
|
attr_reader :name_loc
|
3202
4014
|
|
@@ -3206,21 +4018,17 @@ module YARP
|
|
3206
4018
|
# attr_reader value: Node
|
3207
4019
|
attr_reader :value
|
3208
4020
|
|
3209
|
-
#
|
3210
|
-
|
3211
|
-
|
3212
|
-
# def initialize: (name_loc: Location, operator_loc: Location, value: Node, operator: Symbol, location: Location) -> void
|
3213
|
-
def initialize(name_loc, operator_loc, value, operator, location)
|
4021
|
+
# def initialize: (name_loc: Location, operator_loc: Location, value: Node, location: Location) -> void
|
4022
|
+
def initialize(name_loc, operator_loc, value, location)
|
3214
4023
|
@name_loc = name_loc
|
3215
4024
|
@operator_loc = operator_loc
|
3216
4025
|
@value = value
|
3217
|
-
@operator = operator
|
3218
4026
|
@location = location
|
3219
4027
|
end
|
3220
4028
|
|
3221
4029
|
# def accept: (visitor: Visitor) -> void
|
3222
4030
|
def accept(visitor)
|
3223
|
-
visitor.
|
4031
|
+
visitor.visit_instance_variable_or_write_node(self)
|
3224
4032
|
end
|
3225
4033
|
|
3226
4034
|
# def child_nodes: () -> Array[nil | Node]
|
@@ -3228,18 +4036,33 @@ module YARP
|
|
3228
4036
|
[value]
|
3229
4037
|
end
|
3230
4038
|
|
4039
|
+
# def copy: (**params) -> InstanceVariableOrWriteNode
|
4040
|
+
def copy(**params)
|
4041
|
+
InstanceVariableOrWriteNode.new(
|
4042
|
+
params.fetch(:name_loc) { name_loc },
|
4043
|
+
params.fetch(:operator_loc) { operator_loc },
|
4044
|
+
params.fetch(:value) { value },
|
4045
|
+
params.fetch(:location) { location },
|
4046
|
+
)
|
4047
|
+
end
|
4048
|
+
|
3231
4049
|
# def deconstruct: () -> Array[nil | Node]
|
3232
4050
|
alias deconstruct child_nodes
|
3233
4051
|
|
3234
4052
|
# def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
|
3235
4053
|
def deconstruct_keys(keys)
|
3236
|
-
{ name_loc: name_loc, operator_loc: operator_loc, value: value,
|
4054
|
+
{ name_loc: name_loc, operator_loc: operator_loc, value: value, location: location }
|
3237
4055
|
end
|
3238
4056
|
|
3239
4057
|
# def name: () -> String
|
3240
4058
|
def name
|
3241
4059
|
name_loc.slice
|
3242
4060
|
end
|
4061
|
+
|
4062
|
+
# def operator: () -> String
|
4063
|
+
def operator
|
4064
|
+
operator_loc.slice
|
4065
|
+
end
|
3243
4066
|
end
|
3244
4067
|
|
3245
4068
|
# Represents referencing an instance variable.
|
@@ -3262,6 +4085,49 @@ module YARP
|
|
3262
4085
|
[]
|
3263
4086
|
end
|
3264
4087
|
|
4088
|
+
# def copy: (**params) -> InstanceVariableReadNode
|
4089
|
+
def copy(**params)
|
4090
|
+
InstanceVariableReadNode.new(
|
4091
|
+
params.fetch(:location) { location },
|
4092
|
+
)
|
4093
|
+
end
|
4094
|
+
|
4095
|
+
# def deconstruct: () -> Array[nil | Node]
|
4096
|
+
alias deconstruct child_nodes
|
4097
|
+
|
4098
|
+
# def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
|
4099
|
+
def deconstruct_keys(keys)
|
4100
|
+
{ location: location }
|
4101
|
+
end
|
4102
|
+
end
|
4103
|
+
|
4104
|
+
# Represents writing to an instance variable in a context that doesn't have an explicit value.
|
4105
|
+
#
|
4106
|
+
# @foo, @bar = baz
|
4107
|
+
# ^^^^ ^^^^
|
4108
|
+
class InstanceVariableTargetNode < Node
|
4109
|
+
# def initialize: (location: Location) -> void
|
4110
|
+
def initialize(location)
|
4111
|
+
@location = location
|
4112
|
+
end
|
4113
|
+
|
4114
|
+
# def accept: (visitor: Visitor) -> void
|
4115
|
+
def accept(visitor)
|
4116
|
+
visitor.visit_instance_variable_target_node(self)
|
4117
|
+
end
|
4118
|
+
|
4119
|
+
# def child_nodes: () -> Array[nil | Node]
|
4120
|
+
def child_nodes
|
4121
|
+
[]
|
4122
|
+
end
|
4123
|
+
|
4124
|
+
# def copy: (**params) -> InstanceVariableTargetNode
|
4125
|
+
def copy(**params)
|
4126
|
+
InstanceVariableTargetNode.new(
|
4127
|
+
params.fetch(:location) { location },
|
4128
|
+
)
|
4129
|
+
end
|
4130
|
+
|
3265
4131
|
# def deconstruct: () -> Array[nil | Node]
|
3266
4132
|
alias deconstruct child_nodes
|
3267
4133
|
|
@@ -3279,13 +4145,13 @@ module YARP
|
|
3279
4145
|
# attr_reader name_loc: Location
|
3280
4146
|
attr_reader :name_loc
|
3281
4147
|
|
3282
|
-
# attr_reader value: Node
|
4148
|
+
# attr_reader value: Node
|
3283
4149
|
attr_reader :value
|
3284
4150
|
|
3285
|
-
# attr_reader operator_loc: Location
|
4151
|
+
# attr_reader operator_loc: Location
|
3286
4152
|
attr_reader :operator_loc
|
3287
4153
|
|
3288
|
-
# def initialize: (name_loc: Location, value: Node
|
4154
|
+
# def initialize: (name_loc: Location, value: Node, operator_loc: Location, location: Location) -> void
|
3289
4155
|
def initialize(name_loc, value, operator_loc, location)
|
3290
4156
|
@name_loc = name_loc
|
3291
4157
|
@value = value
|
@@ -3303,6 +4169,16 @@ module YARP
|
|
3303
4169
|
[value]
|
3304
4170
|
end
|
3305
4171
|
|
4172
|
+
# def copy: (**params) -> InstanceVariableWriteNode
|
4173
|
+
def copy(**params)
|
4174
|
+
InstanceVariableWriteNode.new(
|
4175
|
+
params.fetch(:name_loc) { name_loc },
|
4176
|
+
params.fetch(:value) { value },
|
4177
|
+
params.fetch(:operator_loc) { operator_loc },
|
4178
|
+
params.fetch(:location) { location },
|
4179
|
+
)
|
4180
|
+
end
|
4181
|
+
|
3306
4182
|
# def deconstruct: () -> Array[nil | Node]
|
3307
4183
|
alias deconstruct child_nodes
|
3308
4184
|
|
@@ -3316,9 +4192,9 @@ module YARP
|
|
3316
4192
|
name_loc.slice
|
3317
4193
|
end
|
3318
4194
|
|
3319
|
-
# def operator: () -> String
|
4195
|
+
# def operator: () -> String
|
3320
4196
|
def operator
|
3321
|
-
operator_loc
|
4197
|
+
operator_loc.slice
|
3322
4198
|
end
|
3323
4199
|
end
|
3324
4200
|
|
@@ -3342,6 +4218,13 @@ module YARP
|
|
3342
4218
|
[]
|
3343
4219
|
end
|
3344
4220
|
|
4221
|
+
# def copy: (**params) -> IntegerNode
|
4222
|
+
def copy(**params)
|
4223
|
+
IntegerNode.new(
|
4224
|
+
params.fetch(:location) { location },
|
4225
|
+
)
|
4226
|
+
end
|
4227
|
+
|
3345
4228
|
# def deconstruct: () -> Array[nil | Node]
|
3346
4229
|
alias deconstruct child_nodes
|
3347
4230
|
|
@@ -3392,6 +4275,17 @@ module YARP
|
|
3392
4275
|
[*parts]
|
3393
4276
|
end
|
3394
4277
|
|
4278
|
+
# def copy: (**params) -> InterpolatedRegularExpressionNode
|
4279
|
+
def copy(**params)
|
4280
|
+
InterpolatedRegularExpressionNode.new(
|
4281
|
+
params.fetch(:opening_loc) { opening_loc },
|
4282
|
+
params.fetch(:parts) { parts },
|
4283
|
+
params.fetch(:closing_loc) { closing_loc },
|
4284
|
+
params.fetch(:flags) { flags },
|
4285
|
+
params.fetch(:location) { location },
|
4286
|
+
)
|
4287
|
+
end
|
4288
|
+
|
3395
4289
|
# def deconstruct: () -> Array[nil | Node]
|
3396
4290
|
alias deconstruct child_nodes
|
3397
4291
|
|
@@ -3488,6 +4382,16 @@ module YARP
|
|
3488
4382
|
[*parts]
|
3489
4383
|
end
|
3490
4384
|
|
4385
|
+
# def copy: (**params) -> InterpolatedStringNode
|
4386
|
+
def copy(**params)
|
4387
|
+
InterpolatedStringNode.new(
|
4388
|
+
params.fetch(:opening_loc) { opening_loc },
|
4389
|
+
params.fetch(:parts) { parts },
|
4390
|
+
params.fetch(:closing_loc) { closing_loc },
|
4391
|
+
params.fetch(:location) { location },
|
4392
|
+
)
|
4393
|
+
end
|
4394
|
+
|
3491
4395
|
# def deconstruct: () -> Array[nil | Node]
|
3492
4396
|
alias deconstruct child_nodes
|
3493
4397
|
|
@@ -3544,6 +4448,16 @@ module YARP
|
|
3544
4448
|
[*parts]
|
3545
4449
|
end
|
3546
4450
|
|
4451
|
+
# def copy: (**params) -> InterpolatedSymbolNode
|
4452
|
+
def copy(**params)
|
4453
|
+
InterpolatedSymbolNode.new(
|
4454
|
+
params.fetch(:opening_loc) { opening_loc },
|
4455
|
+
params.fetch(:parts) { parts },
|
4456
|
+
params.fetch(:closing_loc) { closing_loc },
|
4457
|
+
params.fetch(:location) { location },
|
4458
|
+
)
|
4459
|
+
end
|
4460
|
+
|
3547
4461
|
# def deconstruct: () -> Array[nil | Node]
|
3548
4462
|
alias deconstruct child_nodes
|
3549
4463
|
|
@@ -3600,6 +4514,16 @@ module YARP
|
|
3600
4514
|
[*parts]
|
3601
4515
|
end
|
3602
4516
|
|
4517
|
+
# def copy: (**params) -> InterpolatedXStringNode
|
4518
|
+
def copy(**params)
|
4519
|
+
InterpolatedXStringNode.new(
|
4520
|
+
params.fetch(:opening_loc) { opening_loc },
|
4521
|
+
params.fetch(:parts) { parts },
|
4522
|
+
params.fetch(:closing_loc) { closing_loc },
|
4523
|
+
params.fetch(:location) { location },
|
4524
|
+
)
|
4525
|
+
end
|
4526
|
+
|
3603
4527
|
# def deconstruct: () -> Array[nil | Node]
|
3604
4528
|
alias deconstruct child_nodes
|
3605
4529
|
|
@@ -3643,6 +4567,14 @@ module YARP
|
|
3643
4567
|
[*elements]
|
3644
4568
|
end
|
3645
4569
|
|
4570
|
+
# def copy: (**params) -> KeywordHashNode
|
4571
|
+
def copy(**params)
|
4572
|
+
KeywordHashNode.new(
|
4573
|
+
params.fetch(:elements) { elements },
|
4574
|
+
params.fetch(:location) { location },
|
4575
|
+
)
|
4576
|
+
end
|
4577
|
+
|
3646
4578
|
# def deconstruct: () -> Array[nil | Node]
|
3647
4579
|
alias deconstruct child_nodes
|
3648
4580
|
|
@@ -3685,6 +4617,15 @@ module YARP
|
|
3685
4617
|
[value]
|
3686
4618
|
end
|
3687
4619
|
|
4620
|
+
# def copy: (**params) -> KeywordParameterNode
|
4621
|
+
def copy(**params)
|
4622
|
+
KeywordParameterNode.new(
|
4623
|
+
params.fetch(:name_loc) { name_loc },
|
4624
|
+
params.fetch(:value) { value },
|
4625
|
+
params.fetch(:location) { location },
|
4626
|
+
)
|
4627
|
+
end
|
4628
|
+
|
3688
4629
|
# def deconstruct: () -> Array[nil | Node]
|
3689
4630
|
alias deconstruct child_nodes
|
3690
4631
|
|
@@ -3728,6 +4669,15 @@ module YARP
|
|
3728
4669
|
[]
|
3729
4670
|
end
|
3730
4671
|
|
4672
|
+
# def copy: (**params) -> KeywordRestParameterNode
|
4673
|
+
def copy(**params)
|
4674
|
+
KeywordRestParameterNode.new(
|
4675
|
+
params.fetch(:operator_loc) { operator_loc },
|
4676
|
+
params.fetch(:name_loc) { name_loc },
|
4677
|
+
params.fetch(:location) { location },
|
4678
|
+
)
|
4679
|
+
end
|
4680
|
+
|
3731
4681
|
# def deconstruct: () -> Array[nil | Node]
|
3732
4682
|
alias deconstruct child_nodes
|
3733
4683
|
|
@@ -3755,21 +4705,29 @@ module YARP
|
|
3755
4705
|
# attr_reader locals: Array[Symbol]
|
3756
4706
|
attr_reader :locals
|
3757
4707
|
|
4708
|
+
# attr_reader operator_loc: Location
|
4709
|
+
attr_reader :operator_loc
|
4710
|
+
|
3758
4711
|
# attr_reader opening_loc: Location
|
3759
4712
|
attr_reader :opening_loc
|
3760
4713
|
|
3761
|
-
# attr_reader
|
4714
|
+
# attr_reader closing_loc: Location
|
4715
|
+
attr_reader :closing_loc
|
4716
|
+
|
4717
|
+
# attr_reader parameters: BlockParametersNode?
|
3762
4718
|
attr_reader :parameters
|
3763
4719
|
|
3764
|
-
# attr_reader
|
3765
|
-
attr_reader :
|
4720
|
+
# attr_reader body: Node?
|
4721
|
+
attr_reader :body
|
3766
4722
|
|
3767
|
-
# def initialize: (locals: Array[Symbol], opening_loc: Location, parameters:
|
3768
|
-
def initialize(locals, opening_loc, parameters,
|
4723
|
+
# def initialize: (locals: Array[Symbol], operator_loc: Location, opening_loc: Location, closing_loc: Location, parameters: BlockParametersNode?, body: Node?, location: Location) -> void
|
4724
|
+
def initialize(locals, operator_loc, opening_loc, closing_loc, parameters, body, location)
|
3769
4725
|
@locals = locals
|
4726
|
+
@operator_loc = operator_loc
|
3770
4727
|
@opening_loc = opening_loc
|
4728
|
+
@closing_loc = closing_loc
|
3771
4729
|
@parameters = parameters
|
3772
|
-
@
|
4730
|
+
@body = body
|
3773
4731
|
@location = location
|
3774
4732
|
end
|
3775
4733
|
|
@@ -3780,7 +4738,20 @@ module YARP
|
|
3780
4738
|
|
3781
4739
|
# def child_nodes: () -> Array[nil | Node]
|
3782
4740
|
def child_nodes
|
3783
|
-
[parameters,
|
4741
|
+
[parameters, body]
|
4742
|
+
end
|
4743
|
+
|
4744
|
+
# def copy: (**params) -> LambdaNode
|
4745
|
+
def copy(**params)
|
4746
|
+
LambdaNode.new(
|
4747
|
+
params.fetch(:locals) { locals },
|
4748
|
+
params.fetch(:operator_loc) { operator_loc },
|
4749
|
+
params.fetch(:opening_loc) { opening_loc },
|
4750
|
+
params.fetch(:closing_loc) { closing_loc },
|
4751
|
+
params.fetch(:parameters) { parameters },
|
4752
|
+
params.fetch(:body) { body },
|
4753
|
+
params.fetch(:location) { location },
|
4754
|
+
)
|
3784
4755
|
end
|
3785
4756
|
|
3786
4757
|
# def deconstruct: () -> Array[nil | Node]
|
@@ -3788,20 +4759,30 @@ module YARP
|
|
3788
4759
|
|
3789
4760
|
# def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
|
3790
4761
|
def deconstruct_keys(keys)
|
3791
|
-
{ locals: locals, opening_loc: opening_loc, parameters: parameters,
|
4762
|
+
{ locals: locals, operator_loc: operator_loc, opening_loc: opening_loc, closing_loc: closing_loc, parameters: parameters, body: body, location: location }
|
4763
|
+
end
|
4764
|
+
|
4765
|
+
# def operator: () -> String
|
4766
|
+
def operator
|
4767
|
+
operator_loc.slice
|
3792
4768
|
end
|
3793
4769
|
|
3794
4770
|
# def opening: () -> String
|
3795
4771
|
def opening
|
3796
4772
|
opening_loc.slice
|
3797
4773
|
end
|
4774
|
+
|
4775
|
+
# def closing: () -> String
|
4776
|
+
def closing
|
4777
|
+
closing_loc.slice
|
4778
|
+
end
|
3798
4779
|
end
|
3799
4780
|
|
3800
4781
|
# Represents the use of the `&&=` operator for assignment to a local variable.
|
3801
4782
|
#
|
3802
4783
|
# target &&= value
|
3803
4784
|
# ^^^^^^^^^^^^^^^^
|
3804
|
-
class
|
4785
|
+
class LocalVariableAndWriteNode < Node
|
3805
4786
|
# attr_reader name_loc: Location
|
3806
4787
|
attr_reader :name_loc
|
3807
4788
|
|
@@ -3814,18 +4795,22 @@ module YARP
|
|
3814
4795
|
# attr_reader constant_id: Symbol
|
3815
4796
|
attr_reader :constant_id
|
3816
4797
|
|
3817
|
-
#
|
3818
|
-
|
4798
|
+
# attr_reader depth: Integer
|
4799
|
+
attr_reader :depth
|
4800
|
+
|
4801
|
+
# def initialize: (name_loc: Location, operator_loc: Location, value: Node, constant_id: Symbol, depth: Integer, location: Location) -> void
|
4802
|
+
def initialize(name_loc, operator_loc, value, constant_id, depth, location)
|
3819
4803
|
@name_loc = name_loc
|
3820
4804
|
@operator_loc = operator_loc
|
3821
4805
|
@value = value
|
3822
4806
|
@constant_id = constant_id
|
4807
|
+
@depth = depth
|
3823
4808
|
@location = location
|
3824
4809
|
end
|
3825
4810
|
|
3826
4811
|
# def accept: (visitor: Visitor) -> void
|
3827
4812
|
def accept(visitor)
|
3828
|
-
visitor.
|
4813
|
+
visitor.visit_local_variable_and_write_node(self)
|
3829
4814
|
end
|
3830
4815
|
|
3831
4816
|
# def child_nodes: () -> Array[nil | Node]
|
@@ -3833,12 +4818,24 @@ module YARP
|
|
3833
4818
|
[value]
|
3834
4819
|
end
|
3835
4820
|
|
4821
|
+
# def copy: (**params) -> LocalVariableAndWriteNode
|
4822
|
+
def copy(**params)
|
4823
|
+
LocalVariableAndWriteNode.new(
|
4824
|
+
params.fetch(:name_loc) { name_loc },
|
4825
|
+
params.fetch(:operator_loc) { operator_loc },
|
4826
|
+
params.fetch(:value) { value },
|
4827
|
+
params.fetch(:constant_id) { constant_id },
|
4828
|
+
params.fetch(:depth) { depth },
|
4829
|
+
params.fetch(:location) { location },
|
4830
|
+
)
|
4831
|
+
end
|
4832
|
+
|
3836
4833
|
# def deconstruct: () -> Array[nil | Node]
|
3837
4834
|
alias deconstruct child_nodes
|
3838
4835
|
|
3839
4836
|
# def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
|
3840
4837
|
def deconstruct_keys(keys)
|
3841
|
-
{ name_loc: name_loc, operator_loc: operator_loc, value: value, constant_id: constant_id, location: location }
|
4838
|
+
{ name_loc: name_loc, operator_loc: operator_loc, value: value, constant_id: constant_id, depth: depth, location: location }
|
3842
4839
|
end
|
3843
4840
|
|
3844
4841
|
# def name: () -> String
|
@@ -3852,11 +4849,11 @@ module YARP
|
|
3852
4849
|
end
|
3853
4850
|
end
|
3854
4851
|
|
3855
|
-
# Represents
|
4852
|
+
# Represents assigning to a local variable using an operator that isn't `=`.
|
3856
4853
|
#
|
3857
|
-
# target
|
3858
|
-
#
|
3859
|
-
class
|
4854
|
+
# target += value
|
4855
|
+
# ^^^^^^^^^^^^^^^
|
4856
|
+
class LocalVariableOperatorWriteNode < Node
|
3860
4857
|
# attr_reader name_loc: Location
|
3861
4858
|
attr_reader :name_loc
|
3862
4859
|
|
@@ -3869,18 +4866,26 @@ module YARP
|
|
3869
4866
|
# attr_reader constant_id: Symbol
|
3870
4867
|
attr_reader :constant_id
|
3871
4868
|
|
3872
|
-
#
|
3873
|
-
|
4869
|
+
# attr_reader operator_id: Symbol
|
4870
|
+
attr_reader :operator_id
|
4871
|
+
|
4872
|
+
# attr_reader depth: Integer
|
4873
|
+
attr_reader :depth
|
4874
|
+
|
4875
|
+
# def initialize: (name_loc: Location, operator_loc: Location, value: Node, constant_id: Symbol, operator_id: Symbol, depth: Integer, location: Location) -> void
|
4876
|
+
def initialize(name_loc, operator_loc, value, constant_id, operator_id, depth, location)
|
3874
4877
|
@name_loc = name_loc
|
3875
4878
|
@operator_loc = operator_loc
|
3876
4879
|
@value = value
|
3877
4880
|
@constant_id = constant_id
|
4881
|
+
@operator_id = operator_id
|
4882
|
+
@depth = depth
|
3878
4883
|
@location = location
|
3879
4884
|
end
|
3880
4885
|
|
3881
4886
|
# def accept: (visitor: Visitor) -> void
|
3882
4887
|
def accept(visitor)
|
3883
|
-
visitor.
|
4888
|
+
visitor.visit_local_variable_operator_write_node(self)
|
3884
4889
|
end
|
3885
4890
|
|
3886
4891
|
# def child_nodes: () -> Array[nil | Node]
|
@@ -3888,12 +4893,25 @@ module YARP
|
|
3888
4893
|
[value]
|
3889
4894
|
end
|
3890
4895
|
|
4896
|
+
# def copy: (**params) -> LocalVariableOperatorWriteNode
|
4897
|
+
def copy(**params)
|
4898
|
+
LocalVariableOperatorWriteNode.new(
|
4899
|
+
params.fetch(:name_loc) { name_loc },
|
4900
|
+
params.fetch(:operator_loc) { operator_loc },
|
4901
|
+
params.fetch(:value) { value },
|
4902
|
+
params.fetch(:constant_id) { constant_id },
|
4903
|
+
params.fetch(:operator_id) { operator_id },
|
4904
|
+
params.fetch(:depth) { depth },
|
4905
|
+
params.fetch(:location) { location },
|
4906
|
+
)
|
4907
|
+
end
|
4908
|
+
|
3891
4909
|
# def deconstruct: () -> Array[nil | Node]
|
3892
4910
|
alias deconstruct child_nodes
|
3893
4911
|
|
3894
4912
|
# def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
|
3895
4913
|
def deconstruct_keys(keys)
|
3896
|
-
{ name_loc: name_loc, operator_loc: operator_loc, value: value, constant_id: constant_id, location: location }
|
4914
|
+
{ name_loc: name_loc, operator_loc: operator_loc, value: value, constant_id: constant_id, operator_id: operator_id, depth: depth, location: location }
|
3897
4915
|
end
|
3898
4916
|
|
3899
4917
|
# def name: () -> String
|
@@ -3907,11 +4925,11 @@ module YARP
|
|
3907
4925
|
end
|
3908
4926
|
end
|
3909
4927
|
|
3910
|
-
# Represents
|
4928
|
+
# Represents the use of the `||=` operator for assignment to a local variable.
|
3911
4929
|
#
|
3912
|
-
# target
|
3913
|
-
#
|
3914
|
-
class
|
4930
|
+
# target ||= value
|
4931
|
+
# ^^^^^^^^^^^^^^^^
|
4932
|
+
class LocalVariableOrWriteNode < Node
|
3915
4933
|
# attr_reader name_loc: Location
|
3916
4934
|
attr_reader :name_loc
|
3917
4935
|
|
@@ -3924,22 +4942,22 @@ module YARP
|
|
3924
4942
|
# attr_reader constant_id: Symbol
|
3925
4943
|
attr_reader :constant_id
|
3926
4944
|
|
3927
|
-
# attr_reader
|
3928
|
-
attr_reader :
|
4945
|
+
# attr_reader depth: Integer
|
4946
|
+
attr_reader :depth
|
3929
4947
|
|
3930
|
-
# def initialize: (name_loc: Location, operator_loc: Location, value: Node, constant_id: Symbol,
|
3931
|
-
def initialize(name_loc, operator_loc, value, constant_id,
|
4948
|
+
# def initialize: (name_loc: Location, operator_loc: Location, value: Node, constant_id: Symbol, depth: Integer, location: Location) -> void
|
4949
|
+
def initialize(name_loc, operator_loc, value, constant_id, depth, location)
|
3932
4950
|
@name_loc = name_loc
|
3933
4951
|
@operator_loc = operator_loc
|
3934
4952
|
@value = value
|
3935
4953
|
@constant_id = constant_id
|
3936
|
-
@
|
4954
|
+
@depth = depth
|
3937
4955
|
@location = location
|
3938
4956
|
end
|
3939
4957
|
|
3940
4958
|
# def accept: (visitor: Visitor) -> void
|
3941
4959
|
def accept(visitor)
|
3942
|
-
visitor.
|
4960
|
+
visitor.visit_local_variable_or_write_node(self)
|
3943
4961
|
end
|
3944
4962
|
|
3945
4963
|
# def child_nodes: () -> Array[nil | Node]
|
@@ -3947,12 +4965,24 @@ module YARP
|
|
3947
4965
|
[value]
|
3948
4966
|
end
|
3949
4967
|
|
4968
|
+
# def copy: (**params) -> LocalVariableOrWriteNode
|
4969
|
+
def copy(**params)
|
4970
|
+
LocalVariableOrWriteNode.new(
|
4971
|
+
params.fetch(:name_loc) { name_loc },
|
4972
|
+
params.fetch(:operator_loc) { operator_loc },
|
4973
|
+
params.fetch(:value) { value },
|
4974
|
+
params.fetch(:constant_id) { constant_id },
|
4975
|
+
params.fetch(:depth) { depth },
|
4976
|
+
params.fetch(:location) { location },
|
4977
|
+
)
|
4978
|
+
end
|
4979
|
+
|
3950
4980
|
# def deconstruct: () -> Array[nil | Node]
|
3951
4981
|
alias deconstruct child_nodes
|
3952
4982
|
|
3953
4983
|
# def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
|
3954
4984
|
def deconstruct_keys(keys)
|
3955
|
-
{ name_loc: name_loc, operator_loc: operator_loc, value: value, constant_id: constant_id,
|
4985
|
+
{ name_loc: name_loc, operator_loc: operator_loc, value: value, constant_id: constant_id, depth: depth, location: location }
|
3956
4986
|
end
|
3957
4987
|
|
3958
4988
|
# def name: () -> String
|
@@ -3996,6 +5026,61 @@ module YARP
|
|
3996
5026
|
[]
|
3997
5027
|
end
|
3998
5028
|
|
5029
|
+
# def copy: (**params) -> LocalVariableReadNode
|
5030
|
+
def copy(**params)
|
5031
|
+
LocalVariableReadNode.new(
|
5032
|
+
params.fetch(:constant_id) { constant_id },
|
5033
|
+
params.fetch(:depth) { depth },
|
5034
|
+
params.fetch(:location) { location },
|
5035
|
+
)
|
5036
|
+
end
|
5037
|
+
|
5038
|
+
# def deconstruct: () -> Array[nil | Node]
|
5039
|
+
alias deconstruct child_nodes
|
5040
|
+
|
5041
|
+
# def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
|
5042
|
+
def deconstruct_keys(keys)
|
5043
|
+
{ constant_id: constant_id, depth: depth, location: location }
|
5044
|
+
end
|
5045
|
+
end
|
5046
|
+
|
5047
|
+
# Represents writing to a local variable in a context that doesn't have an explicit value.
|
5048
|
+
#
|
5049
|
+
# foo, bar = baz
|
5050
|
+
# ^^^ ^^^
|
5051
|
+
class LocalVariableTargetNode < Node
|
5052
|
+
# attr_reader constant_id: Symbol
|
5053
|
+
attr_reader :constant_id
|
5054
|
+
|
5055
|
+
# attr_reader depth: Integer
|
5056
|
+
attr_reader :depth
|
5057
|
+
|
5058
|
+
# def initialize: (constant_id: Symbol, depth: Integer, location: Location) -> void
|
5059
|
+
def initialize(constant_id, depth, location)
|
5060
|
+
@constant_id = constant_id
|
5061
|
+
@depth = depth
|
5062
|
+
@location = location
|
5063
|
+
end
|
5064
|
+
|
5065
|
+
# def accept: (visitor: Visitor) -> void
|
5066
|
+
def accept(visitor)
|
5067
|
+
visitor.visit_local_variable_target_node(self)
|
5068
|
+
end
|
5069
|
+
|
5070
|
+
# def child_nodes: () -> Array[nil | Node]
|
5071
|
+
def child_nodes
|
5072
|
+
[]
|
5073
|
+
end
|
5074
|
+
|
5075
|
+
# def copy: (**params) -> LocalVariableTargetNode
|
5076
|
+
def copy(**params)
|
5077
|
+
LocalVariableTargetNode.new(
|
5078
|
+
params.fetch(:constant_id) { constant_id },
|
5079
|
+
params.fetch(:depth) { depth },
|
5080
|
+
params.fetch(:location) { location },
|
5081
|
+
)
|
5082
|
+
end
|
5083
|
+
|
3999
5084
|
# def deconstruct: () -> Array[nil | Node]
|
4000
5085
|
alias deconstruct child_nodes
|
4001
5086
|
|
@@ -4016,16 +5101,16 @@ module YARP
|
|
4016
5101
|
# attr_reader depth: Integer
|
4017
5102
|
attr_reader :depth
|
4018
5103
|
|
4019
|
-
# attr_reader value: Node
|
5104
|
+
# attr_reader value: Node
|
4020
5105
|
attr_reader :value
|
4021
5106
|
|
4022
5107
|
# attr_reader name_loc: Location
|
4023
5108
|
attr_reader :name_loc
|
4024
5109
|
|
4025
|
-
# attr_reader operator_loc: Location
|
5110
|
+
# attr_reader operator_loc: Location
|
4026
5111
|
attr_reader :operator_loc
|
4027
5112
|
|
4028
|
-
# def initialize: (constant_id: Symbol, depth: Integer, value: Node
|
5113
|
+
# def initialize: (constant_id: Symbol, depth: Integer, value: Node, name_loc: Location, operator_loc: Location, location: Location) -> void
|
4029
5114
|
def initialize(constant_id, depth, value, name_loc, operator_loc, location)
|
4030
5115
|
@constant_id = constant_id
|
4031
5116
|
@depth = depth
|
@@ -4045,6 +5130,18 @@ module YARP
|
|
4045
5130
|
[value]
|
4046
5131
|
end
|
4047
5132
|
|
5133
|
+
# def copy: (**params) -> LocalVariableWriteNode
|
5134
|
+
def copy(**params)
|
5135
|
+
LocalVariableWriteNode.new(
|
5136
|
+
params.fetch(:constant_id) { constant_id },
|
5137
|
+
params.fetch(:depth) { depth },
|
5138
|
+
params.fetch(:value) { value },
|
5139
|
+
params.fetch(:name_loc) { name_loc },
|
5140
|
+
params.fetch(:operator_loc) { operator_loc },
|
5141
|
+
params.fetch(:location) { location },
|
5142
|
+
)
|
5143
|
+
end
|
5144
|
+
|
4048
5145
|
# def deconstruct: () -> Array[nil | Node]
|
4049
5146
|
alias deconstruct child_nodes
|
4050
5147
|
|
@@ -4058,9 +5155,9 @@ module YARP
|
|
4058
5155
|
name_loc.slice
|
4059
5156
|
end
|
4060
5157
|
|
4061
|
-
# def operator: () -> String
|
5158
|
+
# def operator: () -> String
|
4062
5159
|
def operator
|
4063
|
-
operator_loc
|
5160
|
+
operator_loc.slice
|
4064
5161
|
end
|
4065
5162
|
end
|
4066
5163
|
|
@@ -4096,6 +5193,16 @@ module YARP
|
|
4096
5193
|
[value, pattern]
|
4097
5194
|
end
|
4098
5195
|
|
5196
|
+
# def copy: (**params) -> MatchPredicateNode
|
5197
|
+
def copy(**params)
|
5198
|
+
MatchPredicateNode.new(
|
5199
|
+
params.fetch(:value) { value },
|
5200
|
+
params.fetch(:pattern) { pattern },
|
5201
|
+
params.fetch(:operator_loc) { operator_loc },
|
5202
|
+
params.fetch(:location) { location },
|
5203
|
+
)
|
5204
|
+
end
|
5205
|
+
|
4099
5206
|
# def deconstruct: () -> Array[nil | Node]
|
4100
5207
|
alias deconstruct child_nodes
|
4101
5208
|
|
@@ -4142,6 +5249,16 @@ module YARP
|
|
4142
5249
|
[value, pattern]
|
4143
5250
|
end
|
4144
5251
|
|
5252
|
+
# def copy: (**params) -> MatchRequiredNode
|
5253
|
+
def copy(**params)
|
5254
|
+
MatchRequiredNode.new(
|
5255
|
+
params.fetch(:value) { value },
|
5256
|
+
params.fetch(:pattern) { pattern },
|
5257
|
+
params.fetch(:operator_loc) { operator_loc },
|
5258
|
+
params.fetch(:location) { location },
|
5259
|
+
)
|
5260
|
+
end
|
5261
|
+
|
4145
5262
|
# def deconstruct: () -> Array[nil | Node]
|
4146
5263
|
alias deconstruct child_nodes
|
4147
5264
|
|
@@ -4174,6 +5291,13 @@ module YARP
|
|
4174
5291
|
[]
|
4175
5292
|
end
|
4176
5293
|
|
5294
|
+
# def copy: (**params) -> MissingNode
|
5295
|
+
def copy(**params)
|
5296
|
+
MissingNode.new(
|
5297
|
+
params.fetch(:location) { location },
|
5298
|
+
)
|
5299
|
+
end
|
5300
|
+
|
4177
5301
|
# def deconstruct: () -> Array[nil | Node]
|
4178
5302
|
alias deconstruct child_nodes
|
4179
5303
|
|
@@ -4197,19 +5321,23 @@ module YARP
|
|
4197
5321
|
# attr_reader constant_path: Node
|
4198
5322
|
attr_reader :constant_path
|
4199
5323
|
|
4200
|
-
# attr_reader
|
4201
|
-
attr_reader :
|
5324
|
+
# attr_reader body: Node?
|
5325
|
+
attr_reader :body
|
4202
5326
|
|
4203
5327
|
# attr_reader end_keyword_loc: Location
|
4204
5328
|
attr_reader :end_keyword_loc
|
4205
5329
|
|
4206
|
-
#
|
4207
|
-
|
5330
|
+
# attr_reader name: String
|
5331
|
+
attr_reader :name
|
5332
|
+
|
5333
|
+
# def initialize: (locals: Array[Symbol], module_keyword_loc: Location, constant_path: Node, body: Node?, end_keyword_loc: Location, name: String, location: Location) -> void
|
5334
|
+
def initialize(locals, module_keyword_loc, constant_path, body, end_keyword_loc, name, location)
|
4208
5335
|
@locals = locals
|
4209
5336
|
@module_keyword_loc = module_keyword_loc
|
4210
5337
|
@constant_path = constant_path
|
4211
|
-
@
|
5338
|
+
@body = body
|
4212
5339
|
@end_keyword_loc = end_keyword_loc
|
5340
|
+
@name = name
|
4213
5341
|
@location = location
|
4214
5342
|
end
|
4215
5343
|
|
@@ -4220,7 +5348,20 @@ module YARP
|
|
4220
5348
|
|
4221
5349
|
# def child_nodes: () -> Array[nil | Node]
|
4222
5350
|
def child_nodes
|
4223
|
-
[constant_path,
|
5351
|
+
[constant_path, body]
|
5352
|
+
end
|
5353
|
+
|
5354
|
+
# def copy: (**params) -> ModuleNode
|
5355
|
+
def copy(**params)
|
5356
|
+
ModuleNode.new(
|
5357
|
+
params.fetch(:locals) { locals },
|
5358
|
+
params.fetch(:module_keyword_loc) { module_keyword_loc },
|
5359
|
+
params.fetch(:constant_path) { constant_path },
|
5360
|
+
params.fetch(:body) { body },
|
5361
|
+
params.fetch(:end_keyword_loc) { end_keyword_loc },
|
5362
|
+
params.fetch(:name) { name },
|
5363
|
+
params.fetch(:location) { location },
|
5364
|
+
)
|
4224
5365
|
end
|
4225
5366
|
|
4226
5367
|
# def deconstruct: () -> Array[nil | Node]
|
@@ -4228,7 +5369,7 @@ module YARP
|
|
4228
5369
|
|
4229
5370
|
# def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
|
4230
5371
|
def deconstruct_keys(keys)
|
4231
|
-
{ locals: locals, module_keyword_loc: module_keyword_loc, constant_path: constant_path,
|
5372
|
+
{ locals: locals, module_keyword_loc: module_keyword_loc, constant_path: constant_path, body: body, end_keyword_loc: end_keyword_loc, name: name, location: location }
|
4232
5373
|
end
|
4233
5374
|
|
4234
5375
|
# def module_keyword: () -> String
|
@@ -4282,6 +5423,18 @@ module YARP
|
|
4282
5423
|
[*targets, value]
|
4283
5424
|
end
|
4284
5425
|
|
5426
|
+
# def copy: (**params) -> MultiWriteNode
|
5427
|
+
def copy(**params)
|
5428
|
+
MultiWriteNode.new(
|
5429
|
+
params.fetch(:targets) { targets },
|
5430
|
+
params.fetch(:operator_loc) { operator_loc },
|
5431
|
+
params.fetch(:value) { value },
|
5432
|
+
params.fetch(:lparen_loc) { lparen_loc },
|
5433
|
+
params.fetch(:rparen_loc) { rparen_loc },
|
5434
|
+
params.fetch(:location) { location },
|
5435
|
+
)
|
5436
|
+
end
|
5437
|
+
|
4285
5438
|
# def deconstruct: () -> Array[nil | Node]
|
4286
5439
|
alias deconstruct child_nodes
|
4287
5440
|
|
@@ -4311,13 +5464,13 @@ module YARP
|
|
4311
5464
|
# next 1
|
4312
5465
|
# ^^^^^^
|
4313
5466
|
class NextNode < Node
|
4314
|
-
# attr_reader arguments:
|
5467
|
+
# attr_reader arguments: ArgumentsNode?
|
4315
5468
|
attr_reader :arguments
|
4316
5469
|
|
4317
5470
|
# attr_reader keyword_loc: Location
|
4318
5471
|
attr_reader :keyword_loc
|
4319
5472
|
|
4320
|
-
# def initialize: (arguments:
|
5473
|
+
# def initialize: (arguments: ArgumentsNode?, keyword_loc: Location, location: Location) -> void
|
4321
5474
|
def initialize(arguments, keyword_loc, location)
|
4322
5475
|
@arguments = arguments
|
4323
5476
|
@keyword_loc = keyword_loc
|
@@ -4334,6 +5487,15 @@ module YARP
|
|
4334
5487
|
[arguments]
|
4335
5488
|
end
|
4336
5489
|
|
5490
|
+
# def copy: (**params) -> NextNode
|
5491
|
+
def copy(**params)
|
5492
|
+
NextNode.new(
|
5493
|
+
params.fetch(:arguments) { arguments },
|
5494
|
+
params.fetch(:keyword_loc) { keyword_loc },
|
5495
|
+
params.fetch(:location) { location },
|
5496
|
+
)
|
5497
|
+
end
|
5498
|
+
|
4337
5499
|
# def deconstruct: () -> Array[nil | Node]
|
4338
5500
|
alias deconstruct child_nodes
|
4339
5501
|
|
@@ -4368,6 +5530,13 @@ module YARP
|
|
4368
5530
|
[]
|
4369
5531
|
end
|
4370
5532
|
|
5533
|
+
# def copy: (**params) -> NilNode
|
5534
|
+
def copy(**params)
|
5535
|
+
NilNode.new(
|
5536
|
+
params.fetch(:location) { location },
|
5537
|
+
)
|
5538
|
+
end
|
5539
|
+
|
4371
5540
|
# def deconstruct: () -> Array[nil | Node]
|
4372
5541
|
alias deconstruct child_nodes
|
4373
5542
|
|
@@ -4406,6 +5575,15 @@ module YARP
|
|
4406
5575
|
[]
|
4407
5576
|
end
|
4408
5577
|
|
5578
|
+
# def copy: (**params) -> NoKeywordsParameterNode
|
5579
|
+
def copy(**params)
|
5580
|
+
NoKeywordsParameterNode.new(
|
5581
|
+
params.fetch(:operator_loc) { operator_loc },
|
5582
|
+
params.fetch(:keyword_loc) { keyword_loc },
|
5583
|
+
params.fetch(:location) { location },
|
5584
|
+
)
|
5585
|
+
end
|
5586
|
+
|
4409
5587
|
# def deconstruct: () -> Array[nil | Node]
|
4410
5588
|
alias deconstruct child_nodes
|
4411
5589
|
|
@@ -4445,6 +5623,13 @@ module YARP
|
|
4445
5623
|
[]
|
4446
5624
|
end
|
4447
5625
|
|
5626
|
+
# def copy: (**params) -> NumberedReferenceReadNode
|
5627
|
+
def copy(**params)
|
5628
|
+
NumberedReferenceReadNode.new(
|
5629
|
+
params.fetch(:location) { location },
|
5630
|
+
)
|
5631
|
+
end
|
5632
|
+
|
4448
5633
|
# def deconstruct: () -> Array[nil | Node]
|
4449
5634
|
alias deconstruct child_nodes
|
4450
5635
|
|
@@ -4491,6 +5676,17 @@ module YARP
|
|
4491
5676
|
[value]
|
4492
5677
|
end
|
4493
5678
|
|
5679
|
+
# def copy: (**params) -> OptionalParameterNode
|
5680
|
+
def copy(**params)
|
5681
|
+
OptionalParameterNode.new(
|
5682
|
+
params.fetch(:constant_id) { constant_id },
|
5683
|
+
params.fetch(:name_loc) { name_loc },
|
5684
|
+
params.fetch(:operator_loc) { operator_loc },
|
5685
|
+
params.fetch(:value) { value },
|
5686
|
+
params.fetch(:location) { location },
|
5687
|
+
)
|
5688
|
+
end
|
5689
|
+
|
4494
5690
|
# def deconstruct: () -> Array[nil | Node]
|
4495
5691
|
alias deconstruct child_nodes
|
4496
5692
|
|
@@ -4542,6 +5738,16 @@ module YARP
|
|
4542
5738
|
[left, right]
|
4543
5739
|
end
|
4544
5740
|
|
5741
|
+
# def copy: (**params) -> OrNode
|
5742
|
+
def copy(**params)
|
5743
|
+
OrNode.new(
|
5744
|
+
params.fetch(:left) { left },
|
5745
|
+
params.fetch(:right) { right },
|
5746
|
+
params.fetch(:operator_loc) { operator_loc },
|
5747
|
+
params.fetch(:location) { location },
|
5748
|
+
)
|
5749
|
+
end
|
5750
|
+
|
4545
5751
|
# def deconstruct: () -> Array[nil | Node]
|
4546
5752
|
alias deconstruct child_nodes
|
4547
5753
|
|
@@ -4571,7 +5777,7 @@ module YARP
|
|
4571
5777
|
# attr_reader posts: Array[Node]
|
4572
5778
|
attr_reader :posts
|
4573
5779
|
|
4574
|
-
# attr_reader rest:
|
5780
|
+
# attr_reader rest: RestParameterNode?
|
4575
5781
|
attr_reader :rest
|
4576
5782
|
|
4577
5783
|
# attr_reader keywords: Array[Node]
|
@@ -4580,10 +5786,10 @@ module YARP
|
|
4580
5786
|
# attr_reader keyword_rest: Node?
|
4581
5787
|
attr_reader :keyword_rest
|
4582
5788
|
|
4583
|
-
# attr_reader block:
|
5789
|
+
# attr_reader block: BlockParameterNode?
|
4584
5790
|
attr_reader :block
|
4585
5791
|
|
4586
|
-
# def initialize: (requireds: Array[Node], optionals: Array[Node], posts: Array[Node], rest:
|
5792
|
+
# def initialize: (requireds: Array[Node], optionals: Array[Node], posts: Array[Node], rest: RestParameterNode?, keywords: Array[Node], keyword_rest: Node?, block: BlockParameterNode?, location: Location) -> void
|
4587
5793
|
def initialize(requireds, optionals, posts, rest, keywords, keyword_rest, block, location)
|
4588
5794
|
@requireds = requireds
|
4589
5795
|
@optionals = optionals
|
@@ -4605,6 +5811,20 @@ module YARP
|
|
4605
5811
|
[*requireds, *optionals, *posts, rest, *keywords, keyword_rest, block]
|
4606
5812
|
end
|
4607
5813
|
|
5814
|
+
# def copy: (**params) -> ParametersNode
|
5815
|
+
def copy(**params)
|
5816
|
+
ParametersNode.new(
|
5817
|
+
params.fetch(:requireds) { requireds },
|
5818
|
+
params.fetch(:optionals) { optionals },
|
5819
|
+
params.fetch(:posts) { posts },
|
5820
|
+
params.fetch(:rest) { rest },
|
5821
|
+
params.fetch(:keywords) { keywords },
|
5822
|
+
params.fetch(:keyword_rest) { keyword_rest },
|
5823
|
+
params.fetch(:block) { block },
|
5824
|
+
params.fetch(:location) { location },
|
5825
|
+
)
|
5826
|
+
end
|
5827
|
+
|
4608
5828
|
# def deconstruct: () -> Array[nil | Node]
|
4609
5829
|
alias deconstruct child_nodes
|
4610
5830
|
|
@@ -4619,8 +5839,8 @@ module YARP
|
|
4619
5839
|
# (10 + 34)
|
4620
5840
|
# ^^^^^^^^^
|
4621
5841
|
class ParenthesesNode < Node
|
4622
|
-
# attr_reader
|
4623
|
-
attr_reader :
|
5842
|
+
# attr_reader body: Node?
|
5843
|
+
attr_reader :body
|
4624
5844
|
|
4625
5845
|
# attr_reader opening_loc: Location
|
4626
5846
|
attr_reader :opening_loc
|
@@ -4628,9 +5848,9 @@ module YARP
|
|
4628
5848
|
# attr_reader closing_loc: Location
|
4629
5849
|
attr_reader :closing_loc
|
4630
5850
|
|
4631
|
-
# def initialize: (
|
4632
|
-
def initialize(
|
4633
|
-
@
|
5851
|
+
# def initialize: (body: Node?, opening_loc: Location, closing_loc: Location, location: Location) -> void
|
5852
|
+
def initialize(body, opening_loc, closing_loc, location)
|
5853
|
+
@body = body
|
4634
5854
|
@opening_loc = opening_loc
|
4635
5855
|
@closing_loc = closing_loc
|
4636
5856
|
@location = location
|
@@ -4647,7 +5867,17 @@ module YARP
|
|
4647
5867
|
|
4648
5868
|
# def child_nodes: () -> Array[nil | Node]
|
4649
5869
|
def child_nodes
|
4650
|
-
[
|
5870
|
+
[body]
|
5871
|
+
end
|
5872
|
+
|
5873
|
+
# def copy: (**params) -> ParenthesesNode
|
5874
|
+
def copy(**params)
|
5875
|
+
ParenthesesNode.new(
|
5876
|
+
params.fetch(:body) { body },
|
5877
|
+
params.fetch(:opening_loc) { opening_loc },
|
5878
|
+
params.fetch(:closing_loc) { closing_loc },
|
5879
|
+
params.fetch(:location) { location },
|
5880
|
+
)
|
4651
5881
|
end
|
4652
5882
|
|
4653
5883
|
# def deconstruct: () -> Array[nil | Node]
|
@@ -4655,7 +5885,7 @@ module YARP
|
|
4655
5885
|
|
4656
5886
|
# def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
|
4657
5887
|
def deconstruct_keys(keys)
|
4658
|
-
{
|
5888
|
+
{ body: body, opening_loc: opening_loc, closing_loc: closing_loc, location: location }
|
4659
5889
|
end
|
4660
5890
|
|
4661
5891
|
# def opening: () -> String
|
@@ -4706,6 +5936,17 @@ module YARP
|
|
4706
5936
|
[expression]
|
4707
5937
|
end
|
4708
5938
|
|
5939
|
+
# def copy: (**params) -> PinnedExpressionNode
|
5940
|
+
def copy(**params)
|
5941
|
+
PinnedExpressionNode.new(
|
5942
|
+
params.fetch(:expression) { expression },
|
5943
|
+
params.fetch(:operator_loc) { operator_loc },
|
5944
|
+
params.fetch(:lparen_loc) { lparen_loc },
|
5945
|
+
params.fetch(:rparen_loc) { rparen_loc },
|
5946
|
+
params.fetch(:location) { location },
|
5947
|
+
)
|
5948
|
+
end
|
5949
|
+
|
4709
5950
|
# def deconstruct: () -> Array[nil | Node]
|
4710
5951
|
alias deconstruct child_nodes
|
4711
5952
|
|
@@ -4759,6 +6000,15 @@ module YARP
|
|
4759
6000
|
[variable]
|
4760
6001
|
end
|
4761
6002
|
|
6003
|
+
# def copy: (**params) -> PinnedVariableNode
|
6004
|
+
def copy(**params)
|
6005
|
+
PinnedVariableNode.new(
|
6006
|
+
params.fetch(:variable) { variable },
|
6007
|
+
params.fetch(:operator_loc) { operator_loc },
|
6008
|
+
params.fetch(:location) { location },
|
6009
|
+
)
|
6010
|
+
end
|
6011
|
+
|
4762
6012
|
# def deconstruct: () -> Array[nil | Node]
|
4763
6013
|
alias deconstruct child_nodes
|
4764
6014
|
|
@@ -4778,7 +6028,7 @@ module YARP
|
|
4778
6028
|
# END { foo }
|
4779
6029
|
# ^^^^^^^^^^^
|
4780
6030
|
class PostExecutionNode < Node
|
4781
|
-
# attr_reader statements:
|
6031
|
+
# attr_reader statements: StatementsNode?
|
4782
6032
|
attr_reader :statements
|
4783
6033
|
|
4784
6034
|
# attr_reader keyword_loc: Location
|
@@ -4790,7 +6040,7 @@ module YARP
|
|
4790
6040
|
# attr_reader closing_loc: Location
|
4791
6041
|
attr_reader :closing_loc
|
4792
6042
|
|
4793
|
-
# def initialize: (statements:
|
6043
|
+
# def initialize: (statements: StatementsNode?, keyword_loc: Location, opening_loc: Location, closing_loc: Location, location: Location) -> void
|
4794
6044
|
def initialize(statements, keyword_loc, opening_loc, closing_loc, location)
|
4795
6045
|
@statements = statements
|
4796
6046
|
@keyword_loc = keyword_loc
|
@@ -4809,6 +6059,17 @@ module YARP
|
|
4809
6059
|
[statements]
|
4810
6060
|
end
|
4811
6061
|
|
6062
|
+
# def copy: (**params) -> PostExecutionNode
|
6063
|
+
def copy(**params)
|
6064
|
+
PostExecutionNode.new(
|
6065
|
+
params.fetch(:statements) { statements },
|
6066
|
+
params.fetch(:keyword_loc) { keyword_loc },
|
6067
|
+
params.fetch(:opening_loc) { opening_loc },
|
6068
|
+
params.fetch(:closing_loc) { closing_loc },
|
6069
|
+
params.fetch(:location) { location },
|
6070
|
+
)
|
6071
|
+
end
|
6072
|
+
|
4812
6073
|
# def deconstruct: () -> Array[nil | Node]
|
4813
6074
|
alias deconstruct child_nodes
|
4814
6075
|
|
@@ -4838,7 +6099,7 @@ module YARP
|
|
4838
6099
|
# BEGIN { foo }
|
4839
6100
|
# ^^^^^^^^^^^^^
|
4840
6101
|
class PreExecutionNode < Node
|
4841
|
-
# attr_reader statements:
|
6102
|
+
# attr_reader statements: StatementsNode?
|
4842
6103
|
attr_reader :statements
|
4843
6104
|
|
4844
6105
|
# attr_reader keyword_loc: Location
|
@@ -4850,7 +6111,7 @@ module YARP
|
|
4850
6111
|
# attr_reader closing_loc: Location
|
4851
6112
|
attr_reader :closing_loc
|
4852
6113
|
|
4853
|
-
# def initialize: (statements:
|
6114
|
+
# def initialize: (statements: StatementsNode?, keyword_loc: Location, opening_loc: Location, closing_loc: Location, location: Location) -> void
|
4854
6115
|
def initialize(statements, keyword_loc, opening_loc, closing_loc, location)
|
4855
6116
|
@statements = statements
|
4856
6117
|
@keyword_loc = keyword_loc
|
@@ -4869,6 +6130,17 @@ module YARP
|
|
4869
6130
|
[statements]
|
4870
6131
|
end
|
4871
6132
|
|
6133
|
+
# def copy: (**params) -> PreExecutionNode
|
6134
|
+
def copy(**params)
|
6135
|
+
PreExecutionNode.new(
|
6136
|
+
params.fetch(:statements) { statements },
|
6137
|
+
params.fetch(:keyword_loc) { keyword_loc },
|
6138
|
+
params.fetch(:opening_loc) { opening_loc },
|
6139
|
+
params.fetch(:closing_loc) { closing_loc },
|
6140
|
+
params.fetch(:location) { location },
|
6141
|
+
)
|
6142
|
+
end
|
6143
|
+
|
4872
6144
|
# def deconstruct: () -> Array[nil | Node]
|
4873
6145
|
alias deconstruct child_nodes
|
4874
6146
|
|
@@ -4898,10 +6170,10 @@ module YARP
|
|
4898
6170
|
# attr_reader locals: Array[Symbol]
|
4899
6171
|
attr_reader :locals
|
4900
6172
|
|
4901
|
-
# attr_reader statements:
|
6173
|
+
# attr_reader statements: StatementsNode
|
4902
6174
|
attr_reader :statements
|
4903
6175
|
|
4904
|
-
# def initialize: (locals: Array[Symbol], statements:
|
6176
|
+
# def initialize: (locals: Array[Symbol], statements: StatementsNode, location: Location) -> void
|
4905
6177
|
def initialize(locals, statements, location)
|
4906
6178
|
@locals = locals
|
4907
6179
|
@statements = statements
|
@@ -4918,6 +6190,15 @@ module YARP
|
|
4918
6190
|
[statements]
|
4919
6191
|
end
|
4920
6192
|
|
6193
|
+
# def copy: (**params) -> ProgramNode
|
6194
|
+
def copy(**params)
|
6195
|
+
ProgramNode.new(
|
6196
|
+
params.fetch(:locals) { locals },
|
6197
|
+
params.fetch(:statements) { statements },
|
6198
|
+
params.fetch(:location) { location },
|
6199
|
+
)
|
6200
|
+
end
|
6201
|
+
|
4921
6202
|
# def deconstruct: () -> Array[nil | Node]
|
4922
6203
|
alias deconstruct child_nodes
|
4923
6204
|
|
@@ -4966,6 +6247,17 @@ module YARP
|
|
4966
6247
|
[left, right]
|
4967
6248
|
end
|
4968
6249
|
|
6250
|
+
# def copy: (**params) -> RangeNode
|
6251
|
+
def copy(**params)
|
6252
|
+
RangeNode.new(
|
6253
|
+
params.fetch(:left) { left },
|
6254
|
+
params.fetch(:right) { right },
|
6255
|
+
params.fetch(:operator_loc) { operator_loc },
|
6256
|
+
params.fetch(:flags) { flags },
|
6257
|
+
params.fetch(:location) { location },
|
6258
|
+
)
|
6259
|
+
end
|
6260
|
+
|
4969
6261
|
# def deconstruct: () -> Array[nil | Node]
|
4970
6262
|
alias deconstruct child_nodes
|
4971
6263
|
|
@@ -5009,6 +6301,14 @@ module YARP
|
|
5009
6301
|
[numeric]
|
5010
6302
|
end
|
5011
6303
|
|
6304
|
+
# def copy: (**params) -> RationalNode
|
6305
|
+
def copy(**params)
|
6306
|
+
RationalNode.new(
|
6307
|
+
params.fetch(:numeric) { numeric },
|
6308
|
+
params.fetch(:location) { location },
|
6309
|
+
)
|
6310
|
+
end
|
6311
|
+
|
5012
6312
|
# def deconstruct: () -> Array[nil | Node]
|
5013
6313
|
alias deconstruct child_nodes
|
5014
6314
|
|
@@ -5038,6 +6338,13 @@ module YARP
|
|
5038
6338
|
[]
|
5039
6339
|
end
|
5040
6340
|
|
6341
|
+
# def copy: (**params) -> RedoNode
|
6342
|
+
def copy(**params)
|
6343
|
+
RedoNode.new(
|
6344
|
+
params.fetch(:location) { location },
|
6345
|
+
)
|
6346
|
+
end
|
6347
|
+
|
5041
6348
|
# def deconstruct: () -> Array[nil | Node]
|
5042
6349
|
alias deconstruct child_nodes
|
5043
6350
|
|
@@ -5087,6 +6394,18 @@ module YARP
|
|
5087
6394
|
[]
|
5088
6395
|
end
|
5089
6396
|
|
6397
|
+
# def copy: (**params) -> RegularExpressionNode
|
6398
|
+
def copy(**params)
|
6399
|
+
RegularExpressionNode.new(
|
6400
|
+
params.fetch(:opening_loc) { opening_loc },
|
6401
|
+
params.fetch(:content_loc) { content_loc },
|
6402
|
+
params.fetch(:closing_loc) { closing_loc },
|
6403
|
+
params.fetch(:unescaped) { unescaped },
|
6404
|
+
params.fetch(:flags) { flags },
|
6405
|
+
params.fetch(:location) { location },
|
6406
|
+
)
|
6407
|
+
end
|
6408
|
+
|
5090
6409
|
# def deconstruct: () -> Array[nil | Node]
|
5091
6410
|
alias deconstruct child_nodes
|
5092
6411
|
|
@@ -5184,6 +6503,16 @@ module YARP
|
|
5184
6503
|
[*parameters]
|
5185
6504
|
end
|
5186
6505
|
|
6506
|
+
# def copy: (**params) -> RequiredDestructuredParameterNode
|
6507
|
+
def copy(**params)
|
6508
|
+
RequiredDestructuredParameterNode.new(
|
6509
|
+
params.fetch(:parameters) { parameters },
|
6510
|
+
params.fetch(:opening_loc) { opening_loc },
|
6511
|
+
params.fetch(:closing_loc) { closing_loc },
|
6512
|
+
params.fetch(:location) { location },
|
6513
|
+
)
|
6514
|
+
end
|
6515
|
+
|
5187
6516
|
# def deconstruct: () -> Array[nil | Node]
|
5188
6517
|
alias deconstruct child_nodes
|
5189
6518
|
|
@@ -5228,6 +6557,14 @@ module YARP
|
|
5228
6557
|
[]
|
5229
6558
|
end
|
5230
6559
|
|
6560
|
+
# def copy: (**params) -> RequiredParameterNode
|
6561
|
+
def copy(**params)
|
6562
|
+
RequiredParameterNode.new(
|
6563
|
+
params.fetch(:constant_id) { constant_id },
|
6564
|
+
params.fetch(:location) { location },
|
6565
|
+
)
|
6566
|
+
end
|
6567
|
+
|
5231
6568
|
# def deconstruct: () -> Array[nil | Node]
|
5232
6569
|
alias deconstruct child_nodes
|
5233
6570
|
|
@@ -5273,6 +6610,16 @@ module YARP
|
|
5273
6610
|
[expression, rescue_expression]
|
5274
6611
|
end
|
5275
6612
|
|
6613
|
+
# def copy: (**params) -> RescueModifierNode
|
6614
|
+
def copy(**params)
|
6615
|
+
RescueModifierNode.new(
|
6616
|
+
params.fetch(:expression) { expression },
|
6617
|
+
params.fetch(:keyword_loc) { keyword_loc },
|
6618
|
+
params.fetch(:rescue_expression) { rescue_expression },
|
6619
|
+
params.fetch(:location) { location },
|
6620
|
+
)
|
6621
|
+
end
|
6622
|
+
|
5276
6623
|
# def deconstruct: () -> Array[nil | Node]
|
5277
6624
|
alias deconstruct child_nodes
|
5278
6625
|
|
@@ -5310,13 +6657,13 @@ module YARP
|
|
5310
6657
|
# attr_reader reference: Node?
|
5311
6658
|
attr_reader :reference
|
5312
6659
|
|
5313
|
-
# attr_reader statements:
|
6660
|
+
# attr_reader statements: StatementsNode?
|
5314
6661
|
attr_reader :statements
|
5315
6662
|
|
5316
|
-
# attr_reader consequent:
|
6663
|
+
# attr_reader consequent: RescueNode?
|
5317
6664
|
attr_reader :consequent
|
5318
6665
|
|
5319
|
-
# def initialize: (keyword_loc: Location, exceptions: Array[Node], operator_loc: Location?, reference: Node?, statements:
|
6666
|
+
# def initialize: (keyword_loc: Location, exceptions: Array[Node], operator_loc: Location?, reference: Node?, statements: StatementsNode?, consequent: RescueNode?, location: Location) -> void
|
5320
6667
|
def initialize(keyword_loc, exceptions, operator_loc, reference, statements, consequent, location)
|
5321
6668
|
@keyword_loc = keyword_loc
|
5322
6669
|
@exceptions = exceptions
|
@@ -5337,6 +6684,19 @@ module YARP
|
|
5337
6684
|
[*exceptions, reference, statements, consequent]
|
5338
6685
|
end
|
5339
6686
|
|
6687
|
+
# def copy: (**params) -> RescueNode
|
6688
|
+
def copy(**params)
|
6689
|
+
RescueNode.new(
|
6690
|
+
params.fetch(:keyword_loc) { keyword_loc },
|
6691
|
+
params.fetch(:exceptions) { exceptions },
|
6692
|
+
params.fetch(:operator_loc) { operator_loc },
|
6693
|
+
params.fetch(:reference) { reference },
|
6694
|
+
params.fetch(:statements) { statements },
|
6695
|
+
params.fetch(:consequent) { consequent },
|
6696
|
+
params.fetch(:location) { location },
|
6697
|
+
)
|
6698
|
+
end
|
6699
|
+
|
5340
6700
|
# def deconstruct: () -> Array[nil | Node]
|
5341
6701
|
alias deconstruct child_nodes
|
5342
6702
|
|
@@ -5385,6 +6745,15 @@ module YARP
|
|
5385
6745
|
[]
|
5386
6746
|
end
|
5387
6747
|
|
6748
|
+
# def copy: (**params) -> RestParameterNode
|
6749
|
+
def copy(**params)
|
6750
|
+
RestParameterNode.new(
|
6751
|
+
params.fetch(:operator_loc) { operator_loc },
|
6752
|
+
params.fetch(:name_loc) { name_loc },
|
6753
|
+
params.fetch(:location) { location },
|
6754
|
+
)
|
6755
|
+
end
|
6756
|
+
|
5388
6757
|
# def deconstruct: () -> Array[nil | Node]
|
5389
6758
|
alias deconstruct child_nodes
|
5390
6759
|
|
@@ -5424,6 +6793,13 @@ module YARP
|
|
5424
6793
|
[]
|
5425
6794
|
end
|
5426
6795
|
|
6796
|
+
# def copy: (**params) -> RetryNode
|
6797
|
+
def copy(**params)
|
6798
|
+
RetryNode.new(
|
6799
|
+
params.fetch(:location) { location },
|
6800
|
+
)
|
6801
|
+
end
|
6802
|
+
|
5427
6803
|
# def deconstruct: () -> Array[nil | Node]
|
5428
6804
|
alias deconstruct child_nodes
|
5429
6805
|
|
@@ -5441,10 +6817,10 @@ module YARP
|
|
5441
6817
|
# attr_reader keyword_loc: Location
|
5442
6818
|
attr_reader :keyword_loc
|
5443
6819
|
|
5444
|
-
# attr_reader arguments:
|
6820
|
+
# attr_reader arguments: ArgumentsNode?
|
5445
6821
|
attr_reader :arguments
|
5446
6822
|
|
5447
|
-
# def initialize: (keyword_loc: Location, arguments:
|
6823
|
+
# def initialize: (keyword_loc: Location, arguments: ArgumentsNode?, location: Location) -> void
|
5448
6824
|
def initialize(keyword_loc, arguments, location)
|
5449
6825
|
@keyword_loc = keyword_loc
|
5450
6826
|
@arguments = arguments
|
@@ -5461,6 +6837,15 @@ module YARP
|
|
5461
6837
|
[arguments]
|
5462
6838
|
end
|
5463
6839
|
|
6840
|
+
# def copy: (**params) -> ReturnNode
|
6841
|
+
def copy(**params)
|
6842
|
+
ReturnNode.new(
|
6843
|
+
params.fetch(:keyword_loc) { keyword_loc },
|
6844
|
+
params.fetch(:arguments) { arguments },
|
6845
|
+
params.fetch(:location) { location },
|
6846
|
+
)
|
6847
|
+
end
|
6848
|
+
|
5464
6849
|
# def deconstruct: () -> Array[nil | Node]
|
5465
6850
|
alias deconstruct child_nodes
|
5466
6851
|
|
@@ -5495,6 +6880,13 @@ module YARP
|
|
5495
6880
|
[]
|
5496
6881
|
end
|
5497
6882
|
|
6883
|
+
# def copy: (**params) -> SelfNode
|
6884
|
+
def copy(**params)
|
6885
|
+
SelfNode.new(
|
6886
|
+
params.fetch(:location) { location },
|
6887
|
+
)
|
6888
|
+
end
|
6889
|
+
|
5498
6890
|
# def deconstruct: () -> Array[nil | Node]
|
5499
6891
|
alias deconstruct child_nodes
|
5500
6892
|
|
@@ -5521,19 +6913,19 @@ module YARP
|
|
5521
6913
|
# attr_reader expression: Node
|
5522
6914
|
attr_reader :expression
|
5523
6915
|
|
5524
|
-
# attr_reader
|
5525
|
-
attr_reader :
|
6916
|
+
# attr_reader body: Node?
|
6917
|
+
attr_reader :body
|
5526
6918
|
|
5527
6919
|
# attr_reader end_keyword_loc: Location
|
5528
6920
|
attr_reader :end_keyword_loc
|
5529
6921
|
|
5530
|
-
# def initialize: (locals: Array[Symbol], class_keyword_loc: Location, operator_loc: Location, expression: Node,
|
5531
|
-
def initialize(locals, class_keyword_loc, operator_loc, expression,
|
6922
|
+
# def initialize: (locals: Array[Symbol], class_keyword_loc: Location, operator_loc: Location, expression: Node, body: Node?, end_keyword_loc: Location, location: Location) -> void
|
6923
|
+
def initialize(locals, class_keyword_loc, operator_loc, expression, body, end_keyword_loc, location)
|
5532
6924
|
@locals = locals
|
5533
6925
|
@class_keyword_loc = class_keyword_loc
|
5534
6926
|
@operator_loc = operator_loc
|
5535
6927
|
@expression = expression
|
5536
|
-
@
|
6928
|
+
@body = body
|
5537
6929
|
@end_keyword_loc = end_keyword_loc
|
5538
6930
|
@location = location
|
5539
6931
|
end
|
@@ -5545,7 +6937,20 @@ module YARP
|
|
5545
6937
|
|
5546
6938
|
# def child_nodes: () -> Array[nil | Node]
|
5547
6939
|
def child_nodes
|
5548
|
-
[expression,
|
6940
|
+
[expression, body]
|
6941
|
+
end
|
6942
|
+
|
6943
|
+
# def copy: (**params) -> SingletonClassNode
|
6944
|
+
def copy(**params)
|
6945
|
+
SingletonClassNode.new(
|
6946
|
+
params.fetch(:locals) { locals },
|
6947
|
+
params.fetch(:class_keyword_loc) { class_keyword_loc },
|
6948
|
+
params.fetch(:operator_loc) { operator_loc },
|
6949
|
+
params.fetch(:expression) { expression },
|
6950
|
+
params.fetch(:body) { body },
|
6951
|
+
params.fetch(:end_keyword_loc) { end_keyword_loc },
|
6952
|
+
params.fetch(:location) { location },
|
6953
|
+
)
|
5549
6954
|
end
|
5550
6955
|
|
5551
6956
|
# def deconstruct: () -> Array[nil | Node]
|
@@ -5553,7 +6958,7 @@ module YARP
|
|
5553
6958
|
|
5554
6959
|
# def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
|
5555
6960
|
def deconstruct_keys(keys)
|
5556
|
-
{ locals: locals, class_keyword_loc: class_keyword_loc, operator_loc: operator_loc, expression: expression,
|
6961
|
+
{ locals: locals, class_keyword_loc: class_keyword_loc, operator_loc: operator_loc, expression: expression, body: body, end_keyword_loc: end_keyword_loc, location: location }
|
5557
6962
|
end
|
5558
6963
|
|
5559
6964
|
# def class_keyword: () -> String
|
@@ -5592,6 +6997,13 @@ module YARP
|
|
5592
6997
|
[]
|
5593
6998
|
end
|
5594
6999
|
|
7000
|
+
# def copy: (**params) -> SourceEncodingNode
|
7001
|
+
def copy(**params)
|
7002
|
+
SourceEncodingNode.new(
|
7003
|
+
params.fetch(:location) { location },
|
7004
|
+
)
|
7005
|
+
end
|
7006
|
+
|
5595
7007
|
# def deconstruct: () -> Array[nil | Node]
|
5596
7008
|
alias deconstruct child_nodes
|
5597
7009
|
|
@@ -5625,6 +7037,14 @@ module YARP
|
|
5625
7037
|
[]
|
5626
7038
|
end
|
5627
7039
|
|
7040
|
+
# def copy: (**params) -> SourceFileNode
|
7041
|
+
def copy(**params)
|
7042
|
+
SourceFileNode.new(
|
7043
|
+
params.fetch(:filepath) { filepath },
|
7044
|
+
params.fetch(:location) { location },
|
7045
|
+
)
|
7046
|
+
end
|
7047
|
+
|
5628
7048
|
# def deconstruct: () -> Array[nil | Node]
|
5629
7049
|
alias deconstruct child_nodes
|
5630
7050
|
|
@@ -5654,6 +7074,13 @@ module YARP
|
|
5654
7074
|
[]
|
5655
7075
|
end
|
5656
7076
|
|
7077
|
+
# def copy: (**params) -> SourceLineNode
|
7078
|
+
def copy(**params)
|
7079
|
+
SourceLineNode.new(
|
7080
|
+
params.fetch(:location) { location },
|
7081
|
+
)
|
7082
|
+
end
|
7083
|
+
|
5657
7084
|
# def deconstruct: () -> Array[nil | Node]
|
5658
7085
|
alias deconstruct child_nodes
|
5659
7086
|
|
@@ -5691,6 +7118,15 @@ module YARP
|
|
5691
7118
|
[expression]
|
5692
7119
|
end
|
5693
7120
|
|
7121
|
+
# def copy: (**params) -> SplatNode
|
7122
|
+
def copy(**params)
|
7123
|
+
SplatNode.new(
|
7124
|
+
params.fetch(:operator_loc) { operator_loc },
|
7125
|
+
params.fetch(:expression) { expression },
|
7126
|
+
params.fetch(:location) { location },
|
7127
|
+
)
|
7128
|
+
end
|
7129
|
+
|
5694
7130
|
# def deconstruct: () -> Array[nil | Node]
|
5695
7131
|
alias deconstruct child_nodes
|
5696
7132
|
|
@@ -5729,6 +7165,14 @@ module YARP
|
|
5729
7165
|
[*body]
|
5730
7166
|
end
|
5731
7167
|
|
7168
|
+
# def copy: (**params) -> StatementsNode
|
7169
|
+
def copy(**params)
|
7170
|
+
StatementsNode.new(
|
7171
|
+
params.fetch(:body) { body },
|
7172
|
+
params.fetch(:location) { location },
|
7173
|
+
)
|
7174
|
+
end
|
7175
|
+
|
5732
7176
|
# def deconstruct: () -> Array[nil | Node]
|
5733
7177
|
alias deconstruct child_nodes
|
5734
7178
|
|
@@ -5766,6 +7210,15 @@ module YARP
|
|
5766
7210
|
[left, right]
|
5767
7211
|
end
|
5768
7212
|
|
7213
|
+
# def copy: (**params) -> StringConcatNode
|
7214
|
+
def copy(**params)
|
7215
|
+
StringConcatNode.new(
|
7216
|
+
params.fetch(:left) { left },
|
7217
|
+
params.fetch(:right) { right },
|
7218
|
+
params.fetch(:location) { location },
|
7219
|
+
)
|
7220
|
+
end
|
7221
|
+
|
5769
7222
|
# def deconstruct: () -> Array[nil | Node]
|
5770
7223
|
alias deconstruct child_nodes
|
5771
7224
|
|
@@ -5818,6 +7271,17 @@ module YARP
|
|
5818
7271
|
[]
|
5819
7272
|
end
|
5820
7273
|
|
7274
|
+
# def copy: (**params) -> StringNode
|
7275
|
+
def copy(**params)
|
7276
|
+
StringNode.new(
|
7277
|
+
params.fetch(:opening_loc) { opening_loc },
|
7278
|
+
params.fetch(:content_loc) { content_loc },
|
7279
|
+
params.fetch(:closing_loc) { closing_loc },
|
7280
|
+
params.fetch(:unescaped) { unescaped },
|
7281
|
+
params.fetch(:location) { location },
|
7282
|
+
)
|
7283
|
+
end
|
7284
|
+
|
5821
7285
|
# def deconstruct: () -> Array[nil | Node]
|
5822
7286
|
alias deconstruct child_nodes
|
5823
7287
|
|
@@ -5856,16 +7320,16 @@ module YARP
|
|
5856
7320
|
# attr_reader lparen_loc: Location?
|
5857
7321
|
attr_reader :lparen_loc
|
5858
7322
|
|
5859
|
-
# attr_reader arguments:
|
7323
|
+
# attr_reader arguments: ArgumentsNode?
|
5860
7324
|
attr_reader :arguments
|
5861
7325
|
|
5862
7326
|
# attr_reader rparen_loc: Location?
|
5863
7327
|
attr_reader :rparen_loc
|
5864
7328
|
|
5865
|
-
# attr_reader block:
|
7329
|
+
# attr_reader block: BlockNode?
|
5866
7330
|
attr_reader :block
|
5867
7331
|
|
5868
|
-
# def initialize: (keyword_loc: Location, lparen_loc: Location?, arguments:
|
7332
|
+
# def initialize: (keyword_loc: Location, lparen_loc: Location?, arguments: ArgumentsNode?, rparen_loc: Location?, block: BlockNode?, location: Location) -> void
|
5869
7333
|
def initialize(keyword_loc, lparen_loc, arguments, rparen_loc, block, location)
|
5870
7334
|
@keyword_loc = keyword_loc
|
5871
7335
|
@lparen_loc = lparen_loc
|
@@ -5885,6 +7349,18 @@ module YARP
|
|
5885
7349
|
[arguments, block]
|
5886
7350
|
end
|
5887
7351
|
|
7352
|
+
# def copy: (**params) -> SuperNode
|
7353
|
+
def copy(**params)
|
7354
|
+
SuperNode.new(
|
7355
|
+
params.fetch(:keyword_loc) { keyword_loc },
|
7356
|
+
params.fetch(:lparen_loc) { lparen_loc },
|
7357
|
+
params.fetch(:arguments) { arguments },
|
7358
|
+
params.fetch(:rparen_loc) { rparen_loc },
|
7359
|
+
params.fetch(:block) { block },
|
7360
|
+
params.fetch(:location) { location },
|
7361
|
+
)
|
7362
|
+
end
|
7363
|
+
|
5888
7364
|
# def deconstruct: () -> Array[nil | Node]
|
5889
7365
|
alias deconstruct child_nodes
|
5890
7366
|
|
@@ -5920,7 +7396,7 @@ module YARP
|
|
5920
7396
|
# attr_reader opening_loc: Location?
|
5921
7397
|
attr_reader :opening_loc
|
5922
7398
|
|
5923
|
-
# attr_reader value_loc: Location
|
7399
|
+
# attr_reader value_loc: Location?
|
5924
7400
|
attr_reader :value_loc
|
5925
7401
|
|
5926
7402
|
# attr_reader closing_loc: Location?
|
@@ -5929,7 +7405,7 @@ module YARP
|
|
5929
7405
|
# attr_reader unescaped: String
|
5930
7406
|
attr_reader :unescaped
|
5931
7407
|
|
5932
|
-
# def initialize: (opening_loc: Location?, value_loc: Location
|
7408
|
+
# def initialize: (opening_loc: Location?, value_loc: Location?, closing_loc: Location?, unescaped: String, location: Location) -> void
|
5933
7409
|
def initialize(opening_loc, value_loc, closing_loc, unescaped, location)
|
5934
7410
|
@opening_loc = opening_loc
|
5935
7411
|
@value_loc = value_loc
|
@@ -5948,6 +7424,17 @@ module YARP
|
|
5948
7424
|
[]
|
5949
7425
|
end
|
5950
7426
|
|
7427
|
+
# def copy: (**params) -> SymbolNode
|
7428
|
+
def copy(**params)
|
7429
|
+
SymbolNode.new(
|
7430
|
+
params.fetch(:opening_loc) { opening_loc },
|
7431
|
+
params.fetch(:value_loc) { value_loc },
|
7432
|
+
params.fetch(:closing_loc) { closing_loc },
|
7433
|
+
params.fetch(:unescaped) { unescaped },
|
7434
|
+
params.fetch(:location) { location },
|
7435
|
+
)
|
7436
|
+
end
|
7437
|
+
|
5951
7438
|
# def deconstruct: () -> Array[nil | Node]
|
5952
7439
|
alias deconstruct child_nodes
|
5953
7440
|
|
@@ -5961,9 +7448,9 @@ module YARP
|
|
5961
7448
|
opening_loc&.slice
|
5962
7449
|
end
|
5963
7450
|
|
5964
|
-
# def value: () -> String
|
7451
|
+
# def value: () -> String?
|
5965
7452
|
def value
|
5966
|
-
value_loc
|
7453
|
+
value_loc&.slice
|
5967
7454
|
end
|
5968
7455
|
|
5969
7456
|
# def closing: () -> String?
|
@@ -5992,6 +7479,13 @@ module YARP
|
|
5992
7479
|
[]
|
5993
7480
|
end
|
5994
7481
|
|
7482
|
+
# def copy: (**params) -> TrueNode
|
7483
|
+
def copy(**params)
|
7484
|
+
TrueNode.new(
|
7485
|
+
params.fetch(:location) { location },
|
7486
|
+
)
|
7487
|
+
end
|
7488
|
+
|
5995
7489
|
# def deconstruct: () -> Array[nil | Node]
|
5996
7490
|
alias deconstruct child_nodes
|
5997
7491
|
|
@@ -6029,6 +7523,15 @@ module YARP
|
|
6029
7523
|
[*names]
|
6030
7524
|
end
|
6031
7525
|
|
7526
|
+
# def copy: (**params) -> UndefNode
|
7527
|
+
def copy(**params)
|
7528
|
+
UndefNode.new(
|
7529
|
+
params.fetch(:names) { names },
|
7530
|
+
params.fetch(:keyword_loc) { keyword_loc },
|
7531
|
+
params.fetch(:location) { location },
|
7532
|
+
)
|
7533
|
+
end
|
7534
|
+
|
6032
7535
|
# def deconstruct: () -> Array[nil | Node]
|
6033
7536
|
alias deconstruct child_nodes
|
6034
7537
|
|
@@ -6057,16 +7560,16 @@ module YARP
|
|
6057
7560
|
# attr_reader predicate: Node
|
6058
7561
|
attr_reader :predicate
|
6059
7562
|
|
6060
|
-
# attr_reader statements:
|
7563
|
+
# attr_reader statements: StatementsNode?
|
6061
7564
|
attr_reader :statements
|
6062
7565
|
|
6063
|
-
# attr_reader consequent:
|
7566
|
+
# attr_reader consequent: ElseNode?
|
6064
7567
|
attr_reader :consequent
|
6065
7568
|
|
6066
7569
|
# attr_reader end_keyword_loc: Location?
|
6067
7570
|
attr_reader :end_keyword_loc
|
6068
7571
|
|
6069
|
-
# def initialize: (keyword_loc: Location, predicate: Node, statements:
|
7572
|
+
# def initialize: (keyword_loc: Location, predicate: Node, statements: StatementsNode?, consequent: ElseNode?, end_keyword_loc: Location?, location: Location) -> void
|
6070
7573
|
def initialize(keyword_loc, predicate, statements, consequent, end_keyword_loc, location)
|
6071
7574
|
@keyword_loc = keyword_loc
|
6072
7575
|
@predicate = predicate
|
@@ -6090,6 +7593,18 @@ module YARP
|
|
6090
7593
|
[predicate, statements, consequent]
|
6091
7594
|
end
|
6092
7595
|
|
7596
|
+
# def copy: (**params) -> UnlessNode
|
7597
|
+
def copy(**params)
|
7598
|
+
UnlessNode.new(
|
7599
|
+
params.fetch(:keyword_loc) { keyword_loc },
|
7600
|
+
params.fetch(:predicate) { predicate },
|
7601
|
+
params.fetch(:statements) { statements },
|
7602
|
+
params.fetch(:consequent) { consequent },
|
7603
|
+
params.fetch(:end_keyword_loc) { end_keyword_loc },
|
7604
|
+
params.fetch(:location) { location },
|
7605
|
+
)
|
7606
|
+
end
|
7607
|
+
|
6093
7608
|
# def deconstruct: () -> Array[nil | Node]
|
6094
7609
|
alias deconstruct child_nodes
|
6095
7610
|
|
@@ -6120,18 +7635,22 @@ module YARP
|
|
6120
7635
|
# attr_reader keyword_loc: Location
|
6121
7636
|
attr_reader :keyword_loc
|
6122
7637
|
|
7638
|
+
# attr_reader closing_loc: Location?
|
7639
|
+
attr_reader :closing_loc
|
7640
|
+
|
6123
7641
|
# attr_reader predicate: Node
|
6124
7642
|
attr_reader :predicate
|
6125
7643
|
|
6126
|
-
# attr_reader statements:
|
7644
|
+
# attr_reader statements: StatementsNode?
|
6127
7645
|
attr_reader :statements
|
6128
7646
|
|
6129
7647
|
# attr_reader flags: Integer
|
6130
7648
|
attr_reader :flags
|
6131
7649
|
|
6132
|
-
# def initialize: (keyword_loc: Location, predicate: Node, statements:
|
6133
|
-
def initialize(keyword_loc, predicate, statements, flags, location)
|
7650
|
+
# def initialize: (keyword_loc: Location, closing_loc: Location?, predicate: Node, statements: StatementsNode?, flags: Integer, location: Location) -> void
|
7651
|
+
def initialize(keyword_loc, closing_loc, predicate, statements, flags, location)
|
6134
7652
|
@keyword_loc = keyword_loc
|
7653
|
+
@closing_loc = closing_loc
|
6135
7654
|
@predicate = predicate
|
6136
7655
|
@statements = statements
|
6137
7656
|
@flags = flags
|
@@ -6152,12 +7671,24 @@ module YARP
|
|
6152
7671
|
[predicate, statements]
|
6153
7672
|
end
|
6154
7673
|
|
7674
|
+
# def copy: (**params) -> UntilNode
|
7675
|
+
def copy(**params)
|
7676
|
+
UntilNode.new(
|
7677
|
+
params.fetch(:keyword_loc) { keyword_loc },
|
7678
|
+
params.fetch(:closing_loc) { closing_loc },
|
7679
|
+
params.fetch(:predicate) { predicate },
|
7680
|
+
params.fetch(:statements) { statements },
|
7681
|
+
params.fetch(:flags) { flags },
|
7682
|
+
params.fetch(:location) { location },
|
7683
|
+
)
|
7684
|
+
end
|
7685
|
+
|
6155
7686
|
# def deconstruct: () -> Array[nil | Node]
|
6156
7687
|
alias deconstruct child_nodes
|
6157
7688
|
|
6158
7689
|
# def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
|
6159
7690
|
def deconstruct_keys(keys)
|
6160
|
-
{ keyword_loc: keyword_loc, predicate: predicate, statements: statements, flags: flags, location: location }
|
7691
|
+
{ keyword_loc: keyword_loc, closing_loc: closing_loc, predicate: predicate, statements: statements, flags: flags, location: location }
|
6161
7692
|
end
|
6162
7693
|
|
6163
7694
|
# def keyword: () -> String
|
@@ -6165,16 +7696,23 @@ module YARP
|
|
6165
7696
|
keyword_loc.slice
|
6166
7697
|
end
|
6167
7698
|
|
7699
|
+
# def closing: () -> String?
|
7700
|
+
def closing
|
7701
|
+
closing_loc&.slice
|
7702
|
+
end
|
7703
|
+
|
6168
7704
|
# def begin_modifier?: () -> bool
|
6169
7705
|
def begin_modifier?
|
6170
7706
|
flags.anybits?(LoopFlags::BEGIN_MODIFIER)
|
6171
7707
|
end
|
6172
7708
|
end
|
6173
7709
|
|
6174
|
-
# case
|
6175
|
-
#
|
6176
|
-
#
|
6177
|
-
#
|
7710
|
+
# Represents the use of the `when` keyword within a case statement.
|
7711
|
+
#
|
7712
|
+
# case true
|
7713
|
+
# when true
|
7714
|
+
# ^^^^^^^^^
|
7715
|
+
# end
|
6178
7716
|
class WhenNode < Node
|
6179
7717
|
# attr_reader keyword_loc: Location
|
6180
7718
|
attr_reader :keyword_loc
|
@@ -6182,10 +7720,10 @@ module YARP
|
|
6182
7720
|
# attr_reader conditions: Array[Node]
|
6183
7721
|
attr_reader :conditions
|
6184
7722
|
|
6185
|
-
# attr_reader statements:
|
7723
|
+
# attr_reader statements: StatementsNode?
|
6186
7724
|
attr_reader :statements
|
6187
7725
|
|
6188
|
-
# def initialize: (keyword_loc: Location, conditions: Array[Node], statements:
|
7726
|
+
# def initialize: (keyword_loc: Location, conditions: Array[Node], statements: StatementsNode?, location: Location) -> void
|
6189
7727
|
def initialize(keyword_loc, conditions, statements, location)
|
6190
7728
|
@keyword_loc = keyword_loc
|
6191
7729
|
@conditions = conditions
|
@@ -6203,6 +7741,16 @@ module YARP
|
|
6203
7741
|
[*conditions, statements]
|
6204
7742
|
end
|
6205
7743
|
|
7744
|
+
# def copy: (**params) -> WhenNode
|
7745
|
+
def copy(**params)
|
7746
|
+
WhenNode.new(
|
7747
|
+
params.fetch(:keyword_loc) { keyword_loc },
|
7748
|
+
params.fetch(:conditions) { conditions },
|
7749
|
+
params.fetch(:statements) { statements },
|
7750
|
+
params.fetch(:location) { location },
|
7751
|
+
)
|
7752
|
+
end
|
7753
|
+
|
6206
7754
|
# def deconstruct: () -> Array[nil | Node]
|
6207
7755
|
alias deconstruct child_nodes
|
6208
7756
|
|
@@ -6228,18 +7776,22 @@ module YARP
|
|
6228
7776
|
# attr_reader keyword_loc: Location
|
6229
7777
|
attr_reader :keyword_loc
|
6230
7778
|
|
7779
|
+
# attr_reader closing_loc: Location?
|
7780
|
+
attr_reader :closing_loc
|
7781
|
+
|
6231
7782
|
# attr_reader predicate: Node
|
6232
7783
|
attr_reader :predicate
|
6233
7784
|
|
6234
|
-
# attr_reader statements:
|
7785
|
+
# attr_reader statements: StatementsNode?
|
6235
7786
|
attr_reader :statements
|
6236
7787
|
|
6237
7788
|
# attr_reader flags: Integer
|
6238
7789
|
attr_reader :flags
|
6239
7790
|
|
6240
|
-
# def initialize: (keyword_loc: Location, predicate: Node, statements:
|
6241
|
-
def initialize(keyword_loc, predicate, statements, flags, location)
|
7791
|
+
# def initialize: (keyword_loc: Location, closing_loc: Location?, predicate: Node, statements: StatementsNode?, flags: Integer, location: Location) -> void
|
7792
|
+
def initialize(keyword_loc, closing_loc, predicate, statements, flags, location)
|
6242
7793
|
@keyword_loc = keyword_loc
|
7794
|
+
@closing_loc = closing_loc
|
6243
7795
|
@predicate = predicate
|
6244
7796
|
@statements = statements
|
6245
7797
|
@flags = flags
|
@@ -6260,12 +7812,24 @@ module YARP
|
|
6260
7812
|
[predicate, statements]
|
6261
7813
|
end
|
6262
7814
|
|
7815
|
+
# def copy: (**params) -> WhileNode
|
7816
|
+
def copy(**params)
|
7817
|
+
WhileNode.new(
|
7818
|
+
params.fetch(:keyword_loc) { keyword_loc },
|
7819
|
+
params.fetch(:closing_loc) { closing_loc },
|
7820
|
+
params.fetch(:predicate) { predicate },
|
7821
|
+
params.fetch(:statements) { statements },
|
7822
|
+
params.fetch(:flags) { flags },
|
7823
|
+
params.fetch(:location) { location },
|
7824
|
+
)
|
7825
|
+
end
|
7826
|
+
|
6263
7827
|
# def deconstruct: () -> Array[nil | Node]
|
6264
7828
|
alias deconstruct child_nodes
|
6265
7829
|
|
6266
7830
|
# def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
|
6267
7831
|
def deconstruct_keys(keys)
|
6268
|
-
{ keyword_loc: keyword_loc, predicate: predicate, statements: statements, flags: flags, location: location }
|
7832
|
+
{ keyword_loc: keyword_loc, closing_loc: closing_loc, predicate: predicate, statements: statements, flags: flags, location: location }
|
6269
7833
|
end
|
6270
7834
|
|
6271
7835
|
# def keyword: () -> String
|
@@ -6273,6 +7837,11 @@ module YARP
|
|
6273
7837
|
keyword_loc.slice
|
6274
7838
|
end
|
6275
7839
|
|
7840
|
+
# def closing: () -> String?
|
7841
|
+
def closing
|
7842
|
+
closing_loc&.slice
|
7843
|
+
end
|
7844
|
+
|
6276
7845
|
# def begin_modifier?: () -> bool
|
6277
7846
|
def begin_modifier?
|
6278
7847
|
flags.anybits?(LoopFlags::BEGIN_MODIFIER)
|
@@ -6315,6 +7884,17 @@ module YARP
|
|
6315
7884
|
[]
|
6316
7885
|
end
|
6317
7886
|
|
7887
|
+
# def copy: (**params) -> XStringNode
|
7888
|
+
def copy(**params)
|
7889
|
+
XStringNode.new(
|
7890
|
+
params.fetch(:opening_loc) { opening_loc },
|
7891
|
+
params.fetch(:content_loc) { content_loc },
|
7892
|
+
params.fetch(:closing_loc) { closing_loc },
|
7893
|
+
params.fetch(:unescaped) { unescaped },
|
7894
|
+
params.fetch(:location) { location },
|
7895
|
+
)
|
7896
|
+
end
|
7897
|
+
|
6318
7898
|
# def deconstruct: () -> Array[nil | Node]
|
6319
7899
|
alias deconstruct child_nodes
|
6320
7900
|
|
@@ -6350,13 +7930,13 @@ module YARP
|
|
6350
7930
|
# attr_reader lparen_loc: Location?
|
6351
7931
|
attr_reader :lparen_loc
|
6352
7932
|
|
6353
|
-
# attr_reader arguments:
|
7933
|
+
# attr_reader arguments: ArgumentsNode?
|
6354
7934
|
attr_reader :arguments
|
6355
7935
|
|
6356
7936
|
# attr_reader rparen_loc: Location?
|
6357
7937
|
attr_reader :rparen_loc
|
6358
7938
|
|
6359
|
-
# def initialize: (keyword_loc: Location, lparen_loc: Location?, arguments:
|
7939
|
+
# def initialize: (keyword_loc: Location, lparen_loc: Location?, arguments: ArgumentsNode?, rparen_loc: Location?, location: Location) -> void
|
6360
7940
|
def initialize(keyword_loc, lparen_loc, arguments, rparen_loc, location)
|
6361
7941
|
@keyword_loc = keyword_loc
|
6362
7942
|
@lparen_loc = lparen_loc
|
@@ -6375,6 +7955,17 @@ module YARP
|
|
6375
7955
|
[arguments]
|
6376
7956
|
end
|
6377
7957
|
|
7958
|
+
# def copy: (**params) -> YieldNode
|
7959
|
+
def copy(**params)
|
7960
|
+
YieldNode.new(
|
7961
|
+
params.fetch(:keyword_loc) { keyword_loc },
|
7962
|
+
params.fetch(:lparen_loc) { lparen_loc },
|
7963
|
+
params.fetch(:arguments) { arguments },
|
7964
|
+
params.fetch(:rparen_loc) { rparen_loc },
|
7965
|
+
params.fetch(:location) { location },
|
7966
|
+
)
|
7967
|
+
end
|
7968
|
+
|
6378
7969
|
# def deconstruct: () -> Array[nil | Node]
|
6379
7970
|
alias deconstruct child_nodes
|
6380
7971
|
|
@@ -6510,48 +8101,57 @@ module YARP
|
|
6510
8101
|
# Visit a ClassNode node
|
6511
8102
|
alias visit_class_node visit_child_nodes
|
6512
8103
|
|
6513
|
-
# Visit a
|
6514
|
-
alias
|
6515
|
-
|
6516
|
-
# Visit a ClassVariableOperatorOrWriteNode node
|
6517
|
-
alias visit_class_variable_operator_or_write_node visit_child_nodes
|
8104
|
+
# Visit a ClassVariableAndWriteNode node
|
8105
|
+
alias visit_class_variable_and_write_node visit_child_nodes
|
6518
8106
|
|
6519
8107
|
# Visit a ClassVariableOperatorWriteNode node
|
6520
8108
|
alias visit_class_variable_operator_write_node visit_child_nodes
|
6521
8109
|
|
8110
|
+
# Visit a ClassVariableOrWriteNode node
|
8111
|
+
alias visit_class_variable_or_write_node visit_child_nodes
|
8112
|
+
|
6522
8113
|
# Visit a ClassVariableReadNode node
|
6523
8114
|
alias visit_class_variable_read_node visit_child_nodes
|
6524
8115
|
|
8116
|
+
# Visit a ClassVariableTargetNode node
|
8117
|
+
alias visit_class_variable_target_node visit_child_nodes
|
8118
|
+
|
6525
8119
|
# Visit a ClassVariableWriteNode node
|
6526
8120
|
alias visit_class_variable_write_node visit_child_nodes
|
6527
8121
|
|
6528
|
-
# Visit a
|
6529
|
-
alias
|
6530
|
-
|
6531
|
-
# Visit a ConstantOperatorOrWriteNode node
|
6532
|
-
alias visit_constant_operator_or_write_node visit_child_nodes
|
8122
|
+
# Visit a ConstantAndWriteNode node
|
8123
|
+
alias visit_constant_and_write_node visit_child_nodes
|
6533
8124
|
|
6534
8125
|
# Visit a ConstantOperatorWriteNode node
|
6535
8126
|
alias visit_constant_operator_write_node visit_child_nodes
|
6536
8127
|
|
6537
|
-
# Visit a
|
6538
|
-
alias
|
8128
|
+
# Visit a ConstantOrWriteNode node
|
8129
|
+
alias visit_constant_or_write_node visit_child_nodes
|
6539
8130
|
|
6540
|
-
# Visit a
|
6541
|
-
alias
|
8131
|
+
# Visit a ConstantPathAndWriteNode node
|
8132
|
+
alias visit_constant_path_and_write_node visit_child_nodes
|
6542
8133
|
|
6543
|
-
# Visit a
|
6544
|
-
alias
|
8134
|
+
# Visit a ConstantPathNode node
|
8135
|
+
alias visit_constant_path_node visit_child_nodes
|
6545
8136
|
|
6546
8137
|
# Visit a ConstantPathOperatorWriteNode node
|
6547
8138
|
alias visit_constant_path_operator_write_node visit_child_nodes
|
6548
8139
|
|
8140
|
+
# Visit a ConstantPathOrWriteNode node
|
8141
|
+
alias visit_constant_path_or_write_node visit_child_nodes
|
8142
|
+
|
8143
|
+
# Visit a ConstantPathTargetNode node
|
8144
|
+
alias visit_constant_path_target_node visit_child_nodes
|
8145
|
+
|
6549
8146
|
# Visit a ConstantPathWriteNode node
|
6550
8147
|
alias visit_constant_path_write_node visit_child_nodes
|
6551
8148
|
|
6552
8149
|
# Visit a ConstantReadNode node
|
6553
8150
|
alias visit_constant_read_node visit_child_nodes
|
6554
8151
|
|
8152
|
+
# Visit a ConstantTargetNode node
|
8153
|
+
alias visit_constant_target_node visit_child_nodes
|
8154
|
+
|
6555
8155
|
# Visit a ConstantWriteNode node
|
6556
8156
|
alias visit_constant_write_node visit_child_nodes
|
6557
8157
|
|
@@ -6597,18 +8197,21 @@ module YARP
|
|
6597
8197
|
# Visit a ForwardingSuperNode node
|
6598
8198
|
alias visit_forwarding_super_node visit_child_nodes
|
6599
8199
|
|
6600
|
-
# Visit a
|
6601
|
-
alias
|
6602
|
-
|
6603
|
-
# Visit a GlobalVariableOperatorOrWriteNode node
|
6604
|
-
alias visit_global_variable_operator_or_write_node visit_child_nodes
|
8200
|
+
# Visit a GlobalVariableAndWriteNode node
|
8201
|
+
alias visit_global_variable_and_write_node visit_child_nodes
|
6605
8202
|
|
6606
8203
|
# Visit a GlobalVariableOperatorWriteNode node
|
6607
8204
|
alias visit_global_variable_operator_write_node visit_child_nodes
|
6608
8205
|
|
8206
|
+
# Visit a GlobalVariableOrWriteNode node
|
8207
|
+
alias visit_global_variable_or_write_node visit_child_nodes
|
8208
|
+
|
6609
8209
|
# Visit a GlobalVariableReadNode node
|
6610
8210
|
alias visit_global_variable_read_node visit_child_nodes
|
6611
8211
|
|
8212
|
+
# Visit a GlobalVariableTargetNode node
|
8213
|
+
alias visit_global_variable_target_node visit_child_nodes
|
8214
|
+
|
6612
8215
|
# Visit a GlobalVariableWriteNode node
|
6613
8216
|
alias visit_global_variable_write_node visit_child_nodes
|
6614
8217
|
|
@@ -6627,18 +8230,21 @@ module YARP
|
|
6627
8230
|
# Visit a InNode node
|
6628
8231
|
alias visit_in_node visit_child_nodes
|
6629
8232
|
|
6630
|
-
# Visit a
|
6631
|
-
alias
|
6632
|
-
|
6633
|
-
# Visit a InstanceVariableOperatorOrWriteNode node
|
6634
|
-
alias visit_instance_variable_operator_or_write_node visit_child_nodes
|
8233
|
+
# Visit a InstanceVariableAndWriteNode node
|
8234
|
+
alias visit_instance_variable_and_write_node visit_child_nodes
|
6635
8235
|
|
6636
8236
|
# Visit a InstanceVariableOperatorWriteNode node
|
6637
8237
|
alias visit_instance_variable_operator_write_node visit_child_nodes
|
6638
8238
|
|
8239
|
+
# Visit a InstanceVariableOrWriteNode node
|
8240
|
+
alias visit_instance_variable_or_write_node visit_child_nodes
|
8241
|
+
|
6639
8242
|
# Visit a InstanceVariableReadNode node
|
6640
8243
|
alias visit_instance_variable_read_node visit_child_nodes
|
6641
8244
|
|
8245
|
+
# Visit a InstanceVariableTargetNode node
|
8246
|
+
alias visit_instance_variable_target_node visit_child_nodes
|
8247
|
+
|
6642
8248
|
# Visit a InstanceVariableWriteNode node
|
6643
8249
|
alias visit_instance_variable_write_node visit_child_nodes
|
6644
8250
|
|
@@ -6669,18 +8275,21 @@ module YARP
|
|
6669
8275
|
# Visit a LambdaNode node
|
6670
8276
|
alias visit_lambda_node visit_child_nodes
|
6671
8277
|
|
6672
|
-
# Visit a
|
6673
|
-
alias
|
6674
|
-
|
6675
|
-
# Visit a LocalVariableOperatorOrWriteNode node
|
6676
|
-
alias visit_local_variable_operator_or_write_node visit_child_nodes
|
8278
|
+
# Visit a LocalVariableAndWriteNode node
|
8279
|
+
alias visit_local_variable_and_write_node visit_child_nodes
|
6677
8280
|
|
6678
8281
|
# Visit a LocalVariableOperatorWriteNode node
|
6679
8282
|
alias visit_local_variable_operator_write_node visit_child_nodes
|
6680
8283
|
|
8284
|
+
# Visit a LocalVariableOrWriteNode node
|
8285
|
+
alias visit_local_variable_or_write_node visit_child_nodes
|
8286
|
+
|
6681
8287
|
# Visit a LocalVariableReadNode node
|
6682
8288
|
alias visit_local_variable_read_node visit_child_nodes
|
6683
8289
|
|
8290
|
+
# Visit a LocalVariableTargetNode node
|
8291
|
+
alias visit_local_variable_target_node visit_child_nodes
|
8292
|
+
|
6684
8293
|
# Visit a LocalVariableWriteNode node
|
6685
8294
|
alias visit_local_variable_write_node visit_child_nodes
|
6686
8295
|
|
@@ -6893,8 +8502,8 @@ module YARP
|
|
6893
8502
|
end
|
6894
8503
|
|
6895
8504
|
# Create a new BlockNode node
|
6896
|
-
def BlockNode(locals, parameters,
|
6897
|
-
BlockNode.new(locals, parameters,
|
8505
|
+
def BlockNode(locals, parameters, body, opening_loc, closing_loc, location = Location())
|
8506
|
+
BlockNode.new(locals, parameters, body, opening_loc, closing_loc, location)
|
6898
8507
|
end
|
6899
8508
|
|
6900
8509
|
# Create a new BlockParameterNode node
|
@@ -6943,18 +8552,13 @@ module YARP
|
|
6943
8552
|
end
|
6944
8553
|
|
6945
8554
|
# Create a new ClassNode node
|
6946
|
-
def ClassNode(locals, class_keyword_loc, constant_path, inheritance_operator_loc, superclass,
|
6947
|
-
ClassNode.new(locals, class_keyword_loc, constant_path, inheritance_operator_loc, superclass,
|
8555
|
+
def ClassNode(locals, class_keyword_loc, constant_path, inheritance_operator_loc, superclass, body, end_keyword_loc, name, location = Location())
|
8556
|
+
ClassNode.new(locals, class_keyword_loc, constant_path, inheritance_operator_loc, superclass, body, end_keyword_loc, name, location)
|
6948
8557
|
end
|
6949
8558
|
|
6950
|
-
# Create a new
|
6951
|
-
def
|
6952
|
-
|
6953
|
-
end
|
6954
|
-
|
6955
|
-
# Create a new ClassVariableOperatorOrWriteNode node
|
6956
|
-
def ClassVariableOperatorOrWriteNode(name_loc, operator_loc, value, location = Location())
|
6957
|
-
ClassVariableOperatorOrWriteNode.new(name_loc, operator_loc, value, location)
|
8559
|
+
# Create a new ClassVariableAndWriteNode node
|
8560
|
+
def ClassVariableAndWriteNode(name_loc, operator_loc, value, location = Location())
|
8561
|
+
ClassVariableAndWriteNode.new(name_loc, operator_loc, value, location)
|
6958
8562
|
end
|
6959
8563
|
|
6960
8564
|
# Create a new ClassVariableOperatorWriteNode node
|
@@ -6962,24 +8566,29 @@ module YARP
|
|
6962
8566
|
ClassVariableOperatorWriteNode.new(name_loc, operator_loc, value, operator, location)
|
6963
8567
|
end
|
6964
8568
|
|
8569
|
+
# Create a new ClassVariableOrWriteNode node
|
8570
|
+
def ClassVariableOrWriteNode(name_loc, operator_loc, value, location = Location())
|
8571
|
+
ClassVariableOrWriteNode.new(name_loc, operator_loc, value, location)
|
8572
|
+
end
|
8573
|
+
|
6965
8574
|
# Create a new ClassVariableReadNode node
|
6966
8575
|
def ClassVariableReadNode(location = Location())
|
6967
8576
|
ClassVariableReadNode.new(location)
|
6968
8577
|
end
|
6969
8578
|
|
8579
|
+
# Create a new ClassVariableTargetNode node
|
8580
|
+
def ClassVariableTargetNode(location = Location())
|
8581
|
+
ClassVariableTargetNode.new(location)
|
8582
|
+
end
|
8583
|
+
|
6970
8584
|
# Create a new ClassVariableWriteNode node
|
6971
8585
|
def ClassVariableWriteNode(name_loc, value, operator_loc, location = Location())
|
6972
8586
|
ClassVariableWriteNode.new(name_loc, value, operator_loc, location)
|
6973
8587
|
end
|
6974
8588
|
|
6975
|
-
# Create a new
|
6976
|
-
def
|
6977
|
-
|
6978
|
-
end
|
6979
|
-
|
6980
|
-
# Create a new ConstantOperatorOrWriteNode node
|
6981
|
-
def ConstantOperatorOrWriteNode(name_loc, operator_loc, value, location = Location())
|
6982
|
-
ConstantOperatorOrWriteNode.new(name_loc, operator_loc, value, location)
|
8589
|
+
# Create a new ConstantAndWriteNode node
|
8590
|
+
def ConstantAndWriteNode(name_loc, operator_loc, value, location = Location())
|
8591
|
+
ConstantAndWriteNode.new(name_loc, operator_loc, value, location)
|
6983
8592
|
end
|
6984
8593
|
|
6985
8594
|
# Create a new ConstantOperatorWriteNode node
|
@@ -6987,19 +8596,19 @@ module YARP
|
|
6987
8596
|
ConstantOperatorWriteNode.new(name_loc, operator_loc, value, operator, location)
|
6988
8597
|
end
|
6989
8598
|
|
6990
|
-
# Create a new
|
6991
|
-
def
|
6992
|
-
|
8599
|
+
# Create a new ConstantOrWriteNode node
|
8600
|
+
def ConstantOrWriteNode(name_loc, operator_loc, value, location = Location())
|
8601
|
+
ConstantOrWriteNode.new(name_loc, operator_loc, value, location)
|
6993
8602
|
end
|
6994
8603
|
|
6995
|
-
# Create a new
|
6996
|
-
def
|
6997
|
-
|
8604
|
+
# Create a new ConstantPathAndWriteNode node
|
8605
|
+
def ConstantPathAndWriteNode(target, operator_loc, value, location = Location())
|
8606
|
+
ConstantPathAndWriteNode.new(target, operator_loc, value, location)
|
6998
8607
|
end
|
6999
8608
|
|
7000
|
-
# Create a new
|
7001
|
-
def
|
7002
|
-
|
8609
|
+
# Create a new ConstantPathNode node
|
8610
|
+
def ConstantPathNode(parent, child, delimiter_loc, location = Location())
|
8611
|
+
ConstantPathNode.new(parent, child, delimiter_loc, location)
|
7003
8612
|
end
|
7004
8613
|
|
7005
8614
|
# Create a new ConstantPathOperatorWriteNode node
|
@@ -7007,6 +8616,16 @@ module YARP
|
|
7007
8616
|
ConstantPathOperatorWriteNode.new(target, operator_loc, value, operator, location)
|
7008
8617
|
end
|
7009
8618
|
|
8619
|
+
# Create a new ConstantPathOrWriteNode node
|
8620
|
+
def ConstantPathOrWriteNode(target, operator_loc, value, location = Location())
|
8621
|
+
ConstantPathOrWriteNode.new(target, operator_loc, value, location)
|
8622
|
+
end
|
8623
|
+
|
8624
|
+
# Create a new ConstantPathTargetNode node
|
8625
|
+
def ConstantPathTargetNode(parent, child, delimiter_loc, location = Location())
|
8626
|
+
ConstantPathTargetNode.new(parent, child, delimiter_loc, location)
|
8627
|
+
end
|
8628
|
+
|
7010
8629
|
# Create a new ConstantPathWriteNode node
|
7011
8630
|
def ConstantPathWriteNode(target, operator_loc, value, location = Location())
|
7012
8631
|
ConstantPathWriteNode.new(target, operator_loc, value, location)
|
@@ -7017,14 +8636,19 @@ module YARP
|
|
7017
8636
|
ConstantReadNode.new(location)
|
7018
8637
|
end
|
7019
8638
|
|
8639
|
+
# Create a new ConstantTargetNode node
|
8640
|
+
def ConstantTargetNode(location = Location())
|
8641
|
+
ConstantTargetNode.new(location)
|
8642
|
+
end
|
8643
|
+
|
7020
8644
|
# Create a new ConstantWriteNode node
|
7021
8645
|
def ConstantWriteNode(name_loc, value, operator_loc, location = Location())
|
7022
8646
|
ConstantWriteNode.new(name_loc, value, operator_loc, location)
|
7023
8647
|
end
|
7024
8648
|
|
7025
8649
|
# Create a new DefNode node
|
7026
|
-
def DefNode(name_loc, receiver, parameters,
|
7027
|
-
DefNode.new(name_loc, receiver, parameters,
|
8650
|
+
def DefNode(name_loc, receiver, parameters, body, locals, def_keyword_loc, operator_loc, lparen_loc, rparen_loc, equal_loc, end_keyword_loc, location = Location())
|
8651
|
+
DefNode.new(name_loc, receiver, parameters, body, locals, def_keyword_loc, operator_loc, lparen_loc, rparen_loc, equal_loc, end_keyword_loc, location)
|
7028
8652
|
end
|
7029
8653
|
|
7030
8654
|
# Create a new DefinedNode node
|
@@ -7092,14 +8716,9 @@ module YARP
|
|
7092
8716
|
ForwardingSuperNode.new(block, location)
|
7093
8717
|
end
|
7094
8718
|
|
7095
|
-
# Create a new
|
7096
|
-
def
|
7097
|
-
|
7098
|
-
end
|
7099
|
-
|
7100
|
-
# Create a new GlobalVariableOperatorOrWriteNode node
|
7101
|
-
def GlobalVariableOperatorOrWriteNode(name_loc, operator_loc, value, location = Location())
|
7102
|
-
GlobalVariableOperatorOrWriteNode.new(name_loc, operator_loc, value, location)
|
8719
|
+
# Create a new GlobalVariableAndWriteNode node
|
8720
|
+
def GlobalVariableAndWriteNode(name_loc, operator_loc, value, location = Location())
|
8721
|
+
GlobalVariableAndWriteNode.new(name_loc, operator_loc, value, location)
|
7103
8722
|
end
|
7104
8723
|
|
7105
8724
|
# Create a new GlobalVariableOperatorWriteNode node
|
@@ -7107,11 +8726,21 @@ module YARP
|
|
7107
8726
|
GlobalVariableOperatorWriteNode.new(name_loc, operator_loc, value, operator, location)
|
7108
8727
|
end
|
7109
8728
|
|
8729
|
+
# Create a new GlobalVariableOrWriteNode node
|
8730
|
+
def GlobalVariableOrWriteNode(name_loc, operator_loc, value, location = Location())
|
8731
|
+
GlobalVariableOrWriteNode.new(name_loc, operator_loc, value, location)
|
8732
|
+
end
|
8733
|
+
|
7110
8734
|
# Create a new GlobalVariableReadNode node
|
7111
8735
|
def GlobalVariableReadNode(location = Location())
|
7112
8736
|
GlobalVariableReadNode.new(location)
|
7113
8737
|
end
|
7114
8738
|
|
8739
|
+
# Create a new GlobalVariableTargetNode node
|
8740
|
+
def GlobalVariableTargetNode(location = Location())
|
8741
|
+
GlobalVariableTargetNode.new(location)
|
8742
|
+
end
|
8743
|
+
|
7115
8744
|
# Create a new GlobalVariableWriteNode node
|
7116
8745
|
def GlobalVariableWriteNode(name_loc, operator_loc, value, location = Location())
|
7117
8746
|
GlobalVariableWriteNode.new(name_loc, operator_loc, value, location)
|
@@ -7142,14 +8771,9 @@ module YARP
|
|
7142
8771
|
InNode.new(pattern, statements, in_loc, then_loc, location)
|
7143
8772
|
end
|
7144
8773
|
|
7145
|
-
# Create a new
|
7146
|
-
def
|
7147
|
-
|
7148
|
-
end
|
7149
|
-
|
7150
|
-
# Create a new InstanceVariableOperatorOrWriteNode node
|
7151
|
-
def InstanceVariableOperatorOrWriteNode(name_loc, operator_loc, value, location = Location())
|
7152
|
-
InstanceVariableOperatorOrWriteNode.new(name_loc, operator_loc, value, location)
|
8774
|
+
# Create a new InstanceVariableAndWriteNode node
|
8775
|
+
def InstanceVariableAndWriteNode(name_loc, operator_loc, value, location = Location())
|
8776
|
+
InstanceVariableAndWriteNode.new(name_loc, operator_loc, value, location)
|
7153
8777
|
end
|
7154
8778
|
|
7155
8779
|
# Create a new InstanceVariableOperatorWriteNode node
|
@@ -7157,11 +8781,21 @@ module YARP
|
|
7157
8781
|
InstanceVariableOperatorWriteNode.new(name_loc, operator_loc, value, operator, location)
|
7158
8782
|
end
|
7159
8783
|
|
8784
|
+
# Create a new InstanceVariableOrWriteNode node
|
8785
|
+
def InstanceVariableOrWriteNode(name_loc, operator_loc, value, location = Location())
|
8786
|
+
InstanceVariableOrWriteNode.new(name_loc, operator_loc, value, location)
|
8787
|
+
end
|
8788
|
+
|
7160
8789
|
# Create a new InstanceVariableReadNode node
|
7161
8790
|
def InstanceVariableReadNode(location = Location())
|
7162
8791
|
InstanceVariableReadNode.new(location)
|
7163
8792
|
end
|
7164
8793
|
|
8794
|
+
# Create a new InstanceVariableTargetNode node
|
8795
|
+
def InstanceVariableTargetNode(location = Location())
|
8796
|
+
InstanceVariableTargetNode.new(location)
|
8797
|
+
end
|
8798
|
+
|
7165
8799
|
# Create a new InstanceVariableWriteNode node
|
7166
8800
|
def InstanceVariableWriteNode(name_loc, value, operator_loc, location = Location())
|
7167
8801
|
InstanceVariableWriteNode.new(name_loc, value, operator_loc, location)
|
@@ -7208,23 +8842,23 @@ module YARP
|
|
7208
8842
|
end
|
7209
8843
|
|
7210
8844
|
# Create a new LambdaNode node
|
7211
|
-
def LambdaNode(locals, opening_loc, parameters,
|
7212
|
-
LambdaNode.new(locals, opening_loc, parameters,
|
8845
|
+
def LambdaNode(locals, operator_loc, opening_loc, closing_loc, parameters, body, location = Location())
|
8846
|
+
LambdaNode.new(locals, operator_loc, opening_loc, closing_loc, parameters, body, location)
|
7213
8847
|
end
|
7214
8848
|
|
7215
|
-
# Create a new
|
7216
|
-
def
|
7217
|
-
|
8849
|
+
# Create a new LocalVariableAndWriteNode node
|
8850
|
+
def LocalVariableAndWriteNode(name_loc, operator_loc, value, constant_id, depth, location = Location())
|
8851
|
+
LocalVariableAndWriteNode.new(name_loc, operator_loc, value, constant_id, depth, location)
|
7218
8852
|
end
|
7219
8853
|
|
7220
|
-
# Create a new
|
7221
|
-
def
|
7222
|
-
|
8854
|
+
# Create a new LocalVariableOperatorWriteNode node
|
8855
|
+
def LocalVariableOperatorWriteNode(name_loc, operator_loc, value, constant_id, operator_id, depth, location = Location())
|
8856
|
+
LocalVariableOperatorWriteNode.new(name_loc, operator_loc, value, constant_id, operator_id, depth, location)
|
7223
8857
|
end
|
7224
8858
|
|
7225
|
-
# Create a new
|
7226
|
-
def
|
7227
|
-
|
8859
|
+
# Create a new LocalVariableOrWriteNode node
|
8860
|
+
def LocalVariableOrWriteNode(name_loc, operator_loc, value, constant_id, depth, location = Location())
|
8861
|
+
LocalVariableOrWriteNode.new(name_loc, operator_loc, value, constant_id, depth, location)
|
7228
8862
|
end
|
7229
8863
|
|
7230
8864
|
# Create a new LocalVariableReadNode node
|
@@ -7232,6 +8866,11 @@ module YARP
|
|
7232
8866
|
LocalVariableReadNode.new(constant_id, depth, location)
|
7233
8867
|
end
|
7234
8868
|
|
8869
|
+
# Create a new LocalVariableTargetNode node
|
8870
|
+
def LocalVariableTargetNode(constant_id, depth, location = Location())
|
8871
|
+
LocalVariableTargetNode.new(constant_id, depth, location)
|
8872
|
+
end
|
8873
|
+
|
7235
8874
|
# Create a new LocalVariableWriteNode node
|
7236
8875
|
def LocalVariableWriteNode(constant_id, depth, value, name_loc, operator_loc, location = Location())
|
7237
8876
|
LocalVariableWriteNode.new(constant_id, depth, value, name_loc, operator_loc, location)
|
@@ -7253,8 +8892,8 @@ module YARP
|
|
7253
8892
|
end
|
7254
8893
|
|
7255
8894
|
# Create a new ModuleNode node
|
7256
|
-
def ModuleNode(locals, module_keyword_loc, constant_path,
|
7257
|
-
ModuleNode.new(locals, module_keyword_loc, constant_path,
|
8895
|
+
def ModuleNode(locals, module_keyword_loc, constant_path, body, end_keyword_loc, name, location = Location())
|
8896
|
+
ModuleNode.new(locals, module_keyword_loc, constant_path, body, end_keyword_loc, name, location)
|
7258
8897
|
end
|
7259
8898
|
|
7260
8899
|
# Create a new MultiWriteNode node
|
@@ -7298,8 +8937,8 @@ module YARP
|
|
7298
8937
|
end
|
7299
8938
|
|
7300
8939
|
# Create a new ParenthesesNode node
|
7301
|
-
def ParenthesesNode(
|
7302
|
-
ParenthesesNode.new(
|
8940
|
+
def ParenthesesNode(body, opening_loc, closing_loc, location = Location())
|
8941
|
+
ParenthesesNode.new(body, opening_loc, closing_loc, location)
|
7303
8942
|
end
|
7304
8943
|
|
7305
8944
|
# Create a new PinnedExpressionNode node
|
@@ -7388,8 +9027,8 @@ module YARP
|
|
7388
9027
|
end
|
7389
9028
|
|
7390
9029
|
# Create a new SingletonClassNode node
|
7391
|
-
def SingletonClassNode(locals, class_keyword_loc, operator_loc, expression,
|
7392
|
-
SingletonClassNode.new(locals, class_keyword_loc, operator_loc, expression,
|
9030
|
+
def SingletonClassNode(locals, class_keyword_loc, operator_loc, expression, body, end_keyword_loc, location = Location())
|
9031
|
+
SingletonClassNode.new(locals, class_keyword_loc, operator_loc, expression, body, end_keyword_loc, location)
|
7393
9032
|
end
|
7394
9033
|
|
7395
9034
|
# Create a new SourceEncodingNode node
|
@@ -7453,8 +9092,8 @@ module YARP
|
|
7453
9092
|
end
|
7454
9093
|
|
7455
9094
|
# Create a new UntilNode node
|
7456
|
-
def UntilNode(keyword_loc, predicate, statements, flags, location = Location())
|
7457
|
-
UntilNode.new(keyword_loc, predicate, statements, flags, location)
|
9095
|
+
def UntilNode(keyword_loc, closing_loc, predicate, statements, flags, location = Location())
|
9096
|
+
UntilNode.new(keyword_loc, closing_loc, predicate, statements, flags, location)
|
7458
9097
|
end
|
7459
9098
|
|
7460
9099
|
# Create a new WhenNode node
|
@@ -7463,8 +9102,8 @@ module YARP
|
|
7463
9102
|
end
|
7464
9103
|
|
7465
9104
|
# Create a new WhileNode node
|
7466
|
-
def WhileNode(keyword_loc, predicate, statements, flags, location = Location())
|
7467
|
-
WhileNode.new(keyword_loc, predicate, statements, flags, location)
|
9105
|
+
def WhileNode(keyword_loc, closing_loc, predicate, statements, flags, location = Location())
|
9106
|
+
WhileNode.new(keyword_loc, closing_loc, predicate, statements, flags, location)
|
7468
9107
|
end
|
7469
9108
|
|
7470
9109
|
# Create a new XStringNode node
|