prism 2.0.0.rc1 → 2.0.0.rc2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/CODE_OF_CONDUCT.md +1 -1
- data/LICENSE.md +1 -1
- data/docs/serialization.md +1 -0
- data/ext/prism/api_node.c +1 -1
- data/ext/prism/extension.c +20 -2
- data/ext/prism/extension.h +1 -1
- data/include/prism/compiler/accel.h +3 -1
- data/include/prism/compiler/bswap.h +46 -0
- data/include/prism/compiler/endianness.h +34 -0
- data/include/prism/internal/buffer.h +3 -0
- data/include/prism/internal/parser.h +20 -0
- data/include/prism/internal/xxh3.h +16 -0
- data/include/prism/parser.h +21 -0
- data/include/prism/string_query.h +11 -0
- data/include/prism/version.h +1 -1
- data/lib/prism/ffi.rb +6 -0
- data/lib/prism/node.rb +736 -0
- data/lib/prism/parse_result.rb +23 -8
- data/lib/prism/serialize.rb +19 -6
- data/lib/prism/string_query.rb +8 -0
- data/prism.gemspec +8 -4
- data/rbi/generated/prism/node.rbi +1706 -980
- data/rbi/generated/prism/parse_result.rbi +16 -4
- data/rbi/generated/prism/serialize.rbi +3 -0
- data/rbi/generated/prism/string_query.rbi +7 -0
- data/sig/generated/prism/node.rbs +1713 -977
- data/sig/generated/prism/parse_result.rbs +16 -4
- data/sig/generated/prism/serialize.rbs +3 -0
- data/sig/generated/prism/string_query.rbs +7 -0
- data/src/buffer.c +9 -0
- data/src/parser.c +18 -0
- data/src/prism.c +406 -225
- data/src/serialize.c +2 -1
- data/src/string_query.c +14 -0
- data/src/xxh3.c +292 -0
- metadata +7 -3
|
@@ -230,8 +230,10 @@ module Prism
|
|
|
230
230
|
|
|
231
231
|
# Represents the use of the `alias` keyword to alias a global variable.
|
|
232
232
|
#
|
|
233
|
-
#
|
|
234
|
-
#
|
|
233
|
+
# ```rb
|
|
234
|
+
# alias $foo $bar
|
|
235
|
+
# ^^^^^^^^^^^^^^^
|
|
236
|
+
# ```
|
|
235
237
|
class AliasGlobalVariableNode < Node
|
|
236
238
|
# Initialize a new AliasGlobalVariableNode node.
|
|
237
239
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, new_name: ::T.any(GlobalVariableReadNode, BackReferenceReadNode, NumberedReferenceReadNode), old_name: ::T.any(GlobalVariableReadNode, BackReferenceReadNode, NumberedReferenceReadNode), keyword_loc: Location).void }
|
|
@@ -277,22 +279,28 @@ module Prism
|
|
|
277
279
|
|
|
278
280
|
# Represents the new name of the global variable that can be used after aliasing.
|
|
279
281
|
#
|
|
280
|
-
#
|
|
281
|
-
#
|
|
282
|
+
# ```rb
|
|
283
|
+
# alias $foo $bar
|
|
284
|
+
# ^^^^
|
|
285
|
+
# ```
|
|
282
286
|
sig { returns(::T.any(GlobalVariableReadNode, BackReferenceReadNode, NumberedReferenceReadNode)) }
|
|
283
287
|
def new_name; end
|
|
284
288
|
|
|
285
289
|
# Represents the old name of the global variable that can be used before aliasing.
|
|
286
290
|
#
|
|
287
|
-
#
|
|
288
|
-
#
|
|
291
|
+
# ```rb
|
|
292
|
+
# alias $foo $bar
|
|
293
|
+
# ^^^^
|
|
294
|
+
# ```
|
|
289
295
|
sig { returns(::T.any(GlobalVariableReadNode, BackReferenceReadNode, NumberedReferenceReadNode)) }
|
|
290
296
|
def old_name; end
|
|
291
297
|
|
|
292
298
|
# The Location of the `alias` keyword.
|
|
293
299
|
#
|
|
294
|
-
#
|
|
295
|
-
#
|
|
300
|
+
# ```rb
|
|
301
|
+
# alias $foo $bar
|
|
302
|
+
# ^^^^^
|
|
303
|
+
# ```
|
|
296
304
|
sig { returns(Location) }
|
|
297
305
|
def keyword_loc; end
|
|
298
306
|
|
|
@@ -311,8 +319,10 @@ module Prism
|
|
|
311
319
|
|
|
312
320
|
# Represents the use of the `alias` keyword to alias a method.
|
|
313
321
|
#
|
|
314
|
-
#
|
|
315
|
-
#
|
|
322
|
+
# ```rb
|
|
323
|
+
# alias foo bar
|
|
324
|
+
# ^^^^^^^^^^^^^
|
|
325
|
+
# ```
|
|
316
326
|
class AliasMethodNode < Node
|
|
317
327
|
# Initialize a new AliasMethodNode node.
|
|
318
328
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, new_name: ::T.any(SymbolNode, InterpolatedSymbolNode), old_name: ::T.any(SymbolNode, InterpolatedSymbolNode), keyword_loc: Location).void }
|
|
@@ -358,34 +368,40 @@ module Prism
|
|
|
358
368
|
|
|
359
369
|
# Represents the new name of the method that will be aliased.
|
|
360
370
|
#
|
|
361
|
-
#
|
|
362
|
-
#
|
|
371
|
+
# ```rb
|
|
372
|
+
# alias foo bar
|
|
373
|
+
# ^^^
|
|
363
374
|
#
|
|
364
|
-
#
|
|
365
|
-
#
|
|
375
|
+
# alias :foo :bar
|
|
376
|
+
# ^^^^
|
|
366
377
|
#
|
|
367
|
-
#
|
|
368
|
-
#
|
|
378
|
+
# alias :"#{foo}" :"#{bar}"
|
|
379
|
+
# ^^^^^^^^^
|
|
380
|
+
# ```
|
|
369
381
|
sig { returns(::T.any(SymbolNode, InterpolatedSymbolNode)) }
|
|
370
382
|
def new_name; end
|
|
371
383
|
|
|
372
384
|
# Represents the old name of the method that will be aliased.
|
|
373
385
|
#
|
|
374
|
-
#
|
|
375
|
-
#
|
|
386
|
+
# ```rb
|
|
387
|
+
# alias foo bar
|
|
388
|
+
# ^^^
|
|
376
389
|
#
|
|
377
|
-
#
|
|
378
|
-
#
|
|
390
|
+
# alias :foo :bar
|
|
391
|
+
# ^^^^
|
|
379
392
|
#
|
|
380
|
-
#
|
|
381
|
-
#
|
|
393
|
+
# alias :"#{foo}" :"#{bar}"
|
|
394
|
+
# ^^^^^^^^^
|
|
395
|
+
# ```
|
|
382
396
|
sig { returns(::T.any(SymbolNode, InterpolatedSymbolNode)) }
|
|
383
397
|
def old_name; end
|
|
384
398
|
|
|
385
399
|
# Represents the Location of the `alias` keyword.
|
|
386
400
|
#
|
|
387
|
-
#
|
|
388
|
-
#
|
|
401
|
+
# ```rb
|
|
402
|
+
# alias foo bar
|
|
403
|
+
# ^^^^^
|
|
404
|
+
# ```
|
|
389
405
|
sig { returns(Location) }
|
|
390
406
|
def keyword_loc; end
|
|
391
407
|
|
|
@@ -404,8 +420,10 @@ module Prism
|
|
|
404
420
|
|
|
405
421
|
# Represents an alternation pattern in pattern matching.
|
|
406
422
|
#
|
|
407
|
-
#
|
|
408
|
-
#
|
|
423
|
+
# ```rb
|
|
424
|
+
# foo => bar | baz
|
|
425
|
+
# ^^^^^^^^^
|
|
426
|
+
# ```
|
|
409
427
|
class AlternationPatternNode < Node
|
|
410
428
|
# Initialize a new AlternationPatternNode node.
|
|
411
429
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, left: Node, right: Node, operator_loc: Location).void }
|
|
@@ -451,22 +469,28 @@ module Prism
|
|
|
451
469
|
|
|
452
470
|
# Represents the left side of the expression.
|
|
453
471
|
#
|
|
454
|
-
#
|
|
455
|
-
#
|
|
472
|
+
# ```rb
|
|
473
|
+
# foo => bar | baz
|
|
474
|
+
# ^^^
|
|
475
|
+
# ```
|
|
456
476
|
sig { returns(Node) }
|
|
457
477
|
def left; end
|
|
458
478
|
|
|
459
479
|
# Represents the right side of the expression.
|
|
460
480
|
#
|
|
461
|
-
#
|
|
462
|
-
#
|
|
481
|
+
# ```rb
|
|
482
|
+
# foo => bar | baz
|
|
483
|
+
# ^^^
|
|
484
|
+
# ```
|
|
463
485
|
sig { returns(Node) }
|
|
464
486
|
def right; end
|
|
465
487
|
|
|
466
488
|
# Represents the alternation operator Location.
|
|
467
489
|
#
|
|
468
|
-
#
|
|
469
|
-
#
|
|
490
|
+
# ```rb
|
|
491
|
+
# foo => bar | baz
|
|
492
|
+
# ^
|
|
493
|
+
# ```
|
|
470
494
|
sig { returns(Location) }
|
|
471
495
|
def operator_loc; end
|
|
472
496
|
|
|
@@ -485,8 +509,10 @@ module Prism
|
|
|
485
509
|
|
|
486
510
|
# Represents the use of the `&&` operator or the `and` keyword.
|
|
487
511
|
#
|
|
488
|
-
#
|
|
489
|
-
#
|
|
512
|
+
# ```rb
|
|
513
|
+
# left and right
|
|
514
|
+
# ^^^^^^^^^^^^^^
|
|
515
|
+
# ```
|
|
490
516
|
class AndNode < Node
|
|
491
517
|
# Initialize a new AndNode node.
|
|
492
518
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, left: Node, right: Node, operator_loc: Location).void }
|
|
@@ -532,28 +558,34 @@ module Prism
|
|
|
532
558
|
|
|
533
559
|
# Represents the left side of the expression. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
534
560
|
#
|
|
535
|
-
#
|
|
536
|
-
#
|
|
561
|
+
# ```rb
|
|
562
|
+
# left and right
|
|
563
|
+
# ^^^^
|
|
537
564
|
#
|
|
538
|
-
#
|
|
539
|
-
#
|
|
565
|
+
# 1 && 2
|
|
566
|
+
# ^
|
|
567
|
+
# ```
|
|
540
568
|
sig { returns(Node) }
|
|
541
569
|
def left; end
|
|
542
570
|
|
|
543
571
|
# Represents the right side of the expression.
|
|
544
572
|
#
|
|
545
|
-
#
|
|
546
|
-
#
|
|
573
|
+
# ```rb
|
|
574
|
+
# left && right
|
|
575
|
+
# ^^^^^
|
|
547
576
|
#
|
|
548
|
-
#
|
|
549
|
-
#
|
|
577
|
+
# 1 and 2
|
|
578
|
+
# ^
|
|
579
|
+
# ```
|
|
550
580
|
sig { returns(Node) }
|
|
551
581
|
def right; end
|
|
552
582
|
|
|
553
583
|
# The Location of the `and` keyword or the `&&` operator.
|
|
554
584
|
#
|
|
555
|
-
#
|
|
556
|
-
#
|
|
585
|
+
# ```rb
|
|
586
|
+
# left and right
|
|
587
|
+
# ^^^
|
|
588
|
+
# ```
|
|
557
589
|
sig { returns(Location) }
|
|
558
590
|
def operator_loc; end
|
|
559
591
|
|
|
@@ -572,8 +604,10 @@ module Prism
|
|
|
572
604
|
|
|
573
605
|
# Represents a set of arguments to a method or a keyword.
|
|
574
606
|
#
|
|
575
|
-
#
|
|
576
|
-
#
|
|
607
|
+
# ```rb
|
|
608
|
+
# return foo, bar, baz
|
|
609
|
+
# ^^^^^^^^^^^^^
|
|
610
|
+
# ```
|
|
577
611
|
class ArgumentsNode < Node
|
|
578
612
|
# Initialize a new ArgumentsNode node.
|
|
579
613
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, arguments: T::Array[Node]).void }
|
|
@@ -639,8 +673,10 @@ module Prism
|
|
|
639
673
|
|
|
640
674
|
# The list of arguments, if present. These can be any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
641
675
|
#
|
|
642
|
-
#
|
|
643
|
-
#
|
|
676
|
+
# ```rb
|
|
677
|
+
# foo(bar, baz)
|
|
678
|
+
# ^^^^^^^^
|
|
679
|
+
# ```
|
|
644
680
|
sig { returns(T::Array[Node]) }
|
|
645
681
|
def arguments; end
|
|
646
682
|
|
|
@@ -650,8 +686,10 @@ module Prism
|
|
|
650
686
|
|
|
651
687
|
# Represents an array literal. This can be a regular array using brackets or a special array using % like %w or %i.
|
|
652
688
|
#
|
|
653
|
-
#
|
|
654
|
-
#
|
|
689
|
+
# ```rb
|
|
690
|
+
# [1, 2, 3]
|
|
691
|
+
# ^^^^^^^^^
|
|
692
|
+
# ```
|
|
655
693
|
class ArrayNode < Node
|
|
656
694
|
# Initialize a new ArrayNode node.
|
|
657
695
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, elements: T::Array[Node], opening_loc: ::T.nilable(Location), closing_loc: ::T.nilable(Location)).void }
|
|
@@ -705,10 +743,12 @@ module Prism
|
|
|
705
743
|
|
|
706
744
|
# Represents the optional source Location for the opening token.
|
|
707
745
|
#
|
|
708
|
-
#
|
|
709
|
-
#
|
|
710
|
-
#
|
|
711
|
-
#
|
|
746
|
+
# ```rb
|
|
747
|
+
# [1,2,3] # "["
|
|
748
|
+
# %w[foo bar baz] # "%w["
|
|
749
|
+
# %I(apple orange banana) # "%I("
|
|
750
|
+
# foo = 1, 2, 3 # nil
|
|
751
|
+
# ```
|
|
712
752
|
sig { returns(::T.nilable(Location)) }
|
|
713
753
|
def opening_loc; end
|
|
714
754
|
|
|
@@ -719,10 +759,12 @@ module Prism
|
|
|
719
759
|
|
|
720
760
|
# Represents the optional source Location for the closing token.
|
|
721
761
|
#
|
|
722
|
-
#
|
|
723
|
-
#
|
|
724
|
-
#
|
|
725
|
-
#
|
|
762
|
+
# ```rb
|
|
763
|
+
# [1,2,3] # "]"
|
|
764
|
+
# %w[foo bar baz] # "]"
|
|
765
|
+
# %I(apple orange banana) # ")"
|
|
766
|
+
# foo = 1, 2, 3 # nil
|
|
767
|
+
# ```
|
|
726
768
|
sig { returns(::T.nilable(Location)) }
|
|
727
769
|
def closing_loc; end
|
|
728
770
|
|
|
@@ -745,20 +787,22 @@ module Prism
|
|
|
745
787
|
|
|
746
788
|
# Represents an array pattern in pattern matching.
|
|
747
789
|
#
|
|
748
|
-
#
|
|
749
|
-
#
|
|
790
|
+
# ```rb
|
|
791
|
+
# foo in 1, 2
|
|
792
|
+
# ^^^^
|
|
750
793
|
#
|
|
751
|
-
#
|
|
752
|
-
#
|
|
794
|
+
# foo in [1, 2]
|
|
795
|
+
# ^^^^^^
|
|
753
796
|
#
|
|
754
|
-
#
|
|
755
|
-
#
|
|
797
|
+
# foo in *bar
|
|
798
|
+
# ^^^^
|
|
756
799
|
#
|
|
757
|
-
#
|
|
758
|
-
#
|
|
800
|
+
# foo in Bar[]
|
|
801
|
+
# ^^^^^
|
|
759
802
|
#
|
|
760
|
-
#
|
|
761
|
-
#
|
|
803
|
+
# foo in Bar[1, 2, 3]
|
|
804
|
+
# ^^^^^^^^^^^^
|
|
805
|
+
# ```
|
|
762
806
|
class ArrayPatternNode < Node
|
|
763
807
|
# Initialize a new ArrayPatternNode node.
|
|
764
808
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, constant: ::T.nilable(::T.any(ConstantPathNode, ConstantReadNode)), requireds: T::Array[Node], rest: ::T.nilable(::T.any(ImplicitRestNode, SplatNode)), posts: T::Array[Node], opening_loc: ::T.nilable(Location), closing_loc: ::T.nilable(Location)).void }
|
|
@@ -804,42 +848,52 @@ module Prism
|
|
|
804
848
|
|
|
805
849
|
# Represents the optional constant preceding the Array
|
|
806
850
|
#
|
|
807
|
-
#
|
|
808
|
-
#
|
|
851
|
+
# ```rb
|
|
852
|
+
# foo in Bar[]
|
|
853
|
+
# ^^^
|
|
809
854
|
#
|
|
810
|
-
#
|
|
811
|
-
#
|
|
855
|
+
# foo in Bar[1, 2, 3]
|
|
856
|
+
# ^^^
|
|
812
857
|
#
|
|
813
|
-
#
|
|
814
|
-
#
|
|
858
|
+
# foo in Bar::Baz[1, 2, 3]
|
|
859
|
+
# ^^^^^^^^
|
|
860
|
+
# ```
|
|
815
861
|
sig { returns(::T.nilable(::T.any(ConstantPathNode, ConstantReadNode))) }
|
|
816
862
|
def constant; end
|
|
817
863
|
|
|
818
864
|
# Represents the required elements of the array pattern.
|
|
819
865
|
#
|
|
820
|
-
#
|
|
821
|
-
#
|
|
866
|
+
# ```rb
|
|
867
|
+
# foo in [1, 2]
|
|
868
|
+
# ^ ^
|
|
869
|
+
# ```
|
|
822
870
|
sig { returns(T::Array[Node]) }
|
|
823
871
|
def requireds; end
|
|
824
872
|
|
|
825
873
|
# Represents the rest element of the array pattern.
|
|
826
874
|
#
|
|
827
|
-
#
|
|
828
|
-
#
|
|
875
|
+
# ```rb
|
|
876
|
+
# foo in *bar
|
|
877
|
+
# ^^^^
|
|
878
|
+
# ```
|
|
829
879
|
sig { returns(::T.nilable(::T.any(ImplicitRestNode, SplatNode))) }
|
|
830
880
|
def rest; end
|
|
831
881
|
|
|
832
882
|
# Represents the elements after the rest element of the array pattern.
|
|
833
883
|
#
|
|
834
|
-
#
|
|
835
|
-
#
|
|
884
|
+
# ```rb
|
|
885
|
+
# foo in *bar, baz
|
|
886
|
+
# ^^^
|
|
887
|
+
# ```
|
|
836
888
|
sig { returns(T::Array[Node]) }
|
|
837
889
|
def posts; end
|
|
838
890
|
|
|
839
891
|
# Represents the opening Location of the array pattern.
|
|
840
892
|
#
|
|
841
|
-
#
|
|
842
|
-
#
|
|
893
|
+
# ```rb
|
|
894
|
+
# foo in [1, 2]
|
|
895
|
+
# ^
|
|
896
|
+
# ```
|
|
843
897
|
sig { returns(::T.nilable(Location)) }
|
|
844
898
|
def opening_loc; end
|
|
845
899
|
|
|
@@ -850,8 +904,10 @@ module Prism
|
|
|
850
904
|
|
|
851
905
|
# Represents the closing Location of the array pattern.
|
|
852
906
|
#
|
|
853
|
-
#
|
|
854
|
-
#
|
|
907
|
+
# ```rb
|
|
908
|
+
# foo in [1, 2]
|
|
909
|
+
# ^
|
|
910
|
+
# ```
|
|
855
911
|
sig { returns(::T.nilable(Location)) }
|
|
856
912
|
def closing_loc; end
|
|
857
913
|
|
|
@@ -874,8 +930,10 @@ module Prism
|
|
|
874
930
|
|
|
875
931
|
# Represents a hash key/value pair.
|
|
876
932
|
#
|
|
877
|
-
#
|
|
878
|
-
#
|
|
933
|
+
# ```rb
|
|
934
|
+
# { a => b }
|
|
935
|
+
# ^^^^^^
|
|
936
|
+
# ```
|
|
879
937
|
class AssocNode < Node
|
|
880
938
|
# Initialize a new AssocNode node.
|
|
881
939
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, key: Node, value: Node, operator_loc: ::T.nilable(Location)).void }
|
|
@@ -921,31 +979,37 @@ module Prism
|
|
|
921
979
|
|
|
922
980
|
# The key of the association. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
923
981
|
#
|
|
924
|
-
#
|
|
925
|
-
#
|
|
982
|
+
# ```rb
|
|
983
|
+
# { a: b }
|
|
984
|
+
# ^
|
|
926
985
|
#
|
|
927
|
-
#
|
|
928
|
-
#
|
|
986
|
+
# { foo => bar }
|
|
987
|
+
# ^^^
|
|
929
988
|
#
|
|
930
|
-
#
|
|
931
|
-
#
|
|
989
|
+
# { def a; end => 1 }
|
|
990
|
+
# ^^^^^^^^^^
|
|
991
|
+
# ```
|
|
932
992
|
sig { returns(Node) }
|
|
933
993
|
def key; end
|
|
934
994
|
|
|
935
995
|
# The value of the association, if present. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
936
996
|
#
|
|
937
|
-
#
|
|
938
|
-
#
|
|
997
|
+
# ```rb
|
|
998
|
+
# { foo => bar }
|
|
999
|
+
# ^^^
|
|
939
1000
|
#
|
|
940
|
-
#
|
|
941
|
-
#
|
|
1001
|
+
# { x: 1 }
|
|
1002
|
+
# ^
|
|
1003
|
+
# ```
|
|
942
1004
|
sig { returns(Node) }
|
|
943
1005
|
def value; end
|
|
944
1006
|
|
|
945
1007
|
# The Location of the `=>` operator, if present.
|
|
946
1008
|
#
|
|
947
|
-
#
|
|
948
|
-
#
|
|
1009
|
+
# ```rb
|
|
1010
|
+
# { foo => bar }
|
|
1011
|
+
# ^^
|
|
1012
|
+
# ```
|
|
949
1013
|
sig { returns(::T.nilable(Location)) }
|
|
950
1014
|
def operator_loc; end
|
|
951
1015
|
|
|
@@ -964,8 +1028,10 @@ module Prism
|
|
|
964
1028
|
|
|
965
1029
|
# Represents a splat in a hash literal.
|
|
966
1030
|
#
|
|
967
|
-
#
|
|
968
|
-
#
|
|
1031
|
+
# ```rb
|
|
1032
|
+
# { **foo }
|
|
1033
|
+
# ^^^^^
|
|
1034
|
+
# ```
|
|
969
1035
|
class AssocSplatNode < Node
|
|
970
1036
|
# Initialize a new AssocSplatNode node.
|
|
971
1037
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, value: ::T.nilable(Node), operator_loc: Location).void }
|
|
@@ -1011,15 +1077,19 @@ module Prism
|
|
|
1011
1077
|
|
|
1012
1078
|
# The value to be splatted, if present. Will be missing when keyword rest argument forwarding is used.
|
|
1013
1079
|
#
|
|
1014
|
-
#
|
|
1015
|
-
#
|
|
1080
|
+
# ```rb
|
|
1081
|
+
# { **foo }
|
|
1082
|
+
# ^^^
|
|
1083
|
+
# ```
|
|
1016
1084
|
sig { returns(::T.nilable(Node)) }
|
|
1017
1085
|
def value; end
|
|
1018
1086
|
|
|
1019
1087
|
# The Location of the `**` operator.
|
|
1020
1088
|
#
|
|
1021
|
-
#
|
|
1022
|
-
#
|
|
1089
|
+
# ```rb
|
|
1090
|
+
# { **x }
|
|
1091
|
+
# ^^
|
|
1092
|
+
# ```
|
|
1023
1093
|
sig { returns(Location) }
|
|
1024
1094
|
def operator_loc; end
|
|
1025
1095
|
|
|
@@ -1038,8 +1108,10 @@ module Prism
|
|
|
1038
1108
|
|
|
1039
1109
|
# Represents reading a reference to a field in the previous match.
|
|
1040
1110
|
#
|
|
1041
|
-
#
|
|
1042
|
-
#
|
|
1111
|
+
# ```rb
|
|
1112
|
+
# $'
|
|
1113
|
+
# ^^
|
|
1114
|
+
# ```
|
|
1043
1115
|
class BackReferenceReadNode < Node
|
|
1044
1116
|
# Initialize a new BackReferenceReadNode node.
|
|
1045
1117
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol).void }
|
|
@@ -1085,9 +1157,11 @@ module Prism
|
|
|
1085
1157
|
|
|
1086
1158
|
# The name of the back-reference variable, including the leading `$`.
|
|
1087
1159
|
#
|
|
1088
|
-
#
|
|
1160
|
+
# ```rb
|
|
1161
|
+
# $& # name `:$&`
|
|
1089
1162
|
#
|
|
1090
|
-
#
|
|
1163
|
+
# $+ # name `:$+`
|
|
1164
|
+
# ```
|
|
1091
1165
|
sig { returns(Symbol) }
|
|
1092
1166
|
def name; end
|
|
1093
1167
|
|
|
@@ -1097,10 +1171,12 @@ module Prism
|
|
|
1097
1171
|
|
|
1098
1172
|
# Represents a begin statement.
|
|
1099
1173
|
#
|
|
1100
|
-
#
|
|
1101
|
-
#
|
|
1102
|
-
#
|
|
1103
|
-
#
|
|
1174
|
+
# ```rb
|
|
1175
|
+
# begin
|
|
1176
|
+
# foo
|
|
1177
|
+
# end
|
|
1178
|
+
# ^^^^^
|
|
1179
|
+
# ```
|
|
1104
1180
|
class BeginNode < Node
|
|
1105
1181
|
# Initialize a new BeginNode node.
|
|
1106
1182
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, begin_keyword_loc: ::T.nilable(Location), statements: ::T.nilable(StatementsNode), rescue_clause: ::T.nilable(RescueNode), else_clause: ::T.nilable(ElseNode), ensure_clause: ::T.nilable(EnsureNode), end_keyword_loc: ::T.nilable(Location)).void }
|
|
@@ -1146,8 +1222,10 @@ module Prism
|
|
|
1146
1222
|
|
|
1147
1223
|
# Represents the Location of the `begin` keyword.
|
|
1148
1224
|
#
|
|
1149
|
-
#
|
|
1150
|
-
#
|
|
1225
|
+
# ```rb
|
|
1226
|
+
# begin x end
|
|
1227
|
+
# ^^^^^
|
|
1228
|
+
# ```
|
|
1151
1229
|
sig { returns(::T.nilable(Location)) }
|
|
1152
1230
|
def begin_keyword_loc; end
|
|
1153
1231
|
|
|
@@ -1158,36 +1236,46 @@ module Prism
|
|
|
1158
1236
|
|
|
1159
1237
|
# Represents the statements within the begin block.
|
|
1160
1238
|
#
|
|
1161
|
-
#
|
|
1162
|
-
#
|
|
1239
|
+
# ```rb
|
|
1240
|
+
# begin x end
|
|
1241
|
+
# ^
|
|
1242
|
+
# ```
|
|
1163
1243
|
sig { returns(::T.nilable(StatementsNode)) }
|
|
1164
1244
|
def statements; end
|
|
1165
1245
|
|
|
1166
1246
|
# Represents the rescue clause within the begin block.
|
|
1167
1247
|
#
|
|
1168
|
-
#
|
|
1169
|
-
#
|
|
1248
|
+
# ```rb
|
|
1249
|
+
# begin x; rescue y; end
|
|
1250
|
+
# ^^^^^^^^
|
|
1251
|
+
# ```
|
|
1170
1252
|
sig { returns(::T.nilable(RescueNode)) }
|
|
1171
1253
|
def rescue_clause; end
|
|
1172
1254
|
|
|
1173
1255
|
# Represents the else clause within the begin block.
|
|
1174
1256
|
#
|
|
1175
|
-
#
|
|
1176
|
-
#
|
|
1257
|
+
# ```rb
|
|
1258
|
+
# begin x; rescue y; else z; end
|
|
1259
|
+
# ^^^^^^^^^^^
|
|
1260
|
+
# ```
|
|
1177
1261
|
sig { returns(::T.nilable(ElseNode)) }
|
|
1178
1262
|
def else_clause; end
|
|
1179
1263
|
|
|
1180
1264
|
# Represents the ensure clause within the begin block.
|
|
1181
1265
|
#
|
|
1182
|
-
#
|
|
1183
|
-
#
|
|
1266
|
+
# ```rb
|
|
1267
|
+
# begin x; ensure y; end
|
|
1268
|
+
# ^^^^^^^^
|
|
1269
|
+
# ```
|
|
1184
1270
|
sig { returns(::T.nilable(EnsureNode)) }
|
|
1185
1271
|
def ensure_clause; end
|
|
1186
1272
|
|
|
1187
1273
|
# Represents the Location of the `end` keyword.
|
|
1188
1274
|
#
|
|
1189
|
-
#
|
|
1190
|
-
#
|
|
1275
|
+
# ```rb
|
|
1276
|
+
# begin x end
|
|
1277
|
+
# ^^^
|
|
1278
|
+
# ```
|
|
1191
1279
|
sig { returns(::T.nilable(Location)) }
|
|
1192
1280
|
def end_keyword_loc; end
|
|
1193
1281
|
|
|
@@ -1210,8 +1298,10 @@ module Prism
|
|
|
1210
1298
|
|
|
1211
1299
|
# Represents a block argument using `&`.
|
|
1212
1300
|
#
|
|
1213
|
-
#
|
|
1214
|
-
#
|
|
1301
|
+
# ```rb
|
|
1302
|
+
# bar(&args)
|
|
1303
|
+
# ^^^^^
|
|
1304
|
+
# ```
|
|
1215
1305
|
class BlockArgumentNode < Node
|
|
1216
1306
|
# Initialize a new BlockArgumentNode node.
|
|
1217
1307
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, expression: ::T.nilable(Node), operator_loc: Location).void }
|
|
@@ -1257,15 +1347,19 @@ module Prism
|
|
|
1257
1347
|
|
|
1258
1348
|
# The expression that is being passed as a block argument. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
1259
1349
|
#
|
|
1260
|
-
#
|
|
1261
|
-
#
|
|
1350
|
+
# ```rb
|
|
1351
|
+
# foo(&args)
|
|
1352
|
+
# ^^^^
|
|
1353
|
+
# ```
|
|
1262
1354
|
sig { returns(::T.nilable(Node)) }
|
|
1263
1355
|
def expression; end
|
|
1264
1356
|
|
|
1265
1357
|
# Represents the Location of the `&` operator.
|
|
1266
1358
|
#
|
|
1267
|
-
#
|
|
1268
|
-
#
|
|
1359
|
+
# ```rb
|
|
1360
|
+
# foo(&args)
|
|
1361
|
+
# ^
|
|
1362
|
+
# ```
|
|
1269
1363
|
sig { returns(Location) }
|
|
1270
1364
|
def operator_loc; end
|
|
1271
1365
|
|
|
@@ -1284,8 +1378,10 @@ module Prism
|
|
|
1284
1378
|
|
|
1285
1379
|
# Represents a block local variable.
|
|
1286
1380
|
#
|
|
1287
|
-
#
|
|
1288
|
-
#
|
|
1381
|
+
# ```rb
|
|
1382
|
+
# a { |; b| }
|
|
1383
|
+
# ^
|
|
1384
|
+
# ```
|
|
1289
1385
|
class BlockLocalVariableNode < Node
|
|
1290
1386
|
# Initialize a new BlockLocalVariableNode node.
|
|
1291
1387
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol).void }
|
|
@@ -1335,8 +1431,10 @@ module Prism
|
|
|
1335
1431
|
|
|
1336
1432
|
# The name of the block local variable.
|
|
1337
1433
|
#
|
|
1338
|
-
#
|
|
1339
|
-
#
|
|
1434
|
+
# ```rb
|
|
1435
|
+
# a { |; b| } # name `:b`
|
|
1436
|
+
# ^
|
|
1437
|
+
# ```
|
|
1340
1438
|
sig { returns(Symbol) }
|
|
1341
1439
|
def name; end
|
|
1342
1440
|
|
|
@@ -1346,8 +1444,10 @@ module Prism
|
|
|
1346
1444
|
|
|
1347
1445
|
# Represents a block of ruby code.
|
|
1348
1446
|
#
|
|
1349
|
-
#
|
|
1350
|
-
#
|
|
1447
|
+
# ```rb
|
|
1448
|
+
# [1, 2, 3].each { |i| puts x }
|
|
1449
|
+
# ^^^^^^^^^^^^^^
|
|
1450
|
+
# ```
|
|
1351
1451
|
class BlockNode < Node
|
|
1352
1452
|
# Initialize a new BlockNode node.
|
|
1353
1453
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, locals: T::Array[Symbol], parameters: ::T.nilable(::T.any(BlockParametersNode, NumberedParametersNode, ItParametersNode)), body: ::T.nilable(::T.any(StatementsNode, BeginNode)), opening_loc: Location, closing_loc: Location).void }
|
|
@@ -1393,33 +1493,41 @@ module Prism
|
|
|
1393
1493
|
|
|
1394
1494
|
# The local variables declared in the block.
|
|
1395
1495
|
#
|
|
1396
|
-
#
|
|
1397
|
-
#
|
|
1496
|
+
# ```rb
|
|
1497
|
+
# [1, 2, 3].each { |i| puts x } # locals: [:i]
|
|
1498
|
+
# ^
|
|
1499
|
+
# ```
|
|
1398
1500
|
sig { returns(T::Array[Symbol]) }
|
|
1399
1501
|
def locals; end
|
|
1400
1502
|
|
|
1401
1503
|
# The parameters of the block.
|
|
1402
1504
|
#
|
|
1403
|
-
#
|
|
1404
|
-
#
|
|
1405
|
-
#
|
|
1406
|
-
#
|
|
1407
|
-
#
|
|
1408
|
-
#
|
|
1505
|
+
# ```rb
|
|
1506
|
+
# [1, 2, 3].each { |i| puts x }
|
|
1507
|
+
# ^^^
|
|
1508
|
+
# [1, 2, 3].each { puts _1 }
|
|
1509
|
+
# ^^^^^^^^^^^
|
|
1510
|
+
# [1, 2, 3].each { puts it }
|
|
1511
|
+
# ^^^^^^^^^^^
|
|
1512
|
+
# ```
|
|
1409
1513
|
sig { returns(::T.nilable(::T.any(BlockParametersNode, NumberedParametersNode, ItParametersNode))) }
|
|
1410
1514
|
def parameters; end
|
|
1411
1515
|
|
|
1412
1516
|
# The body of the block.
|
|
1413
1517
|
#
|
|
1414
|
-
#
|
|
1415
|
-
#
|
|
1518
|
+
# ```rb
|
|
1519
|
+
# [1, 2, 3].each { |i| puts x }
|
|
1520
|
+
# ^^^^^^
|
|
1521
|
+
# ```
|
|
1416
1522
|
sig { returns(::T.nilable(::T.any(StatementsNode, BeginNode))) }
|
|
1417
1523
|
def body; end
|
|
1418
1524
|
|
|
1419
1525
|
# Represents the Location of the opening `{` or `do`.
|
|
1420
1526
|
#
|
|
1421
|
-
#
|
|
1422
|
-
#
|
|
1527
|
+
# ```rb
|
|
1528
|
+
# [1, 2, 3].each { |i| puts x }
|
|
1529
|
+
# ^
|
|
1530
|
+
# ```
|
|
1423
1531
|
sig { returns(Location) }
|
|
1424
1532
|
def opening_loc; end
|
|
1425
1533
|
|
|
@@ -1430,8 +1538,10 @@ module Prism
|
|
|
1430
1538
|
|
|
1431
1539
|
# Represents the Location of the closing `}` or `end`.
|
|
1432
1540
|
#
|
|
1433
|
-
#
|
|
1434
|
-
#
|
|
1541
|
+
# ```rb
|
|
1542
|
+
# [1, 2, 3].each { |i| puts x }
|
|
1543
|
+
# ^
|
|
1544
|
+
# ```
|
|
1435
1545
|
sig { returns(Location) }
|
|
1436
1546
|
def closing_loc; end
|
|
1437
1547
|
|
|
@@ -1454,9 +1564,11 @@ module Prism
|
|
|
1454
1564
|
|
|
1455
1565
|
# Represents a block parameter of a method, block, or lambda definition.
|
|
1456
1566
|
#
|
|
1457
|
-
#
|
|
1458
|
-
#
|
|
1459
|
-
#
|
|
1567
|
+
# ```rb
|
|
1568
|
+
# def a(&b)
|
|
1569
|
+
# ^^
|
|
1570
|
+
# end
|
|
1571
|
+
# ```
|
|
1460
1572
|
class BlockParameterNode < Node
|
|
1461
1573
|
# Initialize a new BlockParameterNode node.
|
|
1462
1574
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: ::T.nilable(Symbol), name_loc: ::T.nilable(Location), operator_loc: Location).void }
|
|
@@ -1506,16 +1618,20 @@ module Prism
|
|
|
1506
1618
|
|
|
1507
1619
|
# The name of the block parameter.
|
|
1508
1620
|
#
|
|
1509
|
-
#
|
|
1510
|
-
#
|
|
1511
|
-
#
|
|
1621
|
+
# ```rb
|
|
1622
|
+
# def a(&b) # name `:b`
|
|
1623
|
+
# ^
|
|
1624
|
+
# end
|
|
1625
|
+
# ```
|
|
1512
1626
|
sig { returns(::T.nilable(Symbol)) }
|
|
1513
1627
|
def name; end
|
|
1514
1628
|
|
|
1515
1629
|
# Represents the Location of the block parameter name.
|
|
1516
1630
|
#
|
|
1517
|
-
#
|
|
1518
|
-
#
|
|
1631
|
+
# ```rb
|
|
1632
|
+
# def a(&b)
|
|
1633
|
+
# ^
|
|
1634
|
+
# ```
|
|
1519
1635
|
sig { returns(::T.nilable(Location)) }
|
|
1520
1636
|
def name_loc; end
|
|
1521
1637
|
|
|
@@ -1526,9 +1642,11 @@ module Prism
|
|
|
1526
1642
|
|
|
1527
1643
|
# Represents the Location of the `&` operator.
|
|
1528
1644
|
#
|
|
1529
|
-
#
|
|
1530
|
-
#
|
|
1531
|
-
#
|
|
1645
|
+
# ```rb
|
|
1646
|
+
# def a(&b)
|
|
1647
|
+
# ^
|
|
1648
|
+
# end
|
|
1649
|
+
# ```
|
|
1532
1650
|
sig { returns(Location) }
|
|
1533
1651
|
def operator_loc; end
|
|
1534
1652
|
|
|
@@ -1547,12 +1665,14 @@ module Prism
|
|
|
1547
1665
|
|
|
1548
1666
|
# Represents a block's parameters declaration.
|
|
1549
1667
|
#
|
|
1550
|
-
#
|
|
1551
|
-
#
|
|
1668
|
+
# ```rb
|
|
1669
|
+
# -> (a, b = 1; local) { }
|
|
1670
|
+
# ^^^^^^^^^^^^^^^^^
|
|
1552
1671
|
#
|
|
1553
|
-
#
|
|
1554
|
-
#
|
|
1555
|
-
#
|
|
1672
|
+
# foo do |a, b = 1; local|
|
|
1673
|
+
# ^^^^^^^^^^^^^^^^^
|
|
1674
|
+
# end
|
|
1675
|
+
# ```
|
|
1556
1676
|
class BlockParametersNode < Node
|
|
1557
1677
|
# Initialize a new BlockParametersNode node.
|
|
1558
1678
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, parameters: ::T.nilable(ParametersNode), locals: T::Array[BlockLocalVariableNode], opening_loc: ::T.nilable(Location), closing_loc: ::T.nilable(Location)).void }
|
|
@@ -1598,34 +1718,40 @@ module Prism
|
|
|
1598
1718
|
|
|
1599
1719
|
# Represents the parameters of the block.
|
|
1600
1720
|
#
|
|
1601
|
-
#
|
|
1602
|
-
#
|
|
1721
|
+
# ```rb
|
|
1722
|
+
# -> (a, b = 1; local) { }
|
|
1723
|
+
# ^^^^^^^^
|
|
1603
1724
|
#
|
|
1604
|
-
#
|
|
1605
|
-
#
|
|
1606
|
-
#
|
|
1725
|
+
# foo do |a, b = 1; local|
|
|
1726
|
+
# ^^^^^^^^
|
|
1727
|
+
# end
|
|
1728
|
+
# ```
|
|
1607
1729
|
sig { returns(::T.nilable(ParametersNode)) }
|
|
1608
1730
|
def parameters; end
|
|
1609
1731
|
|
|
1610
1732
|
# Represents the local variables of the block.
|
|
1611
1733
|
#
|
|
1612
|
-
#
|
|
1613
|
-
#
|
|
1734
|
+
# ```rb
|
|
1735
|
+
# -> (a, b = 1; local) { }
|
|
1736
|
+
# ^^^^^
|
|
1614
1737
|
#
|
|
1615
|
-
#
|
|
1616
|
-
#
|
|
1617
|
-
#
|
|
1738
|
+
# foo do |a, b = 1; local|
|
|
1739
|
+
# ^^^^^
|
|
1740
|
+
# end
|
|
1741
|
+
# ```
|
|
1618
1742
|
sig { returns(T::Array[BlockLocalVariableNode]) }
|
|
1619
1743
|
def locals; end
|
|
1620
1744
|
|
|
1621
1745
|
# Represents the opening Location of the block parameters.
|
|
1622
1746
|
#
|
|
1623
|
-
#
|
|
1624
|
-
#
|
|
1747
|
+
# ```rb
|
|
1748
|
+
# -> (a, b = 1; local) { }
|
|
1749
|
+
# ^
|
|
1625
1750
|
#
|
|
1626
|
-
#
|
|
1627
|
-
#
|
|
1628
|
-
#
|
|
1751
|
+
# foo do |a, b = 1; local|
|
|
1752
|
+
# ^
|
|
1753
|
+
# end
|
|
1754
|
+
# ```
|
|
1629
1755
|
sig { returns(::T.nilable(Location)) }
|
|
1630
1756
|
def opening_loc; end
|
|
1631
1757
|
|
|
@@ -1636,12 +1762,14 @@ module Prism
|
|
|
1636
1762
|
|
|
1637
1763
|
# Represents the closing Location of the block parameters.
|
|
1638
1764
|
#
|
|
1639
|
-
#
|
|
1640
|
-
#
|
|
1765
|
+
# ```rb
|
|
1766
|
+
# -> (a, b = 1; local) { }
|
|
1767
|
+
# ^
|
|
1641
1768
|
#
|
|
1642
|
-
#
|
|
1643
|
-
#
|
|
1644
|
-
#
|
|
1769
|
+
# foo do |a, b = 1; local|
|
|
1770
|
+
# ^
|
|
1771
|
+
# end
|
|
1772
|
+
# ```
|
|
1645
1773
|
sig { returns(::T.nilable(Location)) }
|
|
1646
1774
|
def closing_loc; end
|
|
1647
1775
|
|
|
@@ -1664,8 +1792,10 @@ module Prism
|
|
|
1664
1792
|
|
|
1665
1793
|
# Represents the use of the `break` keyword.
|
|
1666
1794
|
#
|
|
1667
|
-
#
|
|
1668
|
-
#
|
|
1795
|
+
# ```rb
|
|
1796
|
+
# break foo
|
|
1797
|
+
# ^^^^^^^^^
|
|
1798
|
+
# ```
|
|
1669
1799
|
class BreakNode < Node
|
|
1670
1800
|
# Initialize a new BreakNode node.
|
|
1671
1801
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, arguments: ::T.nilable(ArgumentsNode), keyword_loc: Location).void }
|
|
@@ -1711,15 +1841,19 @@ module Prism
|
|
|
1711
1841
|
|
|
1712
1842
|
# The arguments to the break statement, if present. These can be any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
1713
1843
|
#
|
|
1714
|
-
#
|
|
1715
|
-
#
|
|
1844
|
+
# ```rb
|
|
1845
|
+
# break foo
|
|
1846
|
+
# ^^^
|
|
1847
|
+
# ```
|
|
1716
1848
|
sig { returns(::T.nilable(ArgumentsNode)) }
|
|
1717
1849
|
def arguments; end
|
|
1718
1850
|
|
|
1719
1851
|
# The Location of the `break` keyword.
|
|
1720
1852
|
#
|
|
1721
|
-
#
|
|
1722
|
-
#
|
|
1853
|
+
# ```rb
|
|
1854
|
+
# break foo
|
|
1855
|
+
# ^^^^^
|
|
1856
|
+
# ```
|
|
1723
1857
|
sig { returns(Location) }
|
|
1724
1858
|
def keyword_loc; end
|
|
1725
1859
|
|
|
@@ -1738,8 +1872,10 @@ module Prism
|
|
|
1738
1872
|
|
|
1739
1873
|
# Represents the use of the `&&=` operator on a call.
|
|
1740
1874
|
#
|
|
1741
|
-
#
|
|
1742
|
-
#
|
|
1875
|
+
# ```rb
|
|
1876
|
+
# foo.bar &&= value
|
|
1877
|
+
# ^^^^^^^^^^^^^^^^^
|
|
1878
|
+
# ```
|
|
1743
1879
|
class CallAndWriteNode < Node
|
|
1744
1880
|
# Initialize a new CallAndWriteNode node.
|
|
1745
1881
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, receiver: ::T.nilable(Node), call_operator_loc: ::T.nilable(Location), message_loc: ::T.nilable(Location), read_name: Symbol, write_name: Symbol, operator_loc: Location, value: Node).void }
|
|
@@ -1801,15 +1937,19 @@ module Prism
|
|
|
1801
1937
|
|
|
1802
1938
|
# The object that the method is being called on. This can be either `nil` or any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
1803
1939
|
#
|
|
1804
|
-
#
|
|
1805
|
-
#
|
|
1940
|
+
# ```rb
|
|
1941
|
+
# foo.bar &&= value
|
|
1942
|
+
# ^^^
|
|
1943
|
+
# ```
|
|
1806
1944
|
sig { returns(::T.nilable(Node)) }
|
|
1807
1945
|
def receiver; end
|
|
1808
1946
|
|
|
1809
1947
|
# Represents the Location of the call operator.
|
|
1810
1948
|
#
|
|
1811
|
-
#
|
|
1812
|
-
#
|
|
1949
|
+
# ```rb
|
|
1950
|
+
# foo.bar &&= value
|
|
1951
|
+
# ^
|
|
1952
|
+
# ```
|
|
1813
1953
|
sig { returns(::T.nilable(Location)) }
|
|
1814
1954
|
def call_operator_loc; end
|
|
1815
1955
|
|
|
@@ -1820,8 +1960,10 @@ module Prism
|
|
|
1820
1960
|
|
|
1821
1961
|
# Represents the Location of the message.
|
|
1822
1962
|
#
|
|
1823
|
-
#
|
|
1824
|
-
#
|
|
1963
|
+
# ```rb
|
|
1964
|
+
# foo.bar &&= value
|
|
1965
|
+
# ^^^
|
|
1966
|
+
# ```
|
|
1825
1967
|
sig { returns(::T.nilable(Location)) }
|
|
1826
1968
|
def message_loc; end
|
|
1827
1969
|
|
|
@@ -1832,22 +1974,28 @@ module Prism
|
|
|
1832
1974
|
|
|
1833
1975
|
# Represents the name of the method being called.
|
|
1834
1976
|
#
|
|
1835
|
-
#
|
|
1836
|
-
#
|
|
1977
|
+
# ```rb
|
|
1978
|
+
# foo.bar &&= value # read_name `:bar`
|
|
1979
|
+
# ^^^
|
|
1980
|
+
# ```
|
|
1837
1981
|
sig { returns(Symbol) }
|
|
1838
1982
|
def read_name; end
|
|
1839
1983
|
|
|
1840
1984
|
# Represents the name of the method being written to.
|
|
1841
1985
|
#
|
|
1842
|
-
#
|
|
1843
|
-
#
|
|
1986
|
+
# ```rb
|
|
1987
|
+
# foo.bar &&= value # write_name `:bar=`
|
|
1988
|
+
# ^^^
|
|
1989
|
+
# ```
|
|
1844
1990
|
sig { returns(Symbol) }
|
|
1845
1991
|
def write_name; end
|
|
1846
1992
|
|
|
1847
1993
|
# Represents the Location of the operator.
|
|
1848
1994
|
#
|
|
1849
|
-
#
|
|
1850
|
-
#
|
|
1995
|
+
# ```rb
|
|
1996
|
+
# foo.bar &&= value
|
|
1997
|
+
# ^^^
|
|
1998
|
+
# ```
|
|
1851
1999
|
sig { returns(Location) }
|
|
1852
2000
|
def operator_loc; end
|
|
1853
2001
|
|
|
@@ -1858,8 +2006,10 @@ module Prism
|
|
|
1858
2006
|
|
|
1859
2007
|
# Represents the value being assigned.
|
|
1860
2008
|
#
|
|
1861
|
-
#
|
|
1862
|
-
#
|
|
2009
|
+
# ```rb
|
|
2010
|
+
# foo.bar &&= value
|
|
2011
|
+
# ^^^^^
|
|
2012
|
+
# ```
|
|
1863
2013
|
sig { returns(Node) }
|
|
1864
2014
|
def value; end
|
|
1865
2015
|
|
|
@@ -1881,23 +2031,25 @@ module Prism
|
|
|
1881
2031
|
|
|
1882
2032
|
# Represents a method call, in all of the various forms that can take.
|
|
1883
2033
|
#
|
|
1884
|
-
#
|
|
1885
|
-
#
|
|
2034
|
+
# ```rb
|
|
2035
|
+
# foo
|
|
2036
|
+
# ^^^
|
|
1886
2037
|
#
|
|
1887
|
-
#
|
|
1888
|
-
#
|
|
2038
|
+
# foo()
|
|
2039
|
+
# ^^^^^
|
|
1889
2040
|
#
|
|
1890
|
-
#
|
|
1891
|
-
#
|
|
2041
|
+
# +foo
|
|
2042
|
+
# ^^^^
|
|
1892
2043
|
#
|
|
1893
|
-
#
|
|
1894
|
-
#
|
|
2044
|
+
# foo + bar
|
|
2045
|
+
# ^^^^^^^^^
|
|
1895
2046
|
#
|
|
1896
|
-
#
|
|
1897
|
-
#
|
|
2047
|
+
# foo.bar
|
|
2048
|
+
# ^^^^^^^
|
|
1898
2049
|
#
|
|
1899
|
-
#
|
|
1900
|
-
#
|
|
2050
|
+
# foo&.bar
|
|
2051
|
+
# ^^^^^^^^
|
|
2052
|
+
# ```
|
|
1901
2053
|
class CallNode < Node
|
|
1902
2054
|
# Initialize a new CallNode node.
|
|
1903
2055
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, receiver: ::T.nilable(Node), call_operator_loc: ::T.nilable(Location), name: Symbol, message_loc: ::T.nilable(Location), opening_loc: ::T.nilable(Location), arguments: ::T.nilable(ArgumentsNode), closing_loc: ::T.nilable(Location), equal_loc: ::T.nilable(Location), block: ::T.nilable(::T.any(BlockNode, BlockArgumentNode))).void }
|
|
@@ -1959,24 +2111,28 @@ module Prism
|
|
|
1959
2111
|
|
|
1960
2112
|
# The object that the method is being called on. This can be either `nil` or any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
1961
2113
|
#
|
|
1962
|
-
#
|
|
1963
|
-
#
|
|
2114
|
+
# ```rb
|
|
2115
|
+
# foo.bar
|
|
2116
|
+
# ^^^
|
|
1964
2117
|
#
|
|
1965
|
-
#
|
|
1966
|
-
#
|
|
2118
|
+
# +foo
|
|
2119
|
+
# ^^^
|
|
1967
2120
|
#
|
|
1968
|
-
#
|
|
1969
|
-
#
|
|
2121
|
+
# foo + bar
|
|
2122
|
+
# ^^^
|
|
2123
|
+
# ```
|
|
1970
2124
|
sig { returns(::T.nilable(Node)) }
|
|
1971
2125
|
def receiver; end
|
|
1972
2126
|
|
|
1973
2127
|
# Represents the Location of the call operator.
|
|
1974
2128
|
#
|
|
1975
|
-
#
|
|
1976
|
-
#
|
|
2129
|
+
# ```rb
|
|
2130
|
+
# foo.bar
|
|
2131
|
+
# ^
|
|
1977
2132
|
#
|
|
1978
|
-
#
|
|
1979
|
-
#
|
|
2133
|
+
# foo&.bar
|
|
2134
|
+
# ^^
|
|
2135
|
+
# ```
|
|
1980
2136
|
sig { returns(::T.nilable(Location)) }
|
|
1981
2137
|
def call_operator_loc; end
|
|
1982
2138
|
|
|
@@ -1987,15 +2143,19 @@ module Prism
|
|
|
1987
2143
|
|
|
1988
2144
|
# Represents the name of the method being called.
|
|
1989
2145
|
#
|
|
1990
|
-
#
|
|
1991
|
-
#
|
|
2146
|
+
# ```rb
|
|
2147
|
+
# foo.bar # name `:foo`
|
|
2148
|
+
# ^^^
|
|
2149
|
+
# ```
|
|
1992
2150
|
sig { returns(Symbol) }
|
|
1993
2151
|
def name; end
|
|
1994
2152
|
|
|
1995
2153
|
# Represents the Location of the message.
|
|
1996
2154
|
#
|
|
1997
|
-
#
|
|
1998
|
-
#
|
|
2155
|
+
# ```rb
|
|
2156
|
+
# foo.bar
|
|
2157
|
+
# ^^^
|
|
2158
|
+
# ```
|
|
1999
2159
|
sig { returns(::T.nilable(Location)) }
|
|
2000
2160
|
def message_loc; end
|
|
2001
2161
|
|
|
@@ -2006,8 +2166,10 @@ module Prism
|
|
|
2006
2166
|
|
|
2007
2167
|
# Represents the Location of the left parenthesis.
|
|
2008
2168
|
#
|
|
2009
|
-
#
|
|
2010
|
-
#
|
|
2169
|
+
# ```rb
|
|
2170
|
+
# foo(bar)
|
|
2171
|
+
# ^
|
|
2172
|
+
# ```
|
|
2011
2173
|
sig { returns(::T.nilable(Location)) }
|
|
2012
2174
|
def opening_loc; end
|
|
2013
2175
|
|
|
@@ -2018,15 +2180,19 @@ module Prism
|
|
|
2018
2180
|
|
|
2019
2181
|
# Represents the arguments to the method call. These can be any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
2020
2182
|
#
|
|
2021
|
-
#
|
|
2022
|
-
#
|
|
2183
|
+
# ```rb
|
|
2184
|
+
# foo(bar)
|
|
2185
|
+
# ^^^
|
|
2186
|
+
# ```
|
|
2023
2187
|
sig { returns(::T.nilable(ArgumentsNode)) }
|
|
2024
2188
|
def arguments; end
|
|
2025
2189
|
|
|
2026
2190
|
# Represents the Location of the right parenthesis.
|
|
2027
2191
|
#
|
|
2028
|
-
#
|
|
2029
|
-
#
|
|
2192
|
+
# ```rb
|
|
2193
|
+
# foo(bar)
|
|
2194
|
+
# ^
|
|
2195
|
+
# ```
|
|
2030
2196
|
sig { returns(::T.nilable(Location)) }
|
|
2031
2197
|
def closing_loc; end
|
|
2032
2198
|
|
|
@@ -2037,11 +2203,13 @@ module Prism
|
|
|
2037
2203
|
|
|
2038
2204
|
# Represents the Location of the equal sign, in the case that this is an attribute write.
|
|
2039
2205
|
#
|
|
2040
|
-
#
|
|
2041
|
-
#
|
|
2206
|
+
# ```rb
|
|
2207
|
+
# foo.bar = value
|
|
2208
|
+
# ^
|
|
2042
2209
|
#
|
|
2043
|
-
#
|
|
2044
|
-
#
|
|
2210
|
+
# foo[bar] = value
|
|
2211
|
+
# ^
|
|
2212
|
+
# ```
|
|
2045
2213
|
sig { returns(::T.nilable(Location)) }
|
|
2046
2214
|
def equal_loc; end
|
|
2047
2215
|
|
|
@@ -2052,8 +2220,10 @@ module Prism
|
|
|
2052
2220
|
|
|
2053
2221
|
# Represents the block that is being passed to the method.
|
|
2054
2222
|
#
|
|
2055
|
-
#
|
|
2056
|
-
#
|
|
2223
|
+
# ```rb
|
|
2224
|
+
# foo { |a| a }
|
|
2225
|
+
# ^^^^^^^^^
|
|
2226
|
+
# ```
|
|
2057
2227
|
sig { returns(::T.nilable(::T.any(BlockNode, BlockArgumentNode))) }
|
|
2058
2228
|
def block; end
|
|
2059
2229
|
|
|
@@ -2083,8 +2253,10 @@ module Prism
|
|
|
2083
2253
|
|
|
2084
2254
|
# Represents the use of an assignment operator on a call.
|
|
2085
2255
|
#
|
|
2086
|
-
#
|
|
2087
|
-
#
|
|
2256
|
+
# ```rb
|
|
2257
|
+
# foo.bar += baz
|
|
2258
|
+
# ^^^^^^^^^^^^^^
|
|
2259
|
+
# ```
|
|
2088
2260
|
class CallOperatorWriteNode < Node
|
|
2089
2261
|
# Initialize a new CallOperatorWriteNode node.
|
|
2090
2262
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, receiver: ::T.nilable(Node), call_operator_loc: ::T.nilable(Location), message_loc: ::T.nilable(Location), read_name: Symbol, write_name: Symbol, binary_operator: Symbol, binary_operator_loc: Location, value: Node).void }
|
|
@@ -2146,15 +2318,19 @@ module Prism
|
|
|
2146
2318
|
|
|
2147
2319
|
# The object that the method is being called on. This can be either `nil` or any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
2148
2320
|
#
|
|
2149
|
-
#
|
|
2150
|
-
#
|
|
2321
|
+
# ```rb
|
|
2322
|
+
# foo.bar += value
|
|
2323
|
+
# ^^^
|
|
2324
|
+
# ```
|
|
2151
2325
|
sig { returns(::T.nilable(Node)) }
|
|
2152
2326
|
def receiver; end
|
|
2153
2327
|
|
|
2154
2328
|
# Represents the Location of the call operator.
|
|
2155
2329
|
#
|
|
2156
|
-
#
|
|
2157
|
-
#
|
|
2330
|
+
# ```rb
|
|
2331
|
+
# foo.bar += value
|
|
2332
|
+
# ^
|
|
2333
|
+
# ```
|
|
2158
2334
|
sig { returns(::T.nilable(Location)) }
|
|
2159
2335
|
def call_operator_loc; end
|
|
2160
2336
|
|
|
@@ -2165,8 +2341,10 @@ module Prism
|
|
|
2165
2341
|
|
|
2166
2342
|
# Represents the Location of the message.
|
|
2167
2343
|
#
|
|
2168
|
-
#
|
|
2169
|
-
#
|
|
2344
|
+
# ```rb
|
|
2345
|
+
# foo.bar += value
|
|
2346
|
+
# ^^^
|
|
2347
|
+
# ```
|
|
2170
2348
|
sig { returns(::T.nilable(Location)) }
|
|
2171
2349
|
def message_loc; end
|
|
2172
2350
|
|
|
@@ -2177,29 +2355,37 @@ module Prism
|
|
|
2177
2355
|
|
|
2178
2356
|
# Represents the name of the method being called.
|
|
2179
2357
|
#
|
|
2180
|
-
#
|
|
2181
|
-
#
|
|
2358
|
+
# ```rb
|
|
2359
|
+
# foo.bar += value # read_name `:bar`
|
|
2360
|
+
# ^^^
|
|
2361
|
+
# ```
|
|
2182
2362
|
sig { returns(Symbol) }
|
|
2183
2363
|
def read_name; end
|
|
2184
2364
|
|
|
2185
2365
|
# Represents the name of the method being written to.
|
|
2186
2366
|
#
|
|
2187
|
-
#
|
|
2188
|
-
#
|
|
2367
|
+
# ```rb
|
|
2368
|
+
# foo.bar += value # write_name `:bar=`
|
|
2369
|
+
# ^^^
|
|
2370
|
+
# ```
|
|
2189
2371
|
sig { returns(Symbol) }
|
|
2190
2372
|
def write_name; end
|
|
2191
2373
|
|
|
2192
2374
|
# Represents the binary operator being used.
|
|
2193
2375
|
#
|
|
2194
|
-
#
|
|
2195
|
-
#
|
|
2376
|
+
# ```rb
|
|
2377
|
+
# foo.bar += value # binary_operator `:+`
|
|
2378
|
+
# ^
|
|
2379
|
+
# ```
|
|
2196
2380
|
sig { returns(Symbol) }
|
|
2197
2381
|
def binary_operator; end
|
|
2198
2382
|
|
|
2199
2383
|
# Represents the Location of the binary operator.
|
|
2200
2384
|
#
|
|
2201
|
-
#
|
|
2202
|
-
#
|
|
2385
|
+
# ```rb
|
|
2386
|
+
# foo.bar += value
|
|
2387
|
+
# ^^
|
|
2388
|
+
# ```
|
|
2203
2389
|
sig { returns(Location) }
|
|
2204
2390
|
def binary_operator_loc; end
|
|
2205
2391
|
|
|
@@ -2210,8 +2396,10 @@ module Prism
|
|
|
2210
2396
|
|
|
2211
2397
|
# Represents the value being assigned.
|
|
2212
2398
|
#
|
|
2213
|
-
#
|
|
2214
|
-
#
|
|
2399
|
+
# ```rb
|
|
2400
|
+
# foo.bar += value
|
|
2401
|
+
# ^^^^^
|
|
2402
|
+
# ```
|
|
2215
2403
|
sig { returns(Node) }
|
|
2216
2404
|
def value; end
|
|
2217
2405
|
|
|
@@ -2229,8 +2417,10 @@ module Prism
|
|
|
2229
2417
|
|
|
2230
2418
|
# Represents the use of the `||=` operator on a call.
|
|
2231
2419
|
#
|
|
2232
|
-
#
|
|
2233
|
-
#
|
|
2420
|
+
# ```rb
|
|
2421
|
+
# foo.bar ||= value
|
|
2422
|
+
# ^^^^^^^^^^^^^^^^^
|
|
2423
|
+
# ```
|
|
2234
2424
|
class CallOrWriteNode < Node
|
|
2235
2425
|
# Initialize a new CallOrWriteNode node.
|
|
2236
2426
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, receiver: ::T.nilable(Node), call_operator_loc: ::T.nilable(Location), message_loc: ::T.nilable(Location), read_name: Symbol, write_name: Symbol, operator_loc: Location, value: Node).void }
|
|
@@ -2292,15 +2482,19 @@ module Prism
|
|
|
2292
2482
|
|
|
2293
2483
|
# The object that the method is being called on. This can be either `nil` or any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
2294
2484
|
#
|
|
2295
|
-
#
|
|
2296
|
-
#
|
|
2485
|
+
# ```rb
|
|
2486
|
+
# foo.bar ||= value
|
|
2487
|
+
# ^^^
|
|
2488
|
+
# ```
|
|
2297
2489
|
sig { returns(::T.nilable(Node)) }
|
|
2298
2490
|
def receiver; end
|
|
2299
2491
|
|
|
2300
2492
|
# Represents the Location of the call operator.
|
|
2301
2493
|
#
|
|
2302
|
-
#
|
|
2303
|
-
#
|
|
2494
|
+
# ```rb
|
|
2495
|
+
# foo.bar ||= value
|
|
2496
|
+
# ^
|
|
2497
|
+
# ```
|
|
2304
2498
|
sig { returns(::T.nilable(Location)) }
|
|
2305
2499
|
def call_operator_loc; end
|
|
2306
2500
|
|
|
@@ -2311,8 +2505,10 @@ module Prism
|
|
|
2311
2505
|
|
|
2312
2506
|
# Represents the Location of the message.
|
|
2313
2507
|
#
|
|
2314
|
-
#
|
|
2315
|
-
#
|
|
2508
|
+
# ```rb
|
|
2509
|
+
# foo.bar ||= value
|
|
2510
|
+
# ^^^
|
|
2511
|
+
# ```
|
|
2316
2512
|
sig { returns(::T.nilable(Location)) }
|
|
2317
2513
|
def message_loc; end
|
|
2318
2514
|
|
|
@@ -2323,22 +2519,28 @@ module Prism
|
|
|
2323
2519
|
|
|
2324
2520
|
# Represents the name of the method being called.
|
|
2325
2521
|
#
|
|
2326
|
-
#
|
|
2327
|
-
#
|
|
2522
|
+
# ```rb
|
|
2523
|
+
# foo.bar ||= value # read_name `:bar`
|
|
2524
|
+
# ^^^
|
|
2525
|
+
# ```
|
|
2328
2526
|
sig { returns(Symbol) }
|
|
2329
2527
|
def read_name; end
|
|
2330
2528
|
|
|
2331
2529
|
# Represents the name of the method being written to.
|
|
2332
2530
|
#
|
|
2333
|
-
#
|
|
2334
|
-
#
|
|
2531
|
+
# ```rb
|
|
2532
|
+
# foo.bar ||= value # write_name `:bar=`
|
|
2533
|
+
# ^^^
|
|
2534
|
+
# ```
|
|
2335
2535
|
sig { returns(Symbol) }
|
|
2336
2536
|
def write_name; end
|
|
2337
2537
|
|
|
2338
2538
|
# Represents the Location of the operator.
|
|
2339
2539
|
#
|
|
2340
|
-
#
|
|
2341
|
-
#
|
|
2540
|
+
# ```rb
|
|
2541
|
+
# foo.bar ||= value
|
|
2542
|
+
# ^^^
|
|
2543
|
+
# ```
|
|
2342
2544
|
sig { returns(Location) }
|
|
2343
2545
|
def operator_loc; end
|
|
2344
2546
|
|
|
@@ -2349,8 +2551,10 @@ module Prism
|
|
|
2349
2551
|
|
|
2350
2552
|
# Represents the value being assigned.
|
|
2351
2553
|
#
|
|
2352
|
-
#
|
|
2353
|
-
#
|
|
2554
|
+
# ```rb
|
|
2555
|
+
# foo.bar ||= value
|
|
2556
|
+
# ^^^^^
|
|
2557
|
+
# ```
|
|
2354
2558
|
sig { returns(Node) }
|
|
2355
2559
|
def value; end
|
|
2356
2560
|
|
|
@@ -2372,16 +2576,18 @@ module Prism
|
|
|
2372
2576
|
|
|
2373
2577
|
# Represents assigning to a method call.
|
|
2374
2578
|
#
|
|
2375
|
-
#
|
|
2376
|
-
#
|
|
2579
|
+
# ```rb
|
|
2580
|
+
# foo.bar, = 1
|
|
2581
|
+
# ^^^^^^^
|
|
2377
2582
|
#
|
|
2378
|
-
#
|
|
2379
|
-
#
|
|
2380
|
-
#
|
|
2381
|
-
#
|
|
2583
|
+
# begin
|
|
2584
|
+
# rescue => foo.bar
|
|
2585
|
+
# ^^^^^^^
|
|
2586
|
+
# end
|
|
2382
2587
|
#
|
|
2383
|
-
#
|
|
2384
|
-
#
|
|
2588
|
+
# for foo.bar in baz do end
|
|
2589
|
+
# ^^^^^^^
|
|
2590
|
+
# ```
|
|
2385
2591
|
class CallTargetNode < Node
|
|
2386
2592
|
# Initialize a new CallTargetNode node.
|
|
2387
2593
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, receiver: Node, call_operator_loc: Location, name: Symbol, message_loc: Location).void }
|
|
@@ -2443,15 +2649,19 @@ module Prism
|
|
|
2443
2649
|
|
|
2444
2650
|
# The object that the method is being called on. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
2445
2651
|
#
|
|
2446
|
-
#
|
|
2447
|
-
#
|
|
2652
|
+
# ```rb
|
|
2653
|
+
# foo.bar = 1
|
|
2654
|
+
# ^^^
|
|
2655
|
+
# ```
|
|
2448
2656
|
sig { returns(Node) }
|
|
2449
2657
|
def receiver; end
|
|
2450
2658
|
|
|
2451
2659
|
# Represents the Location of the call operator.
|
|
2452
2660
|
#
|
|
2453
|
-
#
|
|
2454
|
-
#
|
|
2661
|
+
# ```rb
|
|
2662
|
+
# foo.bar = 1
|
|
2663
|
+
# ^
|
|
2664
|
+
# ```
|
|
2455
2665
|
sig { returns(Location) }
|
|
2456
2666
|
def call_operator_loc; end
|
|
2457
2667
|
|
|
@@ -2462,15 +2672,19 @@ module Prism
|
|
|
2462
2672
|
|
|
2463
2673
|
# Represents the name of the method being called.
|
|
2464
2674
|
#
|
|
2465
|
-
#
|
|
2466
|
-
#
|
|
2675
|
+
# ```rb
|
|
2676
|
+
# foo.bar = 1 # name `:foo`
|
|
2677
|
+
# ^^^
|
|
2678
|
+
# ```
|
|
2467
2679
|
sig { returns(Symbol) }
|
|
2468
2680
|
def name; end
|
|
2469
2681
|
|
|
2470
2682
|
# Represents the Location of the message.
|
|
2471
2683
|
#
|
|
2472
|
-
#
|
|
2473
|
-
#
|
|
2684
|
+
# ```rb
|
|
2685
|
+
# foo.bar = 1
|
|
2686
|
+
# ^^^
|
|
2687
|
+
# ```
|
|
2474
2688
|
sig { returns(Location) }
|
|
2475
2689
|
def message_loc; end
|
|
2476
2690
|
|
|
@@ -2493,8 +2707,10 @@ module Prism
|
|
|
2493
2707
|
|
|
2494
2708
|
# Represents assigning to a local variable in pattern matching.
|
|
2495
2709
|
#
|
|
2496
|
-
#
|
|
2497
|
-
#
|
|
2710
|
+
# ```rb
|
|
2711
|
+
# foo => [bar => baz]
|
|
2712
|
+
# ^^^^^^^^^^
|
|
2713
|
+
# ```
|
|
2498
2714
|
class CapturePatternNode < Node
|
|
2499
2715
|
# Initialize a new CapturePatternNode node.
|
|
2500
2716
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, value: Node, target: LocalVariableTargetNode, operator_loc: Location).void }
|
|
@@ -2540,22 +2756,28 @@ module Prism
|
|
|
2540
2756
|
|
|
2541
2757
|
# Represents the value to capture.
|
|
2542
2758
|
#
|
|
2543
|
-
#
|
|
2544
|
-
#
|
|
2759
|
+
# ```rb
|
|
2760
|
+
# foo => bar
|
|
2761
|
+
# ^^^
|
|
2762
|
+
# ```
|
|
2545
2763
|
sig { returns(Node) }
|
|
2546
2764
|
def value; end
|
|
2547
2765
|
|
|
2548
2766
|
# Represents the target of the capture.
|
|
2549
2767
|
#
|
|
2550
|
-
#
|
|
2551
|
-
#
|
|
2768
|
+
# ```rb
|
|
2769
|
+
# foo => bar
|
|
2770
|
+
# ^^^
|
|
2771
|
+
# ```
|
|
2552
2772
|
sig { returns(LocalVariableTargetNode) }
|
|
2553
2773
|
def target; end
|
|
2554
2774
|
|
|
2555
2775
|
# Represents the Location of the `=>` operator.
|
|
2556
2776
|
#
|
|
2557
|
-
#
|
|
2558
|
-
#
|
|
2777
|
+
# ```rb
|
|
2778
|
+
# foo => bar
|
|
2779
|
+
# ^^
|
|
2780
|
+
# ```
|
|
2559
2781
|
sig { returns(Location) }
|
|
2560
2782
|
def operator_loc; end
|
|
2561
2783
|
|
|
@@ -2574,10 +2796,12 @@ module Prism
|
|
|
2574
2796
|
|
|
2575
2797
|
# Represents the use of a case statement for pattern matching.
|
|
2576
2798
|
#
|
|
2577
|
-
#
|
|
2578
|
-
#
|
|
2579
|
-
#
|
|
2580
|
-
#
|
|
2799
|
+
# ```rb
|
|
2800
|
+
# case true
|
|
2801
|
+
# in false
|
|
2802
|
+
# end
|
|
2803
|
+
# ^^^^^^^^^
|
|
2804
|
+
# ```
|
|
2581
2805
|
class CaseMatchNode < Node
|
|
2582
2806
|
# Initialize a new CaseMatchNode node.
|
|
2583
2807
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, predicate: ::T.nilable(Node), conditions: T::Array[InNode], else_clause: ::T.nilable(ElseNode), case_keyword_loc: Location, end_keyword_loc: Location).void }
|
|
@@ -2623,29 +2847,37 @@ module Prism
|
|
|
2623
2847
|
|
|
2624
2848
|
# Represents the predicate of the case match. This can be either `nil` or any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
2625
2849
|
#
|
|
2626
|
-
#
|
|
2627
|
-
#
|
|
2850
|
+
# ```rb
|
|
2851
|
+
# case true; in false; end
|
|
2852
|
+
# ^^^^
|
|
2853
|
+
# ```
|
|
2628
2854
|
sig { returns(::T.nilable(Node)) }
|
|
2629
2855
|
def predicate; end
|
|
2630
2856
|
|
|
2631
2857
|
# Represents the conditions of the case match.
|
|
2632
2858
|
#
|
|
2633
|
-
#
|
|
2634
|
-
#
|
|
2859
|
+
# ```rb
|
|
2860
|
+
# case true; in false; end
|
|
2861
|
+
# ^^^^^^^^
|
|
2862
|
+
# ```
|
|
2635
2863
|
sig { returns(T::Array[InNode]) }
|
|
2636
2864
|
def conditions; end
|
|
2637
2865
|
|
|
2638
2866
|
# Represents the else clause of the case match.
|
|
2639
2867
|
#
|
|
2640
|
-
#
|
|
2641
|
-
#
|
|
2868
|
+
# ```rb
|
|
2869
|
+
# case true; in false; else; end
|
|
2870
|
+
# ^^^^^^^^^
|
|
2871
|
+
# ```
|
|
2642
2872
|
sig { returns(::T.nilable(ElseNode)) }
|
|
2643
2873
|
def else_clause; end
|
|
2644
2874
|
|
|
2645
2875
|
# Represents the Location of the `case` keyword.
|
|
2646
2876
|
#
|
|
2647
|
-
#
|
|
2648
|
-
#
|
|
2877
|
+
# ```rb
|
|
2878
|
+
# case true; in false; end
|
|
2879
|
+
# ^^^^
|
|
2880
|
+
# ```
|
|
2649
2881
|
sig { returns(Location) }
|
|
2650
2882
|
def case_keyword_loc; end
|
|
2651
2883
|
|
|
@@ -2656,8 +2888,10 @@ module Prism
|
|
|
2656
2888
|
|
|
2657
2889
|
# Represents the Location of the `end` keyword.
|
|
2658
2890
|
#
|
|
2659
|
-
#
|
|
2660
|
-
#
|
|
2891
|
+
# ```rb
|
|
2892
|
+
# case true; in false; end
|
|
2893
|
+
# ^^^
|
|
2894
|
+
# ```
|
|
2661
2895
|
sig { returns(Location) }
|
|
2662
2896
|
def end_keyword_loc; end
|
|
2663
2897
|
|
|
@@ -2680,10 +2914,12 @@ module Prism
|
|
|
2680
2914
|
|
|
2681
2915
|
# Represents the use of a case statement.
|
|
2682
2916
|
#
|
|
2683
|
-
#
|
|
2684
|
-
#
|
|
2685
|
-
#
|
|
2686
|
-
#
|
|
2917
|
+
# ```rb
|
|
2918
|
+
# case true
|
|
2919
|
+
# when false
|
|
2920
|
+
# end
|
|
2921
|
+
# ^^^^^^^^^^
|
|
2922
|
+
# ```
|
|
2687
2923
|
class CaseNode < Node
|
|
2688
2924
|
# Initialize a new CaseNode node.
|
|
2689
2925
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, predicate: ::T.nilable(Node), conditions: T::Array[WhenNode], else_clause: ::T.nilable(ElseNode), case_keyword_loc: Location, end_keyword_loc: Location).void }
|
|
@@ -2729,29 +2965,37 @@ module Prism
|
|
|
2729
2965
|
|
|
2730
2966
|
# Represents the predicate of the case statement. This can be either `nil` or any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
2731
2967
|
#
|
|
2732
|
-
#
|
|
2733
|
-
#
|
|
2968
|
+
# ```rb
|
|
2969
|
+
# case true; when false; end
|
|
2970
|
+
# ^^^^
|
|
2971
|
+
# ```
|
|
2734
2972
|
sig { returns(::T.nilable(Node)) }
|
|
2735
2973
|
def predicate; end
|
|
2736
2974
|
|
|
2737
2975
|
# Represents the conditions of the case statement.
|
|
2738
2976
|
#
|
|
2739
|
-
#
|
|
2740
|
-
#
|
|
2977
|
+
# ```rb
|
|
2978
|
+
# case true; when false; end
|
|
2979
|
+
# ^^^^^^^^^^
|
|
2980
|
+
# ```
|
|
2741
2981
|
sig { returns(T::Array[WhenNode]) }
|
|
2742
2982
|
def conditions; end
|
|
2743
2983
|
|
|
2744
2984
|
# Represents the else clause of the case statement.
|
|
2745
2985
|
#
|
|
2746
|
-
#
|
|
2747
|
-
#
|
|
2986
|
+
# ```rb
|
|
2987
|
+
# case true; when false; else; end
|
|
2988
|
+
# ^^^^^^^^^
|
|
2989
|
+
# ```
|
|
2748
2990
|
sig { returns(::T.nilable(ElseNode)) }
|
|
2749
2991
|
def else_clause; end
|
|
2750
2992
|
|
|
2751
2993
|
# Represents the Location of the `case` keyword.
|
|
2752
2994
|
#
|
|
2753
|
-
#
|
|
2754
|
-
#
|
|
2995
|
+
# ```rb
|
|
2996
|
+
# case true; when false; end
|
|
2997
|
+
# ^^^^
|
|
2998
|
+
# ```
|
|
2755
2999
|
sig { returns(Location) }
|
|
2756
3000
|
def case_keyword_loc; end
|
|
2757
3001
|
|
|
@@ -2762,8 +3006,10 @@ module Prism
|
|
|
2762
3006
|
|
|
2763
3007
|
# Represents the Location of the `end` keyword.
|
|
2764
3008
|
#
|
|
2765
|
-
#
|
|
2766
|
-
#
|
|
3009
|
+
# ```rb
|
|
3010
|
+
# case true; when false; end
|
|
3011
|
+
# ^^^
|
|
3012
|
+
# ```
|
|
2767
3013
|
sig { returns(Location) }
|
|
2768
3014
|
def end_keyword_loc; end
|
|
2769
3015
|
|
|
@@ -2786,8 +3032,10 @@ module Prism
|
|
|
2786
3032
|
|
|
2787
3033
|
# Represents a class declaration involving the `class` keyword.
|
|
2788
3034
|
#
|
|
2789
|
-
#
|
|
2790
|
-
#
|
|
3035
|
+
# ```rb
|
|
3036
|
+
# class Foo end
|
|
3037
|
+
# ^^^^^^^^^^^^^
|
|
3038
|
+
# ```
|
|
2791
3039
|
class ClassNode < Node
|
|
2792
3040
|
# Initialize a new ClassNode node.
|
|
2793
3041
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, locals: T::Array[Symbol], class_keyword_loc: Location, constant_path: ::T.any(ConstantReadNode, ConstantPathNode), inheritance_operator_loc: ::T.nilable(Location), superclass: ::T.nilable(Node), body: ::T.nilable(::T.any(StatementsNode, BeginNode)), end_keyword_loc: Location, name: Symbol).void }
|
|
@@ -2837,8 +3085,10 @@ module Prism
|
|
|
2837
3085
|
|
|
2838
3086
|
# Represents the Location of the `class` keyword.
|
|
2839
3087
|
#
|
|
2840
|
-
#
|
|
2841
|
-
#
|
|
3088
|
+
# ```rb
|
|
3089
|
+
# class Foo end
|
|
3090
|
+
# ^^^^^
|
|
3091
|
+
# ```
|
|
2842
3092
|
sig { returns(Location) }
|
|
2843
3093
|
def class_keyword_loc; end
|
|
2844
3094
|
|
|
@@ -2853,8 +3103,10 @@ module Prism
|
|
|
2853
3103
|
|
|
2854
3104
|
# Represents the Location of the `<` operator.
|
|
2855
3105
|
#
|
|
2856
|
-
#
|
|
2857
|
-
#
|
|
3106
|
+
# ```rb
|
|
3107
|
+
# class Foo < Bar
|
|
3108
|
+
# ^
|
|
3109
|
+
# ```
|
|
2858
3110
|
sig { returns(::T.nilable(Location)) }
|
|
2859
3111
|
def inheritance_operator_loc; end
|
|
2860
3112
|
|
|
@@ -2865,22 +3117,28 @@ module Prism
|
|
|
2865
3117
|
|
|
2866
3118
|
# Represents the superclass of the class.
|
|
2867
3119
|
#
|
|
2868
|
-
#
|
|
2869
|
-
#
|
|
3120
|
+
# ```rb
|
|
3121
|
+
# class Foo < Bar
|
|
3122
|
+
# ^^^
|
|
3123
|
+
# ```
|
|
2870
3124
|
sig { returns(::T.nilable(Node)) }
|
|
2871
3125
|
def superclass; end
|
|
2872
3126
|
|
|
2873
3127
|
# Represents the body of the class.
|
|
2874
3128
|
#
|
|
2875
|
-
#
|
|
2876
|
-
#
|
|
3129
|
+
# ```rb
|
|
3130
|
+
# class Foo; bar; end
|
|
3131
|
+
# ^^^
|
|
3132
|
+
# ```
|
|
2877
3133
|
sig { returns(::T.nilable(::T.any(StatementsNode, BeginNode))) }
|
|
2878
3134
|
def body; end
|
|
2879
3135
|
|
|
2880
3136
|
# Represents the Location of the `end` keyword.
|
|
2881
3137
|
#
|
|
2882
|
-
#
|
|
2883
|
-
#
|
|
3138
|
+
# ```rb
|
|
3139
|
+
# class Foo end
|
|
3140
|
+
# ^^^
|
|
3141
|
+
# ```
|
|
2884
3142
|
sig { returns(Location) }
|
|
2885
3143
|
def end_keyword_loc; end
|
|
2886
3144
|
|
|
@@ -2891,7 +3149,9 @@ module Prism
|
|
|
2891
3149
|
|
|
2892
3150
|
# The name of the class.
|
|
2893
3151
|
#
|
|
2894
|
-
#
|
|
3152
|
+
# ```rb
|
|
3153
|
+
# class Foo end # name `:Foo`
|
|
3154
|
+
# ```
|
|
2895
3155
|
sig { returns(Symbol) }
|
|
2896
3156
|
def name; end
|
|
2897
3157
|
|
|
@@ -2913,8 +3173,10 @@ module Prism
|
|
|
2913
3173
|
|
|
2914
3174
|
# Represents the use of the `&&=` operator for assignment to a class variable.
|
|
2915
3175
|
#
|
|
2916
|
-
#
|
|
2917
|
-
#
|
|
3176
|
+
# ```rb
|
|
3177
|
+
# @@target &&= value
|
|
3178
|
+
# ^^^^^^^^^^^^^^^^^^
|
|
3179
|
+
# ```
|
|
2918
3180
|
class ClassVariableAndWriteNode < Node
|
|
2919
3181
|
# Initialize a new ClassVariableAndWriteNode node.
|
|
2920
3182
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, operator_loc: Location, value: Node).void }
|
|
@@ -2960,15 +3222,19 @@ module Prism
|
|
|
2960
3222
|
|
|
2961
3223
|
# The name of the class variable, which is a `@@` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers).
|
|
2962
3224
|
#
|
|
2963
|
-
#
|
|
2964
|
-
#
|
|
3225
|
+
# ```rb
|
|
3226
|
+
# @@target &&= value # name `:@@target`
|
|
3227
|
+
# ^^^^^^^^
|
|
3228
|
+
# ```
|
|
2965
3229
|
sig { returns(Symbol) }
|
|
2966
3230
|
def name; end
|
|
2967
3231
|
|
|
2968
3232
|
# Represents the Location of the variable name.
|
|
2969
3233
|
#
|
|
2970
|
-
#
|
|
2971
|
-
#
|
|
3234
|
+
# ```rb
|
|
3235
|
+
# @@target &&= value
|
|
3236
|
+
# ^^^^^^^^
|
|
3237
|
+
# ```
|
|
2972
3238
|
sig { returns(Location) }
|
|
2973
3239
|
def name_loc; end
|
|
2974
3240
|
|
|
@@ -2979,8 +3245,10 @@ module Prism
|
|
|
2979
3245
|
|
|
2980
3246
|
# Represents the Location of the `&&=` operator.
|
|
2981
3247
|
#
|
|
2982
|
-
#
|
|
2983
|
-
#
|
|
3248
|
+
# ```rb
|
|
3249
|
+
# @@target &&= value
|
|
3250
|
+
# ^^^
|
|
3251
|
+
# ```
|
|
2984
3252
|
sig { returns(Location) }
|
|
2985
3253
|
def operator_loc; end
|
|
2986
3254
|
|
|
@@ -2991,8 +3259,10 @@ module Prism
|
|
|
2991
3259
|
|
|
2992
3260
|
# Represents the value being assigned. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
2993
3261
|
#
|
|
2994
|
-
#
|
|
2995
|
-
#
|
|
3262
|
+
# ```rb
|
|
3263
|
+
# @@target &&= value
|
|
3264
|
+
# ^^^^^
|
|
3265
|
+
# ```
|
|
2996
3266
|
sig { returns(Node) }
|
|
2997
3267
|
def value; end
|
|
2998
3268
|
|
|
@@ -3006,8 +3276,10 @@ module Prism
|
|
|
3006
3276
|
|
|
3007
3277
|
# Represents assigning to a class variable using an operator that isn't `=`.
|
|
3008
3278
|
#
|
|
3009
|
-
#
|
|
3010
|
-
#
|
|
3279
|
+
# ```rb
|
|
3280
|
+
# @@target += value
|
|
3281
|
+
# ^^^^^^^^^^^^^^^^^
|
|
3282
|
+
# ```
|
|
3011
3283
|
class ClassVariableOperatorWriteNode < Node
|
|
3012
3284
|
# Initialize a new ClassVariableOperatorWriteNode node.
|
|
3013
3285
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, binary_operator_loc: Location, value: Node, binary_operator: Symbol).void }
|
|
@@ -3087,8 +3359,10 @@ module Prism
|
|
|
3087
3359
|
|
|
3088
3360
|
# Represents the use of the `||=` operator for assignment to a class variable.
|
|
3089
3361
|
#
|
|
3090
|
-
#
|
|
3091
|
-
#
|
|
3362
|
+
# ```rb
|
|
3363
|
+
# @@target ||= value
|
|
3364
|
+
# ^^^^^^^^^^^^^^^^^^
|
|
3365
|
+
# ```
|
|
3092
3366
|
class ClassVariableOrWriteNode < Node
|
|
3093
3367
|
# Initialize a new ClassVariableOrWriteNode node.
|
|
3094
3368
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, operator_loc: Location, value: Node).void }
|
|
@@ -3168,8 +3442,10 @@ module Prism
|
|
|
3168
3442
|
|
|
3169
3443
|
# Represents referencing a class variable.
|
|
3170
3444
|
#
|
|
3171
|
-
#
|
|
3172
|
-
#
|
|
3445
|
+
# ```rb
|
|
3446
|
+
# @@foo
|
|
3447
|
+
# ^^^^^
|
|
3448
|
+
# ```
|
|
3173
3449
|
class ClassVariableReadNode < Node
|
|
3174
3450
|
# Initialize a new ClassVariableReadNode node.
|
|
3175
3451
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol).void }
|
|
@@ -3215,9 +3491,11 @@ module Prism
|
|
|
3215
3491
|
|
|
3216
3492
|
# The name of the class variable, which is a `@@` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers).
|
|
3217
3493
|
#
|
|
3218
|
-
#
|
|
3494
|
+
# ```rb
|
|
3495
|
+
# @@abc # name `:@@abc`
|
|
3219
3496
|
#
|
|
3220
|
-
#
|
|
3497
|
+
# @@_test # name `:@@_test`
|
|
3498
|
+
# ```
|
|
3221
3499
|
sig { returns(Symbol) }
|
|
3222
3500
|
def name; end
|
|
3223
3501
|
|
|
@@ -3227,8 +3505,10 @@ module Prism
|
|
|
3227
3505
|
|
|
3228
3506
|
# Represents writing to a class variable in a context that doesn't have an explicit value.
|
|
3229
3507
|
#
|
|
3230
|
-
#
|
|
3231
|
-
#
|
|
3508
|
+
# ```rb
|
|
3509
|
+
# @@foo, @@bar = baz
|
|
3510
|
+
# ^^^^^ ^^^^^
|
|
3511
|
+
# ```
|
|
3232
3512
|
class ClassVariableTargetNode < Node
|
|
3233
3513
|
# Initialize a new ClassVariableTargetNode node.
|
|
3234
3514
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol).void }
|
|
@@ -3282,8 +3562,10 @@ module Prism
|
|
|
3282
3562
|
|
|
3283
3563
|
# Represents writing to a class variable.
|
|
3284
3564
|
#
|
|
3285
|
-
#
|
|
3286
|
-
#
|
|
3565
|
+
# ```rb
|
|
3566
|
+
# @@foo = 1
|
|
3567
|
+
# ^^^^^^^^^
|
|
3568
|
+
# ```
|
|
3287
3569
|
class ClassVariableWriteNode < Node
|
|
3288
3570
|
# Initialize a new ClassVariableWriteNode node.
|
|
3289
3571
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, value: Node, operator_loc: Location).void }
|
|
@@ -3329,16 +3611,20 @@ module Prism
|
|
|
3329
3611
|
|
|
3330
3612
|
# The name of the class variable, which is a `@@` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers).
|
|
3331
3613
|
#
|
|
3332
|
-
#
|
|
3614
|
+
# ```rb
|
|
3615
|
+
# @@abc = 123 # name `@@abc`
|
|
3333
3616
|
#
|
|
3334
|
-
#
|
|
3617
|
+
# @@_test = :test # name `@@_test`
|
|
3618
|
+
# ```
|
|
3335
3619
|
sig { returns(Symbol) }
|
|
3336
3620
|
def name; end
|
|
3337
3621
|
|
|
3338
3622
|
# The Location of the variable name.
|
|
3339
3623
|
#
|
|
3340
|
-
#
|
|
3341
|
-
#
|
|
3624
|
+
# ```rb
|
|
3625
|
+
# @@foo = :bar
|
|
3626
|
+
# ^^^^^
|
|
3627
|
+
# ```
|
|
3342
3628
|
sig { returns(Location) }
|
|
3343
3629
|
def name_loc; end
|
|
3344
3630
|
|
|
@@ -3349,18 +3635,22 @@ module Prism
|
|
|
3349
3635
|
|
|
3350
3636
|
# The value to write to the class variable. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
3351
3637
|
#
|
|
3352
|
-
#
|
|
3353
|
-
#
|
|
3638
|
+
# ```rb
|
|
3639
|
+
# @@foo = :bar
|
|
3640
|
+
# ^^^^
|
|
3354
3641
|
#
|
|
3355
|
-
#
|
|
3356
|
-
#
|
|
3642
|
+
# @@_xyz = 123
|
|
3643
|
+
# ^^^
|
|
3644
|
+
# ```
|
|
3357
3645
|
sig { returns(Node) }
|
|
3358
3646
|
def value; end
|
|
3359
3647
|
|
|
3360
3648
|
# The Location of the `=` operator.
|
|
3361
3649
|
#
|
|
3362
|
-
#
|
|
3363
|
-
#
|
|
3650
|
+
# ```rb
|
|
3651
|
+
# @@foo = :bar
|
|
3652
|
+
# ^
|
|
3653
|
+
# ```
|
|
3364
3654
|
sig { returns(Location) }
|
|
3365
3655
|
def operator_loc; end
|
|
3366
3656
|
|
|
@@ -3379,8 +3669,10 @@ module Prism
|
|
|
3379
3669
|
|
|
3380
3670
|
# Represents the use of the `&&=` operator for assignment to a constant.
|
|
3381
3671
|
#
|
|
3382
|
-
#
|
|
3383
|
-
#
|
|
3672
|
+
# ```rb
|
|
3673
|
+
# Target &&= value
|
|
3674
|
+
# ^^^^^^^^^^^^^^^^
|
|
3675
|
+
# ```
|
|
3384
3676
|
class ConstantAndWriteNode < Node
|
|
3385
3677
|
# Initialize a new ConstantAndWriteNode node.
|
|
3386
3678
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, operator_loc: Location, value: Node).void }
|
|
@@ -3460,8 +3752,10 @@ module Prism
|
|
|
3460
3752
|
|
|
3461
3753
|
# Represents assigning to a constant using an operator that isn't `=`.
|
|
3462
3754
|
#
|
|
3463
|
-
#
|
|
3464
|
-
#
|
|
3755
|
+
# ```rb
|
|
3756
|
+
# Target += value
|
|
3757
|
+
# ^^^^^^^^^^^^^^^
|
|
3758
|
+
# ```
|
|
3465
3759
|
class ConstantOperatorWriteNode < Node
|
|
3466
3760
|
# Initialize a new ConstantOperatorWriteNode node.
|
|
3467
3761
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, binary_operator_loc: Location, value: Node, binary_operator: Symbol).void }
|
|
@@ -3541,8 +3835,10 @@ module Prism
|
|
|
3541
3835
|
|
|
3542
3836
|
# Represents the use of the `||=` operator for assignment to a constant.
|
|
3543
3837
|
#
|
|
3544
|
-
#
|
|
3545
|
-
#
|
|
3838
|
+
# ```rb
|
|
3839
|
+
# Target ||= value
|
|
3840
|
+
# ^^^^^^^^^^^^^^^^
|
|
3841
|
+
# ```
|
|
3546
3842
|
class ConstantOrWriteNode < Node
|
|
3547
3843
|
# Initialize a new ConstantOrWriteNode node.
|
|
3548
3844
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, operator_loc: Location, value: Node).void }
|
|
@@ -3622,8 +3918,10 @@ module Prism
|
|
|
3622
3918
|
|
|
3623
3919
|
# Represents the use of the `&&=` operator for assignment to a constant path.
|
|
3624
3920
|
#
|
|
3625
|
-
#
|
|
3626
|
-
#
|
|
3921
|
+
# ```rb
|
|
3922
|
+
# Parent::Child &&= value
|
|
3923
|
+
# ^^^^^^^^^^^^^^^^^^^^^^^
|
|
3924
|
+
# ```
|
|
3627
3925
|
class ConstantPathAndWriteNode < Node
|
|
3628
3926
|
# Initialize a new ConstantPathAndWriteNode node.
|
|
3629
3927
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, target: ConstantPathNode, operator_loc: Location, value: Node).void }
|
|
@@ -3694,8 +3992,10 @@ module Prism
|
|
|
3694
3992
|
|
|
3695
3993
|
# Represents accessing a constant through a path of `::` operators.
|
|
3696
3994
|
#
|
|
3697
|
-
#
|
|
3698
|
-
#
|
|
3995
|
+
# ```rb
|
|
3996
|
+
# Foo::Bar
|
|
3997
|
+
# ^^^^^^^^
|
|
3998
|
+
# ```
|
|
3699
3999
|
class ConstantPathNode < Node
|
|
3700
4000
|
# Initialize a new ConstantPathNode node.
|
|
3701
4001
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, parent: ::T.nilable(Node), name: ::T.nilable(Symbol), delimiter_loc: Location, name_loc: Location).void }
|
|
@@ -3741,14 +4041,16 @@ module Prism
|
|
|
3741
4041
|
|
|
3742
4042
|
# The left-hand node of the path, if present. It can be `nil` or any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). It will be `nil` when the constant lookup is at the root of the module tree.
|
|
3743
4043
|
#
|
|
3744
|
-
#
|
|
3745
|
-
#
|
|
4044
|
+
# ```rb
|
|
4045
|
+
# Foo::Bar
|
|
4046
|
+
# ^^^
|
|
3746
4047
|
#
|
|
3747
|
-
#
|
|
3748
|
-
#
|
|
4048
|
+
# self::Test
|
|
4049
|
+
# ^^^^
|
|
3749
4050
|
#
|
|
3750
|
-
#
|
|
3751
|
-
#
|
|
4051
|
+
# a.b::C
|
|
4052
|
+
# ^^^
|
|
4053
|
+
# ```
|
|
3752
4054
|
sig { returns(::T.nilable(Node)) }
|
|
3753
4055
|
def parent; end
|
|
3754
4056
|
|
|
@@ -3758,11 +4060,12 @@ module Prism
|
|
|
3758
4060
|
|
|
3759
4061
|
# The Location of the `::` delimiter.
|
|
3760
4062
|
#
|
|
3761
|
-
#
|
|
3762
|
-
#
|
|
4063
|
+
# ```rb
|
|
4064
|
+
# ^^
|
|
3763
4065
|
#
|
|
3764
|
-
#
|
|
3765
|
-
#
|
|
4066
|
+
# One::Two
|
|
4067
|
+
# ^^
|
|
4068
|
+
# ```
|
|
3766
4069
|
sig { returns(Location) }
|
|
3767
4070
|
def delimiter_loc; end
|
|
3768
4071
|
|
|
@@ -3773,11 +4076,12 @@ module Prism
|
|
|
3773
4076
|
|
|
3774
4077
|
# The Location of the name of the constant.
|
|
3775
4078
|
#
|
|
3776
|
-
#
|
|
3777
|
-
#
|
|
4079
|
+
# ```rb
|
|
4080
|
+
# ^^^
|
|
3778
4081
|
#
|
|
3779
|
-
#
|
|
3780
|
-
#
|
|
4082
|
+
# One::Two
|
|
4083
|
+
# ^^^
|
|
4084
|
+
# ```
|
|
3781
4085
|
sig { returns(Location) }
|
|
3782
4086
|
def name_loc; end
|
|
3783
4087
|
|
|
@@ -3796,8 +4100,10 @@ module Prism
|
|
|
3796
4100
|
|
|
3797
4101
|
# Represents assigning to a constant path using an operator that isn't `=`.
|
|
3798
4102
|
#
|
|
3799
|
-
#
|
|
3800
|
-
#
|
|
4103
|
+
# ```rb
|
|
4104
|
+
# Parent::Child += value
|
|
4105
|
+
# ^^^^^^^^^^^^^^^^^^^^^^
|
|
4106
|
+
# ```
|
|
3801
4107
|
class ConstantPathOperatorWriteNode < Node
|
|
3802
4108
|
# Initialize a new ConstantPathOperatorWriteNode node.
|
|
3803
4109
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, target: ConstantPathNode, binary_operator_loc: Location, value: Node, binary_operator: Symbol).void }
|
|
@@ -3868,8 +4174,10 @@ module Prism
|
|
|
3868
4174
|
|
|
3869
4175
|
# Represents the use of the `||=` operator for assignment to a constant path.
|
|
3870
4176
|
#
|
|
3871
|
-
#
|
|
3872
|
-
#
|
|
4177
|
+
# ```rb
|
|
4178
|
+
# Parent::Child ||= value
|
|
4179
|
+
# ^^^^^^^^^^^^^^^^^^^^^^^
|
|
4180
|
+
# ```
|
|
3873
4181
|
class ConstantPathOrWriteNode < Node
|
|
3874
4182
|
# Initialize a new ConstantPathOrWriteNode node.
|
|
3875
4183
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, target: ConstantPathNode, operator_loc: Location, value: Node).void }
|
|
@@ -3940,8 +4248,10 @@ module Prism
|
|
|
3940
4248
|
|
|
3941
4249
|
# Represents writing to a constant path in a context that doesn't have an explicit value.
|
|
3942
4250
|
#
|
|
3943
|
-
#
|
|
3944
|
-
#
|
|
4251
|
+
# ```rb
|
|
4252
|
+
# Foo::Foo, Bar::Bar = baz
|
|
4253
|
+
# ^^^^^^^^ ^^^^^^^^
|
|
4254
|
+
# ```
|
|
3945
4255
|
class ConstantPathTargetNode < Node
|
|
3946
4256
|
# Initialize a new ConstantPathTargetNode node.
|
|
3947
4257
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, parent: ::T.nilable(Node), name: ::T.nilable(Symbol), delimiter_loc: Location, name_loc: Location).void }
|
|
@@ -4021,14 +4331,13 @@ module Prism
|
|
|
4021
4331
|
|
|
4022
4332
|
# Represents writing to a constant path.
|
|
4023
4333
|
#
|
|
4024
|
-
#
|
|
4025
|
-
#
|
|
4026
|
-
#
|
|
4027
|
-
# Foo::Bar = 1
|
|
4028
|
-
# ^^^^^^^^^^^^
|
|
4334
|
+
# ```rb
|
|
4335
|
+
# ^^^^^^^^^
|
|
4029
4336
|
#
|
|
4030
|
-
#
|
|
4031
|
-
#
|
|
4337
|
+
# Foo::Bar = 1
|
|
4338
|
+
# ^^^^^^^^^^^^
|
|
4339
|
+
# ^^^^^^^^^^^^^^
|
|
4340
|
+
# ```
|
|
4032
4341
|
class ConstantPathWriteNode < Node
|
|
4033
4342
|
# Initialize a new ConstantPathWriteNode node.
|
|
4034
4343
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, target: ConstantPathNode, operator_loc: Location, value: Node).void }
|
|
@@ -4074,18 +4383,19 @@ module Prism
|
|
|
4074
4383
|
|
|
4075
4384
|
# A node representing the constant path being written to.
|
|
4076
4385
|
#
|
|
4077
|
-
#
|
|
4078
|
-
#
|
|
4079
|
-
#
|
|
4080
|
-
#
|
|
4081
|
-
#
|
|
4386
|
+
# ```rb
|
|
4387
|
+
# Foo::Bar = 1
|
|
4388
|
+
# ^^^^^^^^
|
|
4389
|
+
# ^^^^^
|
|
4390
|
+
# ```
|
|
4082
4391
|
sig { returns(ConstantPathNode) }
|
|
4083
4392
|
def target; end
|
|
4084
4393
|
|
|
4085
4394
|
# The Location of the `=` operator.
|
|
4086
4395
|
#
|
|
4087
|
-
#
|
|
4088
|
-
#
|
|
4396
|
+
# ```rb
|
|
4397
|
+
# ^
|
|
4398
|
+
# ```
|
|
4089
4399
|
sig { returns(Location) }
|
|
4090
4400
|
def operator_loc; end
|
|
4091
4401
|
|
|
@@ -4096,8 +4406,10 @@ module Prism
|
|
|
4096
4406
|
|
|
4097
4407
|
# The value to write to the constant path. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
4098
4408
|
#
|
|
4099
|
-
#
|
|
4100
|
-
#
|
|
4409
|
+
# ```rb
|
|
4410
|
+
# FOO::BAR = :abc
|
|
4411
|
+
# ^^^^
|
|
4412
|
+
# ```
|
|
4101
4413
|
sig { returns(Node) }
|
|
4102
4414
|
def value; end
|
|
4103
4415
|
|
|
@@ -4111,8 +4423,10 @@ module Prism
|
|
|
4111
4423
|
|
|
4112
4424
|
# Represents referencing a constant.
|
|
4113
4425
|
#
|
|
4114
|
-
#
|
|
4115
|
-
#
|
|
4426
|
+
# ```rb
|
|
4427
|
+
# Foo
|
|
4428
|
+
# ^^^
|
|
4429
|
+
# ```
|
|
4116
4430
|
class ConstantReadNode < Node
|
|
4117
4431
|
# Initialize a new ConstantReadNode node.
|
|
4118
4432
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol).void }
|
|
@@ -4158,9 +4472,11 @@ module Prism
|
|
|
4158
4472
|
|
|
4159
4473
|
# The name of the [constant](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#constants).
|
|
4160
4474
|
#
|
|
4161
|
-
#
|
|
4475
|
+
# ```rb
|
|
4476
|
+
# X # name `:X`
|
|
4162
4477
|
#
|
|
4163
|
-
#
|
|
4478
|
+
# SOME_CONSTANT # name `:SOME_CONSTANT`
|
|
4479
|
+
# ```
|
|
4164
4480
|
sig { returns(Symbol) }
|
|
4165
4481
|
def name; end
|
|
4166
4482
|
|
|
@@ -4170,8 +4486,10 @@ module Prism
|
|
|
4170
4486
|
|
|
4171
4487
|
# Represents writing to a constant in a context that doesn't have an explicit value.
|
|
4172
4488
|
#
|
|
4173
|
-
#
|
|
4174
|
-
#
|
|
4489
|
+
# ```rb
|
|
4490
|
+
# Foo, Bar = baz
|
|
4491
|
+
# ^^^ ^^^
|
|
4492
|
+
# ```
|
|
4175
4493
|
class ConstantTargetNode < Node
|
|
4176
4494
|
# Initialize a new ConstantTargetNode node.
|
|
4177
4495
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol).void }
|
|
@@ -4225,8 +4543,10 @@ module Prism
|
|
|
4225
4543
|
|
|
4226
4544
|
# Represents writing to a constant.
|
|
4227
4545
|
#
|
|
4228
|
-
#
|
|
4229
|
-
#
|
|
4546
|
+
# ```rb
|
|
4547
|
+
# Foo = 1
|
|
4548
|
+
# ^^^^^^^
|
|
4549
|
+
# ```
|
|
4230
4550
|
class ConstantWriteNode < Node
|
|
4231
4551
|
# Initialize a new ConstantWriteNode node.
|
|
4232
4552
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, value: Node, operator_loc: Location).void }
|
|
@@ -4272,16 +4592,20 @@ module Prism
|
|
|
4272
4592
|
|
|
4273
4593
|
# The name of the [constant](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#constants).
|
|
4274
4594
|
#
|
|
4275
|
-
#
|
|
4595
|
+
# ```rb
|
|
4596
|
+
# Foo = :bar # name `:Foo`
|
|
4276
4597
|
#
|
|
4277
|
-
#
|
|
4598
|
+
# XYZ = 1 # name `:XYZ`
|
|
4599
|
+
# ```
|
|
4278
4600
|
sig { returns(Symbol) }
|
|
4279
4601
|
def name; end
|
|
4280
4602
|
|
|
4281
4603
|
# The Location of the constant name.
|
|
4282
4604
|
#
|
|
4283
|
-
#
|
|
4284
|
-
#
|
|
4605
|
+
# ```rb
|
|
4606
|
+
# FOO = 1
|
|
4607
|
+
# ^^^
|
|
4608
|
+
# ```
|
|
4285
4609
|
sig { returns(Location) }
|
|
4286
4610
|
def name_loc; end
|
|
4287
4611
|
|
|
@@ -4292,18 +4616,22 @@ module Prism
|
|
|
4292
4616
|
|
|
4293
4617
|
# The value to write to the constant. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
4294
4618
|
#
|
|
4295
|
-
#
|
|
4296
|
-
#
|
|
4619
|
+
# ```rb
|
|
4620
|
+
# FOO = :bar
|
|
4621
|
+
# ^^^^
|
|
4297
4622
|
#
|
|
4298
|
-
#
|
|
4299
|
-
#
|
|
4623
|
+
# MyClass = Class.new
|
|
4624
|
+
# ^^^^^^^^^
|
|
4625
|
+
# ```
|
|
4300
4626
|
sig { returns(Node) }
|
|
4301
4627
|
def value; end
|
|
4302
4628
|
|
|
4303
4629
|
# The Location of the `=` operator.
|
|
4304
4630
|
#
|
|
4305
|
-
#
|
|
4306
|
-
#
|
|
4631
|
+
# ```rb
|
|
4632
|
+
# FOO = :bar
|
|
4633
|
+
# ^
|
|
4634
|
+
# ```
|
|
4307
4635
|
sig { returns(Location) }
|
|
4308
4636
|
def operator_loc; end
|
|
4309
4637
|
|
|
@@ -4322,9 +4650,11 @@ module Prism
|
|
|
4322
4650
|
|
|
4323
4651
|
# Represents a method definition.
|
|
4324
4652
|
#
|
|
4325
|
-
#
|
|
4326
|
-
#
|
|
4327
|
-
#
|
|
4653
|
+
# ```rb
|
|
4654
|
+
# def method
|
|
4655
|
+
# end
|
|
4656
|
+
# ^^^^^^^^^^
|
|
4657
|
+
# ```
|
|
4328
4658
|
class DefNode < Node
|
|
4329
4659
|
# Initialize a new DefNode node.
|
|
4330
4660
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, receiver: ::T.nilable(Node), parameters: ::T.nilable(ParametersNode), body: ::T.nilable(::T.any(StatementsNode, BeginNode)), locals: T::Array[Symbol], def_keyword_loc: Location, operator_loc: ::T.nilable(Location), lparen_loc: ::T.nilable(Location), rparen_loc: ::T.nilable(Location), equal_loc: ::T.nilable(Location), end_keyword_loc: ::T.nilable(Location)).void }
|
|
@@ -4481,8 +4811,10 @@ module Prism
|
|
|
4481
4811
|
|
|
4482
4812
|
# Represents the use of the `defined?` keyword.
|
|
4483
4813
|
#
|
|
4484
|
-
#
|
|
4485
|
-
#
|
|
4814
|
+
# ```rb
|
|
4815
|
+
# defined?(a)
|
|
4816
|
+
# ^^^^^^^^^^^
|
|
4817
|
+
# ```
|
|
4486
4818
|
class DefinedNode < Node
|
|
4487
4819
|
# Initialize a new DefinedNode node.
|
|
4488
4820
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, lparen_loc: ::T.nilable(Location), value: Node, rparen_loc: ::T.nilable(Location), keyword_loc: Location).void }
|
|
@@ -4575,8 +4907,10 @@ module Prism
|
|
|
4575
4907
|
|
|
4576
4908
|
# Represents an `else` clause in a `case`, `if`, or `unless` statement.
|
|
4577
4909
|
#
|
|
4578
|
-
#
|
|
4579
|
-
#
|
|
4910
|
+
# ```rb
|
|
4911
|
+
# if a then b else c end
|
|
4912
|
+
# ^^^^^^^^^^
|
|
4913
|
+
# ```
|
|
4580
4914
|
class ElseNode < Node
|
|
4581
4915
|
# Initialize a new ElseNode node.
|
|
4582
4916
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, else_keyword_loc: Location, statements: ::T.nilable(StatementsNode), end_keyword_loc: ::T.nilable(Location)).void }
|
|
@@ -4656,8 +4990,10 @@ module Prism
|
|
|
4656
4990
|
|
|
4657
4991
|
# Represents an interpolated set of statements.
|
|
4658
4992
|
#
|
|
4659
|
-
#
|
|
4660
|
-
#
|
|
4993
|
+
# ```rb
|
|
4994
|
+
# "foo #{bar}"
|
|
4995
|
+
# ^^^^^^
|
|
4996
|
+
# ```
|
|
4661
4997
|
class EmbeddedStatementsNode < Node
|
|
4662
4998
|
# Initialize a new EmbeddedStatementsNode node.
|
|
4663
4999
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, opening_loc: Location, statements: ::T.nilable(StatementsNode), closing_loc: Location).void }
|
|
@@ -4737,8 +5073,10 @@ module Prism
|
|
|
4737
5073
|
|
|
4738
5074
|
# Represents an interpolated variable.
|
|
4739
5075
|
#
|
|
4740
|
-
#
|
|
4741
|
-
#
|
|
5076
|
+
# ```rb
|
|
5077
|
+
# "foo #@bar"
|
|
5078
|
+
# ^^^^^
|
|
5079
|
+
# ```
|
|
4742
5080
|
class EmbeddedVariableNode < Node
|
|
4743
5081
|
# Initialize a new EmbeddedVariableNode node.
|
|
4744
5082
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, operator_loc: Location, variable: ::T.any(InstanceVariableReadNode, ClassVariableReadNode, GlobalVariableReadNode, BackReferenceReadNode, NumberedReferenceReadNode)).void }
|
|
@@ -4805,12 +5143,14 @@ module Prism
|
|
|
4805
5143
|
|
|
4806
5144
|
# Represents an `ensure` clause in a `begin` statement.
|
|
4807
5145
|
#
|
|
4808
|
-
#
|
|
4809
|
-
#
|
|
4810
|
-
#
|
|
4811
|
-
#
|
|
4812
|
-
#
|
|
4813
|
-
#
|
|
5146
|
+
# ```rb
|
|
5147
|
+
# begin
|
|
5148
|
+
# foo
|
|
5149
|
+
# ensure
|
|
5150
|
+
# ^^^^^^
|
|
5151
|
+
# bar
|
|
5152
|
+
# end
|
|
5153
|
+
# ```
|
|
4814
5154
|
class EnsureNode < Node
|
|
4815
5155
|
# Initialize a new EnsureNode node.
|
|
4816
5156
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, ensure_keyword_loc: Location, statements: ::T.nilable(StatementsNode), end_keyword_loc: Location).void }
|
|
@@ -4942,8 +5282,10 @@ module Prism
|
|
|
4942
5282
|
|
|
4943
5283
|
# Represents the use of the literal `false` keyword.
|
|
4944
5284
|
#
|
|
4945
|
-
#
|
|
4946
|
-
#
|
|
5285
|
+
# ```rb
|
|
5286
|
+
# false
|
|
5287
|
+
# ^^^^^
|
|
5288
|
+
# ```
|
|
4947
5289
|
class FalseNode < Node
|
|
4948
5290
|
# Initialize a new FalseNode node.
|
|
4949
5291
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer).void }
|
|
@@ -4993,17 +5335,19 @@ module Prism
|
|
|
4993
5335
|
|
|
4994
5336
|
# Represents a find pattern in pattern matching.
|
|
4995
5337
|
#
|
|
4996
|
-
#
|
|
4997
|
-
#
|
|
5338
|
+
# ```rb
|
|
5339
|
+
# foo in *bar, baz, *qux
|
|
5340
|
+
# ^^^^^^^^^^^^^^^
|
|
4998
5341
|
#
|
|
4999
|
-
#
|
|
5000
|
-
#
|
|
5342
|
+
# foo in [*bar, baz, *qux]
|
|
5343
|
+
# ^^^^^^^^^^^^^^^^^
|
|
5001
5344
|
#
|
|
5002
|
-
#
|
|
5003
|
-
#
|
|
5345
|
+
# foo in Foo(*bar, baz, *qux)
|
|
5346
|
+
# ^^^^^^^^^^^^^^^^^^^^
|
|
5004
5347
|
#
|
|
5005
|
-
#
|
|
5006
|
-
#
|
|
5348
|
+
# foo => *bar, baz, *qux
|
|
5349
|
+
# ^^^^^^^^^^^^^^^
|
|
5350
|
+
# ```
|
|
5007
5351
|
class FindPatternNode < Node
|
|
5008
5352
|
# Initialize a new FindPatternNode node.
|
|
5009
5353
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, constant: ::T.nilable(::T.any(ConstantPathNode, ConstantReadNode)), left: SplatNode, requireds: T::Array[Node], right: SplatNode, opening_loc: ::T.nilable(Location), closing_loc: ::T.nilable(Location)).void }
|
|
@@ -5049,48 +5393,58 @@ module Prism
|
|
|
5049
5393
|
|
|
5050
5394
|
# Represents the optional constant preceding the pattern
|
|
5051
5395
|
#
|
|
5052
|
-
#
|
|
5053
|
-
#
|
|
5396
|
+
# ```rb
|
|
5397
|
+
# foo in Foo(*bar, baz, *qux)
|
|
5398
|
+
# ^^^
|
|
5399
|
+
# ```
|
|
5054
5400
|
sig { returns(::T.nilable(::T.any(ConstantPathNode, ConstantReadNode))) }
|
|
5055
5401
|
def constant; end
|
|
5056
5402
|
|
|
5057
5403
|
# Represents the first wildcard node in the pattern.
|
|
5058
5404
|
#
|
|
5059
|
-
#
|
|
5060
|
-
#
|
|
5405
|
+
# ```rb
|
|
5406
|
+
# foo in *bar, baz, *qux
|
|
5407
|
+
# ^^^^
|
|
5061
5408
|
#
|
|
5062
|
-
#
|
|
5063
|
-
#
|
|
5409
|
+
# foo in Foo(*bar, baz, *qux)
|
|
5410
|
+
# ^^^^
|
|
5411
|
+
# ```
|
|
5064
5412
|
sig { returns(SplatNode) }
|
|
5065
5413
|
def left; end
|
|
5066
5414
|
|
|
5067
5415
|
# Represents the nodes in between the wildcards.
|
|
5068
5416
|
#
|
|
5069
|
-
#
|
|
5070
|
-
#
|
|
5417
|
+
# ```rb
|
|
5418
|
+
# foo in *bar, baz, *qux
|
|
5419
|
+
# ^^^
|
|
5071
5420
|
#
|
|
5072
|
-
#
|
|
5073
|
-
#
|
|
5421
|
+
# foo in Foo(*bar, baz, 1, *qux)
|
|
5422
|
+
# ^^^^^^
|
|
5423
|
+
# ```
|
|
5074
5424
|
sig { returns(T::Array[Node]) }
|
|
5075
5425
|
def requireds; end
|
|
5076
5426
|
|
|
5077
5427
|
# Represents the second wildcard node in the pattern.
|
|
5078
5428
|
#
|
|
5079
|
-
#
|
|
5080
|
-
#
|
|
5429
|
+
# ```rb
|
|
5430
|
+
# foo in *bar, baz, *qux
|
|
5431
|
+
# ^^^^
|
|
5081
5432
|
#
|
|
5082
|
-
#
|
|
5083
|
-
#
|
|
5433
|
+
# foo in Foo(*bar, baz, *qux)
|
|
5434
|
+
# ^^^^
|
|
5435
|
+
# ```
|
|
5084
5436
|
sig { returns(SplatNode) }
|
|
5085
5437
|
def right; end
|
|
5086
5438
|
|
|
5087
5439
|
# The Location of the opening brace.
|
|
5088
5440
|
#
|
|
5089
|
-
#
|
|
5090
|
-
#
|
|
5441
|
+
# ```rb
|
|
5442
|
+
# foo in [*bar, baz, *qux]
|
|
5443
|
+
# ^
|
|
5091
5444
|
#
|
|
5092
|
-
#
|
|
5093
|
-
#
|
|
5445
|
+
# foo in Foo(*bar, baz, *qux)
|
|
5446
|
+
# ^
|
|
5447
|
+
# ```
|
|
5094
5448
|
sig { returns(::T.nilable(Location)) }
|
|
5095
5449
|
def opening_loc; end
|
|
5096
5450
|
|
|
@@ -5101,11 +5455,13 @@ module Prism
|
|
|
5101
5455
|
|
|
5102
5456
|
# The Location of the closing brace.
|
|
5103
5457
|
#
|
|
5104
|
-
#
|
|
5105
|
-
#
|
|
5458
|
+
# ```rb
|
|
5459
|
+
# foo in [*bar, baz, *qux]
|
|
5460
|
+
# ^
|
|
5106
5461
|
#
|
|
5107
|
-
#
|
|
5108
|
-
#
|
|
5462
|
+
# foo in Foo(*bar, baz, *qux)
|
|
5463
|
+
# ^
|
|
5464
|
+
# ```
|
|
5109
5465
|
sig { returns(::T.nilable(Location)) }
|
|
5110
5466
|
def closing_loc; end
|
|
5111
5467
|
|
|
@@ -5128,8 +5484,10 @@ module Prism
|
|
|
5128
5484
|
|
|
5129
5485
|
# Represents the use of the `..` or `...` operators to create flip flops.
|
|
5130
5486
|
#
|
|
5131
|
-
#
|
|
5132
|
-
#
|
|
5487
|
+
# ```rb
|
|
5488
|
+
# baz if foo .. bar
|
|
5489
|
+
# ^^^^^^^^^^
|
|
5490
|
+
# ```
|
|
5133
5491
|
class FlipFlopNode < Node
|
|
5134
5492
|
# Initialize a new FlipFlopNode node.
|
|
5135
5493
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, left: ::T.nilable(Node), right: ::T.nilable(Node), operator_loc: Location).void }
|
|
@@ -5204,8 +5562,10 @@ module Prism
|
|
|
5204
5562
|
|
|
5205
5563
|
# Represents a floating point number literal.
|
|
5206
5564
|
#
|
|
5207
|
-
#
|
|
5208
|
-
#
|
|
5565
|
+
# ```rb
|
|
5566
|
+
# 1.0
|
|
5567
|
+
# ^^^
|
|
5568
|
+
# ```
|
|
5209
5569
|
class FloatNode < Node
|
|
5210
5570
|
# Initialize a new FloatNode node.
|
|
5211
5571
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, value: Float).void }
|
|
@@ -5259,8 +5619,10 @@ module Prism
|
|
|
5259
5619
|
|
|
5260
5620
|
# Represents the use of the `for` keyword.
|
|
5261
5621
|
#
|
|
5262
|
-
#
|
|
5263
|
-
#
|
|
5622
|
+
# ```rb
|
|
5623
|
+
# for i in a end
|
|
5624
|
+
# ^^^^^^^^^^^^^^
|
|
5625
|
+
# ```
|
|
5264
5626
|
class ForNode < Node
|
|
5265
5627
|
# Initialize a new ForNode node.
|
|
5266
5628
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, index: ::T.any(LocalVariableTargetNode, InstanceVariableTargetNode, ClassVariableTargetNode, GlobalVariableTargetNode, ConstantTargetNode, ConstantPathTargetNode, CallTargetNode, IndexTargetNode, MultiTargetNode), collection: Node, statements: ::T.nilable(StatementsNode), for_keyword_loc: Location, in_keyword_loc: Location, do_keyword_loc: ::T.nilable(Location), end_keyword_loc: Location).void }
|
|
@@ -5306,31 +5668,39 @@ module Prism
|
|
|
5306
5668
|
|
|
5307
5669
|
# The index expression for `for` loops.
|
|
5308
5670
|
#
|
|
5309
|
-
#
|
|
5310
|
-
#
|
|
5671
|
+
# ```rb
|
|
5672
|
+
# for i in a end
|
|
5673
|
+
# ^
|
|
5674
|
+
# ```
|
|
5311
5675
|
sig { returns(::T.any(LocalVariableTargetNode, InstanceVariableTargetNode, ClassVariableTargetNode, GlobalVariableTargetNode, ConstantTargetNode, ConstantPathTargetNode, CallTargetNode, IndexTargetNode, MultiTargetNode)) }
|
|
5312
5676
|
def index; end
|
|
5313
5677
|
|
|
5314
5678
|
# The collection to iterate over.
|
|
5315
5679
|
#
|
|
5316
|
-
#
|
|
5317
|
-
#
|
|
5680
|
+
# ```rb
|
|
5681
|
+
# for i in a end
|
|
5682
|
+
# ^
|
|
5683
|
+
# ```
|
|
5318
5684
|
sig { returns(Node) }
|
|
5319
5685
|
def collection; end
|
|
5320
5686
|
|
|
5321
5687
|
# Represents the body of statements to execute for each iteration of the loop.
|
|
5322
5688
|
#
|
|
5323
|
-
#
|
|
5324
|
-
#
|
|
5325
|
-
#
|
|
5326
|
-
#
|
|
5689
|
+
# ```rb
|
|
5690
|
+
# for i in a
|
|
5691
|
+
# foo(i)
|
|
5692
|
+
# ^^^^^^
|
|
5693
|
+
# end
|
|
5694
|
+
# ```
|
|
5327
5695
|
sig { returns(::T.nilable(StatementsNode)) }
|
|
5328
5696
|
def statements; end
|
|
5329
5697
|
|
|
5330
5698
|
# The Location of the `for` keyword.
|
|
5331
5699
|
#
|
|
5332
|
-
#
|
|
5333
|
-
#
|
|
5700
|
+
# ```rb
|
|
5701
|
+
# for i in a end
|
|
5702
|
+
# ^^^
|
|
5703
|
+
# ```
|
|
5334
5704
|
sig { returns(Location) }
|
|
5335
5705
|
def for_keyword_loc; end
|
|
5336
5706
|
|
|
@@ -5341,8 +5711,10 @@ module Prism
|
|
|
5341
5711
|
|
|
5342
5712
|
# The Location of the `in` keyword.
|
|
5343
5713
|
#
|
|
5344
|
-
#
|
|
5345
|
-
#
|
|
5714
|
+
# ```rb
|
|
5715
|
+
# for i in a end
|
|
5716
|
+
# ^^
|
|
5717
|
+
# ```
|
|
5346
5718
|
sig { returns(Location) }
|
|
5347
5719
|
def in_keyword_loc; end
|
|
5348
5720
|
|
|
@@ -5353,8 +5725,10 @@ module Prism
|
|
|
5353
5725
|
|
|
5354
5726
|
# The Location of the `do` keyword, if present.
|
|
5355
5727
|
#
|
|
5356
|
-
#
|
|
5357
|
-
#
|
|
5728
|
+
# ```rb
|
|
5729
|
+
# for i in a do end
|
|
5730
|
+
# ^^
|
|
5731
|
+
# ```
|
|
5358
5732
|
sig { returns(::T.nilable(Location)) }
|
|
5359
5733
|
def do_keyword_loc; end
|
|
5360
5734
|
|
|
@@ -5365,8 +5739,10 @@ module Prism
|
|
|
5365
5739
|
|
|
5366
5740
|
# The Location of the `end` keyword.
|
|
5367
5741
|
#
|
|
5368
|
-
#
|
|
5369
|
-
#
|
|
5742
|
+
# ```rb
|
|
5743
|
+
# for i in a end
|
|
5744
|
+
# ^^^
|
|
5745
|
+
# ```
|
|
5370
5746
|
sig { returns(Location) }
|
|
5371
5747
|
def end_keyword_loc; end
|
|
5372
5748
|
|
|
@@ -5397,10 +5773,12 @@ module Prism
|
|
|
5397
5773
|
|
|
5398
5774
|
# Represents forwarding all arguments to this method to another method.
|
|
5399
5775
|
#
|
|
5400
|
-
#
|
|
5401
|
-
#
|
|
5402
|
-
#
|
|
5403
|
-
#
|
|
5776
|
+
# ```rb
|
|
5777
|
+
# def foo(...)
|
|
5778
|
+
# bar(...)
|
|
5779
|
+
# ^^^
|
|
5780
|
+
# end
|
|
5781
|
+
# ```
|
|
5404
5782
|
class ForwardingArgumentsNode < Node
|
|
5405
5783
|
# Initialize a new ForwardingArgumentsNode node.
|
|
5406
5784
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer).void }
|
|
@@ -5450,9 +5828,11 @@ module Prism
|
|
|
5450
5828
|
|
|
5451
5829
|
# Represents the use of the forwarding parameter in a method, block, or lambda declaration.
|
|
5452
5830
|
#
|
|
5453
|
-
#
|
|
5454
|
-
#
|
|
5455
|
-
#
|
|
5831
|
+
# ```rb
|
|
5832
|
+
# def foo(...)
|
|
5833
|
+
# ^^^
|
|
5834
|
+
# end
|
|
5835
|
+
# ```
|
|
5456
5836
|
class ForwardingParameterNode < Node
|
|
5457
5837
|
# Initialize a new ForwardingParameterNode node.
|
|
5458
5838
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer).void }
|
|
@@ -5502,12 +5882,14 @@ module Prism
|
|
|
5502
5882
|
|
|
5503
5883
|
# Represents the use of the `super` keyword without parentheses or arguments, but which might have a block.
|
|
5504
5884
|
#
|
|
5505
|
-
#
|
|
5506
|
-
#
|
|
5885
|
+
# ```rb
|
|
5886
|
+
# super
|
|
5887
|
+
# ^^^^^
|
|
5507
5888
|
#
|
|
5508
|
-
#
|
|
5509
|
-
#
|
|
5889
|
+
# super { 123 }
|
|
5890
|
+
# ^^^^^^^^^^^^^
|
|
5510
5891
|
#
|
|
5892
|
+
# ```
|
|
5511
5893
|
# If it has any other arguments, it would be a `SuperNode` instead.
|
|
5512
5894
|
class ForwardingSuperNode < Node
|
|
5513
5895
|
# Initialize a new ForwardingSuperNode node.
|
|
@@ -5579,8 +5961,10 @@ module Prism
|
|
|
5579
5961
|
|
|
5580
5962
|
# Represents the use of the `&&=` operator for assignment to a global variable.
|
|
5581
5963
|
#
|
|
5582
|
-
#
|
|
5583
|
-
#
|
|
5964
|
+
# ```rb
|
|
5965
|
+
# $target &&= value
|
|
5966
|
+
# ^^^^^^^^^^^^^^^^^
|
|
5967
|
+
# ```
|
|
5584
5968
|
class GlobalVariableAndWriteNode < Node
|
|
5585
5969
|
# Initialize a new GlobalVariableAndWriteNode node.
|
|
5586
5970
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, operator_loc: Location, value: Node).void }
|
|
@@ -5660,8 +6044,10 @@ module Prism
|
|
|
5660
6044
|
|
|
5661
6045
|
# Represents assigning to a global variable using an operator that isn't `=`.
|
|
5662
6046
|
#
|
|
5663
|
-
#
|
|
5664
|
-
#
|
|
6047
|
+
# ```rb
|
|
6048
|
+
# $target += value
|
|
6049
|
+
# ^^^^^^^^^^^^^^^^
|
|
6050
|
+
# ```
|
|
5665
6051
|
class GlobalVariableOperatorWriteNode < Node
|
|
5666
6052
|
# Initialize a new GlobalVariableOperatorWriteNode node.
|
|
5667
6053
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, binary_operator_loc: Location, value: Node, binary_operator: Symbol).void }
|
|
@@ -5741,8 +6127,10 @@ module Prism
|
|
|
5741
6127
|
|
|
5742
6128
|
# Represents the use of the `||=` operator for assignment to a global variable.
|
|
5743
6129
|
#
|
|
5744
|
-
#
|
|
5745
|
-
#
|
|
6130
|
+
# ```rb
|
|
6131
|
+
# $target ||= value
|
|
6132
|
+
# ^^^^^^^^^^^^^^^^^
|
|
6133
|
+
# ```
|
|
5746
6134
|
class GlobalVariableOrWriteNode < Node
|
|
5747
6135
|
# Initialize a new GlobalVariableOrWriteNode node.
|
|
5748
6136
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, operator_loc: Location, value: Node).void }
|
|
@@ -5822,8 +6210,10 @@ module Prism
|
|
|
5822
6210
|
|
|
5823
6211
|
# Represents referencing a global variable.
|
|
5824
6212
|
#
|
|
5825
|
-
#
|
|
5826
|
-
#
|
|
6213
|
+
# ```rb
|
|
6214
|
+
# $foo
|
|
6215
|
+
# ^^^^
|
|
6216
|
+
# ```
|
|
5827
6217
|
class GlobalVariableReadNode < Node
|
|
5828
6218
|
# Initialize a new GlobalVariableReadNode node.
|
|
5829
6219
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol).void }
|
|
@@ -5869,9 +6259,11 @@ module Prism
|
|
|
5869
6259
|
|
|
5870
6260
|
# The name of the global variable, which is a `$` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifier). Alternatively, it can be one of the special global variables designated by a symbol.
|
|
5871
6261
|
#
|
|
5872
|
-
#
|
|
6262
|
+
# ```rb
|
|
6263
|
+
# $foo # name `:$foo`
|
|
5873
6264
|
#
|
|
5874
|
-
#
|
|
6265
|
+
# $_Test # name `:$_Test`
|
|
6266
|
+
# ```
|
|
5875
6267
|
sig { returns(Symbol) }
|
|
5876
6268
|
def name; end
|
|
5877
6269
|
|
|
@@ -5881,8 +6273,10 @@ module Prism
|
|
|
5881
6273
|
|
|
5882
6274
|
# Represents writing to a global variable in a context that doesn't have an explicit value.
|
|
5883
6275
|
#
|
|
5884
|
-
#
|
|
5885
|
-
#
|
|
6276
|
+
# ```rb
|
|
6277
|
+
# $foo, $bar = baz
|
|
6278
|
+
# ^^^^ ^^^^
|
|
6279
|
+
# ```
|
|
5886
6280
|
class GlobalVariableTargetNode < Node
|
|
5887
6281
|
# Initialize a new GlobalVariableTargetNode node.
|
|
5888
6282
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol).void }
|
|
@@ -5936,8 +6330,10 @@ module Prism
|
|
|
5936
6330
|
|
|
5937
6331
|
# Represents writing to a global variable.
|
|
5938
6332
|
#
|
|
5939
|
-
#
|
|
5940
|
-
#
|
|
6333
|
+
# ```rb
|
|
6334
|
+
# $foo = 1
|
|
6335
|
+
# ^^^^^^^^
|
|
6336
|
+
# ```
|
|
5941
6337
|
class GlobalVariableWriteNode < Node
|
|
5942
6338
|
# Initialize a new GlobalVariableWriteNode node.
|
|
5943
6339
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, value: Node, operator_loc: Location).void }
|
|
@@ -5983,16 +6379,20 @@ module Prism
|
|
|
5983
6379
|
|
|
5984
6380
|
# The name of the global variable, which is a `$` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifier). Alternatively, it can be one of the special global variables designated by a symbol.
|
|
5985
6381
|
#
|
|
5986
|
-
#
|
|
6382
|
+
# ```rb
|
|
6383
|
+
# $foo = :bar # name `:$foo`
|
|
5987
6384
|
#
|
|
5988
|
-
#
|
|
6385
|
+
# $_Test = 123 # name `:$_Test`
|
|
6386
|
+
# ```
|
|
5989
6387
|
sig { returns(Symbol) }
|
|
5990
6388
|
def name; end
|
|
5991
6389
|
|
|
5992
6390
|
# The Location of the global variable's name.
|
|
5993
6391
|
#
|
|
5994
|
-
#
|
|
5995
|
-
#
|
|
6392
|
+
# ```rb
|
|
6393
|
+
# $foo = :bar
|
|
6394
|
+
# ^^^^
|
|
6395
|
+
# ```
|
|
5996
6396
|
sig { returns(Location) }
|
|
5997
6397
|
def name_loc; end
|
|
5998
6398
|
|
|
@@ -6003,18 +6403,22 @@ module Prism
|
|
|
6003
6403
|
|
|
6004
6404
|
# The value to write to the global variable. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
6005
6405
|
#
|
|
6006
|
-
#
|
|
6007
|
-
#
|
|
6406
|
+
# ```rb
|
|
6407
|
+
# $foo = :bar
|
|
6408
|
+
# ^^^^
|
|
6008
6409
|
#
|
|
6009
|
-
#
|
|
6010
|
-
#
|
|
6410
|
+
# $-xyz = 123
|
|
6411
|
+
# ^^^
|
|
6412
|
+
# ```
|
|
6011
6413
|
sig { returns(Node) }
|
|
6012
6414
|
def value; end
|
|
6013
6415
|
|
|
6014
6416
|
# The Location of the `=` operator.
|
|
6015
6417
|
#
|
|
6016
|
-
#
|
|
6017
|
-
#
|
|
6418
|
+
# ```rb
|
|
6419
|
+
# $foo = :bar
|
|
6420
|
+
# ^
|
|
6421
|
+
# ```
|
|
6018
6422
|
sig { returns(Location) }
|
|
6019
6423
|
def operator_loc; end
|
|
6020
6424
|
|
|
@@ -6033,8 +6437,10 @@ module Prism
|
|
|
6033
6437
|
|
|
6034
6438
|
# Represents a hash literal.
|
|
6035
6439
|
#
|
|
6036
|
-
#
|
|
6037
|
-
#
|
|
6440
|
+
# ```rb
|
|
6441
|
+
# { a => b }
|
|
6442
|
+
# ^^^^^^^^^^
|
|
6443
|
+
# ```
|
|
6038
6444
|
class HashNode < Node
|
|
6039
6445
|
# Initialize a new HashNode node.
|
|
6040
6446
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, opening_loc: Location, elements: T::Array[::T.any(AssocNode, AssocSplatNode)], closing_loc: Location).void }
|
|
@@ -6080,8 +6486,10 @@ module Prism
|
|
|
6080
6486
|
|
|
6081
6487
|
# The Location of the opening brace.
|
|
6082
6488
|
#
|
|
6083
|
-
#
|
|
6084
|
-
#
|
|
6489
|
+
# ```rb
|
|
6490
|
+
# { a => b }
|
|
6491
|
+
# ^
|
|
6492
|
+
# ```
|
|
6085
6493
|
sig { returns(Location) }
|
|
6086
6494
|
def opening_loc; end
|
|
6087
6495
|
|
|
@@ -6092,18 +6500,22 @@ module Prism
|
|
|
6092
6500
|
|
|
6093
6501
|
# The elements of the hash. These can be either `AssocNode`s or `AssocSplatNode`s.
|
|
6094
6502
|
#
|
|
6095
|
-
#
|
|
6096
|
-
#
|
|
6503
|
+
# ```rb
|
|
6504
|
+
# { a: b }
|
|
6505
|
+
# ^^^^
|
|
6097
6506
|
#
|
|
6098
|
-
#
|
|
6099
|
-
#
|
|
6507
|
+
# { **foo }
|
|
6508
|
+
# ^^^^^
|
|
6509
|
+
# ```
|
|
6100
6510
|
sig { returns(T::Array[::T.any(AssocNode, AssocSplatNode)]) }
|
|
6101
6511
|
def elements; end
|
|
6102
6512
|
|
|
6103
6513
|
# The Location of the closing brace.
|
|
6104
6514
|
#
|
|
6105
|
-
#
|
|
6106
|
-
#
|
|
6515
|
+
# ```rb
|
|
6516
|
+
# { a => b }
|
|
6517
|
+
# ^
|
|
6518
|
+
# ```
|
|
6107
6519
|
sig { returns(Location) }
|
|
6108
6520
|
def closing_loc; end
|
|
6109
6521
|
|
|
@@ -6126,17 +6538,19 @@ module Prism
|
|
|
6126
6538
|
|
|
6127
6539
|
# Represents a hash pattern in pattern matching.
|
|
6128
6540
|
#
|
|
6129
|
-
#
|
|
6130
|
-
#
|
|
6541
|
+
# ```rb
|
|
6542
|
+
# foo => { a: 1, b: 2 }
|
|
6543
|
+
# ^^^^^^^^^^^^^^
|
|
6131
6544
|
#
|
|
6132
|
-
#
|
|
6133
|
-
#
|
|
6545
|
+
# foo => { a: 1, b: 2, **c }
|
|
6546
|
+
# ^^^^^^^^^^^^^^^^^^^
|
|
6134
6547
|
#
|
|
6135
|
-
#
|
|
6136
|
-
#
|
|
6548
|
+
# foo => Bar[a: 1, b: 2]
|
|
6549
|
+
# ^^^^^^^^^^^^^^^
|
|
6137
6550
|
#
|
|
6138
|
-
#
|
|
6139
|
-
#
|
|
6551
|
+
# foo in { a: 1, b: 2 }
|
|
6552
|
+
# ^^^^^^^^^^^^^^
|
|
6553
|
+
# ```
|
|
6140
6554
|
class HashPatternNode < Node
|
|
6141
6555
|
# Initialize a new HashPatternNode node.
|
|
6142
6556
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, constant: ::T.nilable(::T.any(ConstantPathNode, ConstantReadNode)), elements: T::Array[AssocNode], rest: ::T.nilable(::T.any(AssocSplatNode, NoKeywordsParameterNode)), opening_loc: ::T.nilable(Location), closing_loc: ::T.nilable(Location)).void }
|
|
@@ -6182,41 +6596,49 @@ module Prism
|
|
|
6182
6596
|
|
|
6183
6597
|
# Represents the optional constant preceding the Hash.
|
|
6184
6598
|
#
|
|
6185
|
-
#
|
|
6186
|
-
#
|
|
6599
|
+
# ```rb
|
|
6600
|
+
# foo => Bar[a: 1, b: 2]
|
|
6601
|
+
# ^^^
|
|
6187
6602
|
#
|
|
6188
|
-
#
|
|
6189
|
-
#
|
|
6603
|
+
# foo => Bar::Baz[a: 1, b: 2]
|
|
6604
|
+
# ^^^^^^^^
|
|
6605
|
+
# ```
|
|
6190
6606
|
sig { returns(::T.nilable(::T.any(ConstantPathNode, ConstantReadNode))) }
|
|
6191
6607
|
def constant; end
|
|
6192
6608
|
|
|
6193
6609
|
# Represents the explicit named hash keys and values.
|
|
6194
6610
|
#
|
|
6195
|
-
#
|
|
6196
|
-
#
|
|
6611
|
+
# ```rb
|
|
6612
|
+
# foo => { a: 1, b:, ** }
|
|
6613
|
+
# ^^^^^^^^
|
|
6614
|
+
# ```
|
|
6197
6615
|
sig { returns(T::Array[AssocNode]) }
|
|
6198
6616
|
def elements; end
|
|
6199
6617
|
|
|
6200
6618
|
# Represents the rest of the Hash keys and values. This can be named, unnamed, or explicitly forbidden via `**nil`, this last one results in a `NoKeywordsParameterNode`.
|
|
6201
6619
|
#
|
|
6202
|
-
#
|
|
6203
|
-
#
|
|
6620
|
+
# ```rb
|
|
6621
|
+
# foo => { a: 1, b:, **c }
|
|
6622
|
+
# ^^^
|
|
6204
6623
|
#
|
|
6205
|
-
#
|
|
6206
|
-
#
|
|
6624
|
+
# foo => { a: 1, b:, ** }
|
|
6625
|
+
# ^^
|
|
6207
6626
|
#
|
|
6208
|
-
#
|
|
6209
|
-
#
|
|
6627
|
+
# foo => { a: 1, b:, **nil }
|
|
6628
|
+
# ^^^^^
|
|
6629
|
+
# ```
|
|
6210
6630
|
sig { returns(::T.nilable(::T.any(AssocSplatNode, NoKeywordsParameterNode))) }
|
|
6211
6631
|
def rest; end
|
|
6212
6632
|
|
|
6213
6633
|
# The Location of the opening brace.
|
|
6214
6634
|
#
|
|
6215
|
-
#
|
|
6216
|
-
#
|
|
6635
|
+
# ```rb
|
|
6636
|
+
# foo => { a: 1 }
|
|
6637
|
+
# ^
|
|
6217
6638
|
#
|
|
6218
|
-
#
|
|
6219
|
-
#
|
|
6639
|
+
# foo => Bar[a: 1]
|
|
6640
|
+
# ^
|
|
6641
|
+
# ```
|
|
6220
6642
|
sig { returns(::T.nilable(Location)) }
|
|
6221
6643
|
def opening_loc; end
|
|
6222
6644
|
|
|
@@ -6227,11 +6649,13 @@ module Prism
|
|
|
6227
6649
|
|
|
6228
6650
|
# The Location of the closing brace.
|
|
6229
6651
|
#
|
|
6230
|
-
#
|
|
6231
|
-
#
|
|
6652
|
+
# ```rb
|
|
6653
|
+
# foo => { a: 1 }
|
|
6654
|
+
# ^
|
|
6232
6655
|
#
|
|
6233
|
-
#
|
|
6234
|
-
#
|
|
6656
|
+
# foo => Bar[a: 1]
|
|
6657
|
+
# ^
|
|
6658
|
+
# ```
|
|
6235
6659
|
sig { returns(::T.nilable(Location)) }
|
|
6236
6660
|
def closing_loc; end
|
|
6237
6661
|
|
|
@@ -6254,14 +6678,16 @@ module Prism
|
|
|
6254
6678
|
|
|
6255
6679
|
# Represents the use of the `if` keyword, either in the block form or the modifier form, or a ternary expression.
|
|
6256
6680
|
#
|
|
6257
|
-
#
|
|
6258
|
-
#
|
|
6681
|
+
# ```rb
|
|
6682
|
+
# bar if foo
|
|
6683
|
+
# ^^^^^^^^^^
|
|
6259
6684
|
#
|
|
6260
|
-
#
|
|
6261
|
-
#
|
|
6685
|
+
# if foo then bar end
|
|
6686
|
+
# ^^^^^^^^^^^^^^^^^^^
|
|
6262
6687
|
#
|
|
6263
|
-
#
|
|
6264
|
-
#
|
|
6688
|
+
# foo ? bar : baz
|
|
6689
|
+
# ^^^^^^^^^^^^^^^
|
|
6690
|
+
# ```
|
|
6265
6691
|
class IfNode < Node
|
|
6266
6692
|
# Initialize a new IfNode node.
|
|
6267
6693
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, if_keyword_loc: ::T.nilable(Location), predicate: Node, then_keyword_loc: ::T.nilable(Location), statements: ::T.nilable(StatementsNode), subsequent: ::T.nilable(::T.any(ElseNode, IfNode)), end_keyword_loc: ::T.nilable(Location)).void }
|
|
@@ -6307,9 +6733,11 @@ module Prism
|
|
|
6307
6733
|
|
|
6308
6734
|
# The Location of the `if` keyword if present.
|
|
6309
6735
|
#
|
|
6310
|
-
#
|
|
6311
|
-
#
|
|
6736
|
+
# ```rb
|
|
6737
|
+
# bar if foo
|
|
6738
|
+
# ^^
|
|
6312
6739
|
#
|
|
6740
|
+
# ```
|
|
6313
6741
|
# The `if_keyword_loc` field will be `nil` when the `IfNode` represents a ternary expression.
|
|
6314
6742
|
sig { returns(::T.nilable(Location)) }
|
|
6315
6743
|
def if_keyword_loc; end
|
|
@@ -6321,26 +6749,30 @@ module Prism
|
|
|
6321
6749
|
|
|
6322
6750
|
# The node for the condition the `IfNode` is testing.
|
|
6323
6751
|
#
|
|
6324
|
-
#
|
|
6325
|
-
#
|
|
6326
|
-
#
|
|
6327
|
-
#
|
|
6752
|
+
# ```rb
|
|
6753
|
+
# if foo
|
|
6754
|
+
# ^^^
|
|
6755
|
+
# bar
|
|
6756
|
+
# end
|
|
6328
6757
|
#
|
|
6329
|
-
#
|
|
6330
|
-
#
|
|
6758
|
+
# bar if foo
|
|
6759
|
+
# ^^^
|
|
6331
6760
|
#
|
|
6332
|
-
#
|
|
6333
|
-
#
|
|
6761
|
+
# foo ? bar : baz
|
|
6762
|
+
# ^^^
|
|
6763
|
+
# ```
|
|
6334
6764
|
sig { returns(Node) }
|
|
6335
6765
|
def predicate; end
|
|
6336
6766
|
|
|
6337
6767
|
# The Location of the `then` keyword (if present) or the `?` in a ternary expression, `nil` otherwise.
|
|
6338
6768
|
#
|
|
6339
|
-
#
|
|
6340
|
-
#
|
|
6769
|
+
# ```rb
|
|
6770
|
+
# if foo then bar end
|
|
6771
|
+
# ^^^^
|
|
6341
6772
|
#
|
|
6342
|
-
#
|
|
6343
|
-
#
|
|
6773
|
+
# a ? b : c
|
|
6774
|
+
# ^
|
|
6775
|
+
# ```
|
|
6344
6776
|
sig { returns(::T.nilable(Location)) }
|
|
6345
6777
|
def then_keyword_loc; end
|
|
6346
6778
|
|
|
@@ -6351,37 +6783,43 @@ module Prism
|
|
|
6351
6783
|
|
|
6352
6784
|
# Represents the body of statements that will be executed when the predicate is evaluated as truthy. Will be `nil` when no body is provided.
|
|
6353
6785
|
#
|
|
6354
|
-
#
|
|
6355
|
-
#
|
|
6356
|
-
#
|
|
6357
|
-
#
|
|
6358
|
-
#
|
|
6359
|
-
#
|
|
6786
|
+
# ```rb
|
|
6787
|
+
# if foo
|
|
6788
|
+
# bar
|
|
6789
|
+
# ^^^
|
|
6790
|
+
# baz
|
|
6791
|
+
# ^^^
|
|
6792
|
+
# end
|
|
6793
|
+
# ```
|
|
6360
6794
|
sig { returns(::T.nilable(StatementsNode)) }
|
|
6361
6795
|
def statements; end
|
|
6362
6796
|
|
|
6363
6797
|
# Represents an `ElseNode` or an `IfNode` when there is an `else` or an `elsif` in the `if` statement.
|
|
6364
6798
|
#
|
|
6365
|
-
#
|
|
6366
|
-
#
|
|
6367
|
-
#
|
|
6368
|
-
#
|
|
6369
|
-
#
|
|
6370
|
-
#
|
|
6371
|
-
#
|
|
6372
|
-
#
|
|
6373
|
-
#
|
|
6374
|
-
#
|
|
6375
|
-
#
|
|
6799
|
+
# ```rb
|
|
6800
|
+
# if foo
|
|
6801
|
+
# bar
|
|
6802
|
+
# elsif baz
|
|
6803
|
+
# ^^^^^^^^^
|
|
6804
|
+
# qux
|
|
6805
|
+
# ^^^
|
|
6806
|
+
# end
|
|
6807
|
+
# ^^^
|
|
6808
|
+
#
|
|
6809
|
+
# if foo then bar else baz end
|
|
6810
|
+
# ^^^^^^^^^^^^
|
|
6811
|
+
# ```
|
|
6376
6812
|
sig { returns(::T.nilable(::T.any(ElseNode, IfNode))) }
|
|
6377
6813
|
def subsequent; end
|
|
6378
6814
|
|
|
6379
6815
|
# The Location of the `end` keyword if present, `nil` otherwise.
|
|
6380
6816
|
#
|
|
6381
|
-
#
|
|
6382
|
-
#
|
|
6383
|
-
#
|
|
6384
|
-
#
|
|
6817
|
+
# ```rb
|
|
6818
|
+
# if foo
|
|
6819
|
+
# bar
|
|
6820
|
+
# end
|
|
6821
|
+
# ^^^
|
|
6822
|
+
# ```
|
|
6385
6823
|
sig { returns(::T.nilable(Location)) }
|
|
6386
6824
|
def end_keyword_loc; end
|
|
6387
6825
|
|
|
@@ -6408,8 +6846,10 @@ module Prism
|
|
|
6408
6846
|
|
|
6409
6847
|
# Represents an imaginary number literal.
|
|
6410
6848
|
#
|
|
6411
|
-
#
|
|
6412
|
-
#
|
|
6849
|
+
# ```rb
|
|
6850
|
+
# 1.0i
|
|
6851
|
+
# ^^^^
|
|
6852
|
+
# ```
|
|
6413
6853
|
class ImaginaryNode < Node
|
|
6414
6854
|
# Initialize a new ImaginaryNode node.
|
|
6415
6855
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, numeric: ::T.any(FloatNode, IntegerNode, RationalNode)).void }
|
|
@@ -6463,14 +6903,16 @@ module Prism
|
|
|
6463
6903
|
|
|
6464
6904
|
# Represents a node that is implicitly being added to the tree but doesn't correspond directly to a node in the source.
|
|
6465
6905
|
#
|
|
6466
|
-
#
|
|
6467
|
-
#
|
|
6906
|
+
# ```rb
|
|
6907
|
+
# { foo: }
|
|
6908
|
+
# ^^^^
|
|
6468
6909
|
#
|
|
6469
|
-
#
|
|
6470
|
-
#
|
|
6910
|
+
# { Foo: }
|
|
6911
|
+
# ^^^^
|
|
6471
6912
|
#
|
|
6472
|
-
#
|
|
6473
|
-
#
|
|
6913
|
+
# foo in { bar: }
|
|
6914
|
+
# ^^^^
|
|
6915
|
+
# ```
|
|
6474
6916
|
class ImplicitNode < Node
|
|
6475
6917
|
# Initialize a new ImplicitNode node.
|
|
6476
6918
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, value: ::T.any(LocalVariableReadNode, CallNode, ConstantReadNode, LocalVariableTargetNode)).void }
|
|
@@ -6524,17 +6966,19 @@ module Prism
|
|
|
6524
6966
|
|
|
6525
6967
|
# Represents using a trailing comma to indicate an implicit rest parameter.
|
|
6526
6968
|
#
|
|
6527
|
-
#
|
|
6528
|
-
#
|
|
6529
|
-
#
|
|
6530
|
-
# foo in [bar,]
|
|
6531
|
-
# ^
|
|
6969
|
+
# ```rb
|
|
6970
|
+
# foo { |bar,| }
|
|
6971
|
+
# ^
|
|
6532
6972
|
#
|
|
6533
|
-
#
|
|
6973
|
+
# foo in [bar,]
|
|
6534
6974
|
# ^
|
|
6535
6975
|
#
|
|
6536
|
-
#
|
|
6976
|
+
# for foo, in bar do end
|
|
6537
6977
|
# ^
|
|
6978
|
+
#
|
|
6979
|
+
# foo, = bar
|
|
6980
|
+
# ^
|
|
6981
|
+
# ```
|
|
6538
6982
|
class ImplicitRestNode < Node
|
|
6539
6983
|
# Initialize a new ImplicitRestNode node.
|
|
6540
6984
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer).void }
|
|
@@ -6584,8 +7028,10 @@ module Prism
|
|
|
6584
7028
|
|
|
6585
7029
|
# Represents the use of the `in` keyword in a case statement.
|
|
6586
7030
|
#
|
|
6587
|
-
#
|
|
6588
|
-
#
|
|
7031
|
+
# ```rb
|
|
7032
|
+
# case a; in b then c end
|
|
7033
|
+
# ^^^^^^^^^^^
|
|
7034
|
+
# ```
|
|
6589
7035
|
class InNode < Node
|
|
6590
7036
|
# Initialize a new InNode node.
|
|
6591
7037
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, pattern: Node, statements: ::T.nilable(StatementsNode), in_keyword_loc: Location, then_keyword_loc: ::T.nilable(Location)).void }
|
|
@@ -6669,8 +7115,10 @@ module Prism
|
|
|
6669
7115
|
|
|
6670
7116
|
# Represents the use of the `&&=` operator on a call to the `[]` method.
|
|
6671
7117
|
#
|
|
6672
|
-
#
|
|
6673
|
-
#
|
|
7118
|
+
# ```rb
|
|
7119
|
+
# foo.bar[baz] &&= value
|
|
7120
|
+
# ^^^^^^^^^^^^^^^^^^^^^^
|
|
7121
|
+
# ```
|
|
6674
7122
|
class IndexAndWriteNode < Node
|
|
6675
7123
|
# Initialize a new IndexAndWriteNode node.
|
|
6676
7124
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, receiver: ::T.nilable(Node), call_operator_loc: ::T.nilable(Location), opening_loc: Location, arguments: ::T.nilable(ArgumentsNode), closing_loc: Location, block: ::T.nilable(BlockArgumentNode), operator_loc: Location, value: Node).void }
|
|
@@ -6804,8 +7252,10 @@ module Prism
|
|
|
6804
7252
|
|
|
6805
7253
|
# Represents the use of an assignment operator on a call to `[]`.
|
|
6806
7254
|
#
|
|
6807
|
-
#
|
|
6808
|
-
#
|
|
7255
|
+
# ```rb
|
|
7256
|
+
# foo.bar[baz] += value
|
|
7257
|
+
# ^^^^^^^^^^^^^^^^^^^^^
|
|
7258
|
+
# ```
|
|
6809
7259
|
class IndexOperatorWriteNode < Node
|
|
6810
7260
|
# Initialize a new IndexOperatorWriteNode node.
|
|
6811
7261
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, receiver: ::T.nilable(Node), call_operator_loc: ::T.nilable(Location), opening_loc: Location, arguments: ::T.nilable(ArgumentsNode), closing_loc: Location, block: ::T.nilable(BlockArgumentNode), binary_operator: Symbol, binary_operator_loc: Location, value: Node).void }
|
|
@@ -6939,8 +7389,10 @@ module Prism
|
|
|
6939
7389
|
|
|
6940
7390
|
# Represents the use of the `||=` operator on a call to `[]`.
|
|
6941
7391
|
#
|
|
6942
|
-
#
|
|
6943
|
-
#
|
|
7392
|
+
# ```rb
|
|
7393
|
+
# foo.bar[baz] ||= value
|
|
7394
|
+
# ^^^^^^^^^^^^^^^^^^^^^^
|
|
7395
|
+
# ```
|
|
6944
7396
|
class IndexOrWriteNode < Node
|
|
6945
7397
|
# Initialize a new IndexOrWriteNode node.
|
|
6946
7398
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, receiver: ::T.nilable(Node), call_operator_loc: ::T.nilable(Location), opening_loc: Location, arguments: ::T.nilable(ArgumentsNode), closing_loc: Location, block: ::T.nilable(BlockArgumentNode), operator_loc: Location, value: Node).void }
|
|
@@ -7074,16 +7526,18 @@ module Prism
|
|
|
7074
7526
|
|
|
7075
7527
|
# Represents assigning to an index.
|
|
7076
7528
|
#
|
|
7077
|
-
#
|
|
7078
|
-
#
|
|
7529
|
+
# ```rb
|
|
7530
|
+
# foo[bar], = 1
|
|
7531
|
+
# ^^^^^^^^
|
|
7079
7532
|
#
|
|
7080
|
-
#
|
|
7081
|
-
#
|
|
7082
|
-
#
|
|
7083
|
-
#
|
|
7533
|
+
# begin
|
|
7534
|
+
# rescue => foo[bar]
|
|
7535
|
+
# ^^^^^^^^
|
|
7536
|
+
# end
|
|
7084
7537
|
#
|
|
7085
|
-
#
|
|
7086
|
-
#
|
|
7538
|
+
# for foo[bar] in baz do end
|
|
7539
|
+
# ^^^^^^^^
|
|
7540
|
+
# ```
|
|
7087
7541
|
class IndexTargetNode < Node
|
|
7088
7542
|
# Initialize a new IndexTargetNode node.
|
|
7089
7543
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, receiver: Node, opening_loc: Location, arguments: ::T.nilable(ArgumentsNode), closing_loc: Location, block: ::T.nilable(BlockArgumentNode)).void }
|
|
@@ -7187,8 +7641,10 @@ module Prism
|
|
|
7187
7641
|
|
|
7188
7642
|
# Represents the use of the `&&=` operator for assignment to an instance variable.
|
|
7189
7643
|
#
|
|
7190
|
-
#
|
|
7191
|
-
#
|
|
7644
|
+
# ```rb
|
|
7645
|
+
# @target &&= value
|
|
7646
|
+
# ^^^^^^^^^^^^^^^^^
|
|
7647
|
+
# ```
|
|
7192
7648
|
class InstanceVariableAndWriteNode < Node
|
|
7193
7649
|
# Initialize a new InstanceVariableAndWriteNode node.
|
|
7194
7650
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, operator_loc: Location, value: Node).void }
|
|
@@ -7268,8 +7724,10 @@ module Prism
|
|
|
7268
7724
|
|
|
7269
7725
|
# Represents assigning to an instance variable using an operator that isn't `=`.
|
|
7270
7726
|
#
|
|
7271
|
-
#
|
|
7272
|
-
#
|
|
7727
|
+
# ```rb
|
|
7728
|
+
# @target += value
|
|
7729
|
+
# ^^^^^^^^^^^^^^^^
|
|
7730
|
+
# ```
|
|
7273
7731
|
class InstanceVariableOperatorWriteNode < Node
|
|
7274
7732
|
# Initialize a new InstanceVariableOperatorWriteNode node.
|
|
7275
7733
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, binary_operator_loc: Location, value: Node, binary_operator: Symbol).void }
|
|
@@ -7349,8 +7807,10 @@ module Prism
|
|
|
7349
7807
|
|
|
7350
7808
|
# Represents the use of the `||=` operator for assignment to an instance variable.
|
|
7351
7809
|
#
|
|
7352
|
-
#
|
|
7353
|
-
#
|
|
7810
|
+
# ```rb
|
|
7811
|
+
# @target ||= value
|
|
7812
|
+
# ^^^^^^^^^^^^^^^^^
|
|
7813
|
+
# ```
|
|
7354
7814
|
class InstanceVariableOrWriteNode < Node
|
|
7355
7815
|
# Initialize a new InstanceVariableOrWriteNode node.
|
|
7356
7816
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, operator_loc: Location, value: Node).void }
|
|
@@ -7430,8 +7890,10 @@ module Prism
|
|
|
7430
7890
|
|
|
7431
7891
|
# Represents referencing an instance variable.
|
|
7432
7892
|
#
|
|
7433
|
-
#
|
|
7434
|
-
#
|
|
7893
|
+
# ```rb
|
|
7894
|
+
# @foo
|
|
7895
|
+
# ^^^^
|
|
7896
|
+
# ```
|
|
7435
7897
|
class InstanceVariableReadNode < Node
|
|
7436
7898
|
# Initialize a new InstanceVariableReadNode node.
|
|
7437
7899
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol).void }
|
|
@@ -7477,9 +7939,11 @@ module Prism
|
|
|
7477
7939
|
|
|
7478
7940
|
# The name of the instance variable, which is a `@` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers).
|
|
7479
7941
|
#
|
|
7480
|
-
#
|
|
7942
|
+
# ```rb
|
|
7943
|
+
# @x # name `:@x`
|
|
7481
7944
|
#
|
|
7482
|
-
#
|
|
7945
|
+
# @_test # name `:@_test`
|
|
7946
|
+
# ```
|
|
7483
7947
|
sig { returns(Symbol) }
|
|
7484
7948
|
def name; end
|
|
7485
7949
|
|
|
@@ -7489,8 +7953,10 @@ module Prism
|
|
|
7489
7953
|
|
|
7490
7954
|
# Represents writing to an instance variable in a context that doesn't have an explicit value.
|
|
7491
7955
|
#
|
|
7492
|
-
#
|
|
7493
|
-
#
|
|
7956
|
+
# ```rb
|
|
7957
|
+
# @foo, @bar = baz
|
|
7958
|
+
# ^^^^ ^^^^
|
|
7959
|
+
# ```
|
|
7494
7960
|
class InstanceVariableTargetNode < Node
|
|
7495
7961
|
# Initialize a new InstanceVariableTargetNode node.
|
|
7496
7962
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol).void }
|
|
@@ -7544,8 +8010,10 @@ module Prism
|
|
|
7544
8010
|
|
|
7545
8011
|
# Represents writing to an instance variable.
|
|
7546
8012
|
#
|
|
7547
|
-
#
|
|
7548
|
-
#
|
|
8013
|
+
# ```rb
|
|
8014
|
+
# @foo = 1
|
|
8015
|
+
# ^^^^^^^^
|
|
8016
|
+
# ```
|
|
7549
8017
|
class InstanceVariableWriteNode < Node
|
|
7550
8018
|
# Initialize a new InstanceVariableWriteNode node.
|
|
7551
8019
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, value: Node, operator_loc: Location).void }
|
|
@@ -7591,16 +8059,20 @@ module Prism
|
|
|
7591
8059
|
|
|
7592
8060
|
# The name of the instance variable, which is a `@` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers).
|
|
7593
8061
|
#
|
|
7594
|
-
#
|
|
8062
|
+
# ```rb
|
|
8063
|
+
# @x = :y # name `:@x`
|
|
7595
8064
|
#
|
|
7596
|
-
#
|
|
8065
|
+
# @_foo = "bar" # name `@_foo`
|
|
8066
|
+
# ```
|
|
7597
8067
|
sig { returns(Symbol) }
|
|
7598
8068
|
def name; end
|
|
7599
8069
|
|
|
7600
8070
|
# The Location of the variable name.
|
|
7601
8071
|
#
|
|
7602
|
-
#
|
|
7603
|
-
#
|
|
8072
|
+
# ```rb
|
|
8073
|
+
# @_x = 1
|
|
8074
|
+
# ^^^
|
|
8075
|
+
# ```
|
|
7604
8076
|
sig { returns(Location) }
|
|
7605
8077
|
def name_loc; end
|
|
7606
8078
|
|
|
@@ -7611,18 +8083,22 @@ module Prism
|
|
|
7611
8083
|
|
|
7612
8084
|
# The value to write to the instance variable. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
7613
8085
|
#
|
|
7614
|
-
#
|
|
7615
|
-
#
|
|
8086
|
+
# ```rb
|
|
8087
|
+
# @foo = :bar
|
|
8088
|
+
# ^^^^
|
|
7616
8089
|
#
|
|
7617
|
-
#
|
|
7618
|
-
#
|
|
8090
|
+
# @_x = 1234
|
|
8091
|
+
# ^^^^
|
|
8092
|
+
# ```
|
|
7619
8093
|
sig { returns(Node) }
|
|
7620
8094
|
def value; end
|
|
7621
8095
|
|
|
7622
8096
|
# The Location of the `=` operator.
|
|
7623
8097
|
#
|
|
7624
|
-
#
|
|
7625
|
-
#
|
|
8098
|
+
# ```rb
|
|
8099
|
+
# @x = y
|
|
8100
|
+
# ^
|
|
8101
|
+
# ```
|
|
7626
8102
|
sig { returns(Location) }
|
|
7627
8103
|
def operator_loc; end
|
|
7628
8104
|
|
|
@@ -7641,8 +8117,10 @@ module Prism
|
|
|
7641
8117
|
|
|
7642
8118
|
# Represents an integer number literal.
|
|
7643
8119
|
#
|
|
7644
|
-
#
|
|
7645
|
-
#
|
|
8120
|
+
# ```rb
|
|
8121
|
+
# 1
|
|
8122
|
+
# ^
|
|
8123
|
+
# ```
|
|
7646
8124
|
class IntegerNode < Node
|
|
7647
8125
|
# Initialize a new IntegerNode node.
|
|
7648
8126
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, value: Integer).void }
|
|
@@ -7712,8 +8190,10 @@ module Prism
|
|
|
7712
8190
|
|
|
7713
8191
|
# Represents a regular expression literal that contains interpolation that is being used in the predicate of a conditional to implicitly match against the last line read by an IO object.
|
|
7714
8192
|
#
|
|
7715
|
-
#
|
|
7716
|
-
#
|
|
8193
|
+
# ```rb
|
|
8194
|
+
# if /foo #{bar} baz/ then end
|
|
8195
|
+
# ^^^^^^^^^^^^^^^^
|
|
8196
|
+
# ```
|
|
7717
8197
|
class InterpolatedMatchLastLineNode < Node
|
|
7718
8198
|
# Initialize a new InterpolatedMatchLastLineNode node.
|
|
7719
8199
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, opening_loc: Location, parts: T::Array[::T.any(StringNode, EmbeddedStatementsNode, EmbeddedVariableNode)], closing_loc: Location).void }
|
|
@@ -7837,8 +8317,10 @@ module Prism
|
|
|
7837
8317
|
|
|
7838
8318
|
# Represents a regular expression literal that contains interpolation.
|
|
7839
8319
|
#
|
|
7840
|
-
#
|
|
7841
|
-
#
|
|
8320
|
+
# ```rb
|
|
8321
|
+
# /foo #{bar} baz/
|
|
8322
|
+
# ^^^^^^^^^^^^^^^^
|
|
8323
|
+
# ```
|
|
7842
8324
|
class InterpolatedRegularExpressionNode < Node
|
|
7843
8325
|
# Initialize a new InterpolatedRegularExpressionNode node.
|
|
7844
8326
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, opening_loc: Location, parts: T::Array[::T.any(StringNode, EmbeddedStatementsNode, EmbeddedVariableNode)], closing_loc: Location).void }
|
|
@@ -7962,8 +8444,10 @@ module Prism
|
|
|
7962
8444
|
|
|
7963
8445
|
# Represents a string literal that contains interpolation.
|
|
7964
8446
|
#
|
|
7965
|
-
#
|
|
7966
|
-
#
|
|
8447
|
+
# ```rb
|
|
8448
|
+
# "foo #{bar} baz"
|
|
8449
|
+
# ^^^^^^^^^^^^^^^^
|
|
8450
|
+
# ```
|
|
7967
8451
|
class InterpolatedStringNode < Node
|
|
7968
8452
|
# Initialize a new InterpolatedStringNode node.
|
|
7969
8453
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, opening_loc: ::T.nilable(Location), parts: T::Array[::T.any(StringNode, EmbeddedStatementsNode, EmbeddedVariableNode, InterpolatedStringNode)], closing_loc: ::T.nilable(Location)).void }
|
|
@@ -8051,8 +8535,9 @@ module Prism
|
|
|
8051
8535
|
|
|
8052
8536
|
# Represents a symbol literal that contains interpolation.
|
|
8053
8537
|
#
|
|
8054
|
-
#
|
|
8055
|
-
#
|
|
8538
|
+
# ```rb
|
|
8539
|
+
# ^^^^^^^^^^^^^^^^^
|
|
8540
|
+
# ```
|
|
8056
8541
|
class InterpolatedSymbolNode < Node
|
|
8057
8542
|
# Initialize a new InterpolatedSymbolNode node.
|
|
8058
8543
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, opening_loc: ::T.nilable(Location), parts: T::Array[::T.any(StringNode, EmbeddedStatementsNode, EmbeddedVariableNode)], closing_loc: ::T.nilable(Location)).void }
|
|
@@ -8132,8 +8617,10 @@ module Prism
|
|
|
8132
8617
|
|
|
8133
8618
|
# Represents an xstring literal that contains interpolation.
|
|
8134
8619
|
#
|
|
8135
|
-
#
|
|
8136
|
-
#
|
|
8620
|
+
# ```rb
|
|
8621
|
+
# `foo #{bar} baz`
|
|
8622
|
+
# ^^^^^^^^^^^^^^^^
|
|
8623
|
+
# ```
|
|
8137
8624
|
class InterpolatedXStringNode < Node
|
|
8138
8625
|
# Initialize a new InterpolatedXStringNode node.
|
|
8139
8626
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, opening_loc: Location, parts: T::Array[::T.any(StringNode, EmbeddedStatementsNode, EmbeddedVariableNode)], closing_loc: Location).void }
|
|
@@ -8213,8 +8700,10 @@ module Prism
|
|
|
8213
8700
|
|
|
8214
8701
|
# Represents reading from the implicit `it` local variable.
|
|
8215
8702
|
#
|
|
8216
|
-
#
|
|
8217
|
-
#
|
|
8703
|
+
# ```rb
|
|
8704
|
+
# -> { it }
|
|
8705
|
+
# ^^
|
|
8706
|
+
# ```
|
|
8218
8707
|
class ItLocalVariableReadNode < Node
|
|
8219
8708
|
# Initialize a new ItLocalVariableReadNode node.
|
|
8220
8709
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer).void }
|
|
@@ -8264,8 +8753,10 @@ module Prism
|
|
|
8264
8753
|
|
|
8265
8754
|
# Represents an implicit set of parameters through the use of the `it` keyword within a block or lambda.
|
|
8266
8755
|
#
|
|
8267
|
-
#
|
|
8268
|
-
#
|
|
8756
|
+
# ```rb
|
|
8757
|
+
# -> { it + it }
|
|
8758
|
+
# ^^^^^^^^^^^^^^
|
|
8759
|
+
# ```
|
|
8269
8760
|
class ItParametersNode < Node
|
|
8270
8761
|
# Initialize a new ItParametersNode node.
|
|
8271
8762
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer).void }
|
|
@@ -8315,8 +8806,10 @@ module Prism
|
|
|
8315
8806
|
|
|
8316
8807
|
# Represents a hash literal without opening and closing braces.
|
|
8317
8808
|
#
|
|
8318
|
-
#
|
|
8319
|
-
#
|
|
8809
|
+
# ```rb
|
|
8810
|
+
# foo(a: b)
|
|
8811
|
+
# ^^^^
|
|
8812
|
+
# ```
|
|
8320
8813
|
class KeywordHashNode < Node
|
|
8321
8814
|
# Initialize a new KeywordHashNode node.
|
|
8322
8815
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, elements: T::Array[::T.any(AssocNode, AssocSplatNode)]).void }
|
|
@@ -8374,9 +8867,11 @@ module Prism
|
|
|
8374
8867
|
|
|
8375
8868
|
# Represents a keyword rest parameter to a method, block, or lambda definition.
|
|
8376
8869
|
#
|
|
8377
|
-
#
|
|
8378
|
-
#
|
|
8379
|
-
#
|
|
8870
|
+
# ```rb
|
|
8871
|
+
# def a(**b)
|
|
8872
|
+
# ^^^
|
|
8873
|
+
# end
|
|
8874
|
+
# ```
|
|
8380
8875
|
class KeywordRestParameterNode < Node
|
|
8381
8876
|
# Initialize a new KeywordRestParameterNode node.
|
|
8382
8877
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: ::T.nilable(Symbol), name_loc: ::T.nilable(Location), operator_loc: Location).void }
|
|
@@ -8456,8 +8951,10 @@ module Prism
|
|
|
8456
8951
|
|
|
8457
8952
|
# Represents using a lambda literal (not the lambda method call).
|
|
8458
8953
|
#
|
|
8459
|
-
#
|
|
8460
|
-
#
|
|
8954
|
+
# ```rb
|
|
8955
|
+
# ->(value) { value * 2 }
|
|
8956
|
+
# ^^^^^^^^^^^^^^^^^^^^^^^
|
|
8957
|
+
# ```
|
|
8461
8958
|
class LambdaNode < Node
|
|
8462
8959
|
# Initialize a new LambdaNode node.
|
|
8463
8960
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, locals: T::Array[Symbol], operator_loc: Location, opening_loc: Location, closing_loc: Location, parameters: ::T.nilable(::T.any(BlockParametersNode, NumberedParametersNode, ItParametersNode)), body: ::T.nilable(::T.any(StatementsNode, BeginNode))).void }
|
|
@@ -8558,8 +9055,10 @@ module Prism
|
|
|
8558
9055
|
|
|
8559
9056
|
# Represents the use of the `&&=` operator for assignment to a local variable.
|
|
8560
9057
|
#
|
|
8561
|
-
#
|
|
8562
|
-
#
|
|
9058
|
+
# ```rb
|
|
9059
|
+
# target &&= value
|
|
9060
|
+
# ^^^^^^^^^^^^^^^^
|
|
9061
|
+
# ```
|
|
8563
9062
|
class LocalVariableAndWriteNode < Node
|
|
8564
9063
|
# Initialize a new LocalVariableAndWriteNode node.
|
|
8565
9064
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name_loc: Location, operator_loc: Location, value: Node, name: Symbol, depth: Integer).void }
|
|
@@ -8643,8 +9142,10 @@ module Prism
|
|
|
8643
9142
|
|
|
8644
9143
|
# Represents assigning to a local variable using an operator that isn't `=`.
|
|
8645
9144
|
#
|
|
8646
|
-
#
|
|
8647
|
-
#
|
|
9145
|
+
# ```rb
|
|
9146
|
+
# target += value
|
|
9147
|
+
# ^^^^^^^^^^^^^^^
|
|
9148
|
+
# ```
|
|
8648
9149
|
class LocalVariableOperatorWriteNode < Node
|
|
8649
9150
|
# Initialize a new LocalVariableOperatorWriteNode node.
|
|
8650
9151
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name_loc: Location, binary_operator_loc: Location, value: Node, name: Symbol, binary_operator: Symbol, depth: Integer).void }
|
|
@@ -8728,8 +9229,10 @@ module Prism
|
|
|
8728
9229
|
|
|
8729
9230
|
# Represents the use of the `||=` operator for assignment to a local variable.
|
|
8730
9231
|
#
|
|
8731
|
-
#
|
|
8732
|
-
#
|
|
9232
|
+
# ```rb
|
|
9233
|
+
# target ||= value
|
|
9234
|
+
# ^^^^^^^^^^^^^^^^
|
|
9235
|
+
# ```
|
|
8733
9236
|
class LocalVariableOrWriteNode < Node
|
|
8734
9237
|
# Initialize a new LocalVariableOrWriteNode node.
|
|
8735
9238
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name_loc: Location, operator_loc: Location, value: Node, name: Symbol, depth: Integer).void }
|
|
@@ -8813,8 +9316,10 @@ module Prism
|
|
|
8813
9316
|
|
|
8814
9317
|
# Represents reading a local variable. Note that this requires that a local variable of the same name has already been written to in the same scope, otherwise it is parsed as a method call.
|
|
8815
9318
|
#
|
|
8816
|
-
#
|
|
8817
|
-
#
|
|
9319
|
+
# ```rb
|
|
9320
|
+
# foo
|
|
9321
|
+
# ^^^
|
|
9322
|
+
# ```
|
|
8818
9323
|
class LocalVariableReadNode < Node
|
|
8819
9324
|
# Initialize a new LocalVariableReadNode node.
|
|
8820
9325
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, depth: Integer).void }
|
|
@@ -8860,22 +9365,28 @@ module Prism
|
|
|
8860
9365
|
|
|
8861
9366
|
# The name of the local variable, which is an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers).
|
|
8862
9367
|
#
|
|
8863
|
-
#
|
|
9368
|
+
# ```rb
|
|
9369
|
+
# x # name `:x`
|
|
8864
9370
|
#
|
|
8865
|
-
#
|
|
9371
|
+
# _Test # name `:_Test`
|
|
8866
9372
|
#
|
|
9373
|
+
# ```
|
|
8867
9374
|
# Note that this can also be an underscore followed by a number for the default block parameters.
|
|
8868
9375
|
#
|
|
8869
|
-
#
|
|
9376
|
+
# ```rb
|
|
9377
|
+
# _1 # name `:_1`
|
|
9378
|
+
# ```
|
|
8870
9379
|
sig { returns(Symbol) }
|
|
8871
9380
|
def name; end
|
|
8872
9381
|
|
|
8873
9382
|
# The number of visible scopes that should be searched to find the origin of this local variable.
|
|
8874
9383
|
#
|
|
8875
|
-
#
|
|
9384
|
+
# ```rb
|
|
9385
|
+
# foo = 1; foo # depth 0
|
|
8876
9386
|
#
|
|
8877
|
-
#
|
|
9387
|
+
# bar = 2; tap { bar } # depth 1
|
|
8878
9388
|
#
|
|
9389
|
+
# ```
|
|
8879
9390
|
# The specific rules for calculating the depth may differ from individual Ruby implementations, as they are not specified by the language. For more information, see [the Prism documentation](https://github.com/ruby/prism/blob/main/docs/local_variable_depth.md).
|
|
8880
9391
|
sig { returns(Integer) }
|
|
8881
9392
|
def depth; end
|
|
@@ -8886,11 +9397,13 @@ module Prism
|
|
|
8886
9397
|
|
|
8887
9398
|
# Represents writing to a local variable in a context that doesn't have an explicit value.
|
|
8888
9399
|
#
|
|
8889
|
-
#
|
|
8890
|
-
#
|
|
9400
|
+
# ```rb
|
|
9401
|
+
# foo, bar = baz
|
|
9402
|
+
# ^^^ ^^^
|
|
8891
9403
|
#
|
|
8892
|
-
#
|
|
8893
|
-
#
|
|
9404
|
+
# foo => baz
|
|
9405
|
+
# ^^^
|
|
9406
|
+
# ```
|
|
8894
9407
|
class LocalVariableTargetNode < Node
|
|
8895
9408
|
# Initialize a new LocalVariableTargetNode node.
|
|
8896
9409
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, depth: Integer).void }
|
|
@@ -8948,8 +9461,10 @@ module Prism
|
|
|
8948
9461
|
|
|
8949
9462
|
# Represents writing to a local variable.
|
|
8950
9463
|
#
|
|
8951
|
-
#
|
|
8952
|
-
#
|
|
9464
|
+
# ```rb
|
|
9465
|
+
# foo = 1
|
|
9466
|
+
# ^^^^^^^
|
|
9467
|
+
# ```
|
|
8953
9468
|
class LocalVariableWriteNode < Node
|
|
8954
9469
|
# Initialize a new LocalVariableWriteNode node.
|
|
8955
9470
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, depth: Integer, name_loc: Location, value: Node, operator_loc: Location).void }
|
|
@@ -8995,26 +9510,32 @@ module Prism
|
|
|
8995
9510
|
|
|
8996
9511
|
# The name of the local variable, which is an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers).
|
|
8997
9512
|
#
|
|
8998
|
-
#
|
|
9513
|
+
# ```rb
|
|
9514
|
+
# foo = :bar # name `:foo`
|
|
8999
9515
|
#
|
|
9000
|
-
#
|
|
9516
|
+
# abc = 123 # name `:abc`
|
|
9517
|
+
# ```
|
|
9001
9518
|
sig { returns(Symbol) }
|
|
9002
9519
|
def name; end
|
|
9003
9520
|
|
|
9004
9521
|
# The number of semantic scopes we have to traverse to find the declaration of this variable.
|
|
9005
9522
|
#
|
|
9006
|
-
#
|
|
9523
|
+
# ```rb
|
|
9524
|
+
# foo = 1 # depth 0
|
|
9007
9525
|
#
|
|
9008
|
-
#
|
|
9526
|
+
# tap { foo = 1 } # depth 1
|
|
9009
9527
|
#
|
|
9528
|
+
# ```
|
|
9010
9529
|
# The specific rules for calculating the depth may differ from individual Ruby implementations, as they are not specified by the language. For more information, see [the Prism documentation](https://github.com/ruby/prism/blob/main/docs/local_variable_depth.md).
|
|
9011
9530
|
sig { returns(Integer) }
|
|
9012
9531
|
def depth; end
|
|
9013
9532
|
|
|
9014
9533
|
# The Location of the variable name.
|
|
9015
9534
|
#
|
|
9016
|
-
#
|
|
9017
|
-
#
|
|
9535
|
+
# ```rb
|
|
9536
|
+
# foo = :bar
|
|
9537
|
+
# ^^^
|
|
9538
|
+
# ```
|
|
9018
9539
|
sig { returns(Location) }
|
|
9019
9540
|
def name_loc; end
|
|
9020
9541
|
|
|
@@ -9025,22 +9546,28 @@ module Prism
|
|
|
9025
9546
|
|
|
9026
9547
|
# The value to write to the local variable. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
9027
9548
|
#
|
|
9028
|
-
#
|
|
9029
|
-
#
|
|
9549
|
+
# ```rb
|
|
9550
|
+
# foo = :bar
|
|
9551
|
+
# ^^^^
|
|
9030
9552
|
#
|
|
9031
|
-
#
|
|
9032
|
-
#
|
|
9553
|
+
# abc = 1234
|
|
9554
|
+
# ^^^^
|
|
9033
9555
|
#
|
|
9556
|
+
# ```
|
|
9034
9557
|
# Note that since the name of a local variable is known before the value is parsed, it is valid for a local variable to appear within the value of its own write.
|
|
9035
9558
|
#
|
|
9036
|
-
#
|
|
9559
|
+
# ```rb
|
|
9560
|
+
# foo = foo
|
|
9561
|
+
# ```
|
|
9037
9562
|
sig { returns(Node) }
|
|
9038
9563
|
def value; end
|
|
9039
9564
|
|
|
9040
9565
|
# The Location of the `=` operator.
|
|
9041
9566
|
#
|
|
9042
|
-
#
|
|
9043
|
-
#
|
|
9567
|
+
# ```rb
|
|
9568
|
+
# x = :y
|
|
9569
|
+
# ^
|
|
9570
|
+
# ```
|
|
9044
9571
|
sig { returns(Location) }
|
|
9045
9572
|
def operator_loc; end
|
|
9046
9573
|
|
|
@@ -9059,8 +9586,10 @@ module Prism
|
|
|
9059
9586
|
|
|
9060
9587
|
# Represents a regular expression literal used in the predicate of a conditional to implicitly match against the last line read by an IO object.
|
|
9061
9588
|
#
|
|
9062
|
-
#
|
|
9063
|
-
#
|
|
9589
|
+
# ```rb
|
|
9590
|
+
# if /foo/i then end
|
|
9591
|
+
# ^^^^^^
|
|
9592
|
+
# ```
|
|
9064
9593
|
class MatchLastLineNode < Node
|
|
9065
9594
|
# Initialize a new MatchLastLineNode node.
|
|
9066
9595
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, opening_loc: Location, content_loc: Location, closing_loc: Location, unescaped: String).void }
|
|
@@ -9197,8 +9726,10 @@ module Prism
|
|
|
9197
9726
|
|
|
9198
9727
|
# Represents the use of the modifier `in` operator.
|
|
9199
9728
|
#
|
|
9200
|
-
#
|
|
9201
|
-
#
|
|
9729
|
+
# ```rb
|
|
9730
|
+
# foo in bar
|
|
9731
|
+
# ^^^^^^^^^^
|
|
9732
|
+
# ```
|
|
9202
9733
|
class MatchPredicateNode < Node
|
|
9203
9734
|
# Initialize a new MatchPredicateNode node.
|
|
9204
9735
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, value: Node, pattern: Node, keyword_loc: Location).void }
|
|
@@ -9269,8 +9800,10 @@ module Prism
|
|
|
9269
9800
|
|
|
9270
9801
|
# Represents the use of the `=>` operator.
|
|
9271
9802
|
#
|
|
9272
|
-
#
|
|
9273
|
-
#
|
|
9803
|
+
# ```rb
|
|
9804
|
+
# foo => bar
|
|
9805
|
+
# ^^^^^^^^^^
|
|
9806
|
+
# ```
|
|
9274
9807
|
class MatchRequiredNode < Node
|
|
9275
9808
|
# Initialize a new MatchRequiredNode node.
|
|
9276
9809
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, value: Node, pattern: Node, operator_loc: Location).void }
|
|
@@ -9316,8 +9849,10 @@ module Prism
|
|
|
9316
9849
|
|
|
9317
9850
|
# Represents the left-hand side of the operator.
|
|
9318
9851
|
#
|
|
9319
|
-
#
|
|
9320
|
-
#
|
|
9852
|
+
# ```rb
|
|
9853
|
+
# foo => bar
|
|
9854
|
+
# ^^^
|
|
9855
|
+
# ```
|
|
9321
9856
|
sig { returns(Node) }
|
|
9322
9857
|
def value; end
|
|
9323
9858
|
|
|
@@ -9325,52 +9860,68 @@ module Prism
|
|
|
9325
9860
|
#
|
|
9326
9861
|
# Anything that looks like a local variable name (including `_`) will result in a `LocalVariableTargetNode`.
|
|
9327
9862
|
#
|
|
9328
|
-
#
|
|
9329
|
-
#
|
|
9863
|
+
# ```rb
|
|
9864
|
+
# foo => a # This is equivalent to writing `a = foo`
|
|
9865
|
+
# ^
|
|
9330
9866
|
#
|
|
9867
|
+
# ```
|
|
9331
9868
|
# Using an explicit `Array` or combining expressions with `,` will result in a `ArrayPatternNode`. This can be preceded by a constant.
|
|
9332
9869
|
#
|
|
9333
|
-
#
|
|
9334
|
-
#
|
|
9870
|
+
# ```rb
|
|
9871
|
+
# foo => [a]
|
|
9872
|
+
# ^^^
|
|
9335
9873
|
#
|
|
9336
|
-
#
|
|
9337
|
-
#
|
|
9874
|
+
# foo => a, b
|
|
9875
|
+
# ^^^^
|
|
9338
9876
|
#
|
|
9339
|
-
#
|
|
9340
|
-
#
|
|
9877
|
+
# foo => Bar[a, b]
|
|
9878
|
+
# ^^^^^^^^^
|
|
9341
9879
|
#
|
|
9880
|
+
# ```
|
|
9342
9881
|
# If the array pattern contains at least two wildcard matches, a `FindPatternNode` is created instead.
|
|
9343
9882
|
#
|
|
9344
|
-
#
|
|
9345
|
-
#
|
|
9883
|
+
# ```rb
|
|
9884
|
+
# foo => *, 1, *a
|
|
9885
|
+
# ^^^^^
|
|
9346
9886
|
#
|
|
9887
|
+
# ```
|
|
9347
9888
|
# Using an explicit `Hash` or a constant with square brackets and hash keys in the square brackets will result in a `HashPatternNode`.
|
|
9348
9889
|
#
|
|
9349
|
-
#
|
|
9890
|
+
# ```rb
|
|
9891
|
+
# foo => { a: 1, b: }
|
|
9350
9892
|
#
|
|
9351
|
-
#
|
|
9893
|
+
# foo => Bar[a: 1, b:]
|
|
9352
9894
|
#
|
|
9353
|
-
#
|
|
9895
|
+
# foo => Bar[**]
|
|
9354
9896
|
#
|
|
9897
|
+
# ```
|
|
9355
9898
|
# To use any variable that needs run time evaluation, pinning is required. This results in a `PinnedVariableNode`
|
|
9356
9899
|
#
|
|
9357
|
-
#
|
|
9358
|
-
#
|
|
9900
|
+
# ```rb
|
|
9901
|
+
# foo => ^a
|
|
9902
|
+
# ^^
|
|
9359
9903
|
#
|
|
9904
|
+
# ```
|
|
9360
9905
|
# Similar, any expression can be used with pinning. This results in a `PinnedExpressionNode`.
|
|
9361
9906
|
#
|
|
9362
|
-
#
|
|
9907
|
+
# ```rb
|
|
9908
|
+
# foo => ^(a + 1)
|
|
9363
9909
|
#
|
|
9910
|
+
# ```
|
|
9364
9911
|
# Anything else will result in the regular node for that expression, for example a `ConstantReadNode`.
|
|
9365
9912
|
#
|
|
9366
|
-
#
|
|
9913
|
+
# ```rb
|
|
9914
|
+
# foo => CONST
|
|
9915
|
+
# ```
|
|
9367
9916
|
sig { returns(Node) }
|
|
9368
9917
|
def pattern; end
|
|
9369
9918
|
|
|
9370
9919
|
# The Location of the operator.
|
|
9371
9920
|
#
|
|
9372
|
-
#
|
|
9373
|
-
#
|
|
9921
|
+
# ```rb
|
|
9922
|
+
# foo => bar
|
|
9923
|
+
# ^^
|
|
9924
|
+
# ```
|
|
9374
9925
|
sig { returns(Location) }
|
|
9375
9926
|
def operator_loc; end
|
|
9376
9927
|
|
|
@@ -9389,8 +9940,10 @@ module Prism
|
|
|
9389
9940
|
|
|
9390
9941
|
# Represents writing local variables using a regular expression match with named capture groups.
|
|
9391
9942
|
#
|
|
9392
|
-
#
|
|
9393
|
-
#
|
|
9943
|
+
# ```rb
|
|
9944
|
+
# /(?<foo>bar)/ =~ baz
|
|
9945
|
+
# ^^^^^^^^^^^^^^^^^^^^
|
|
9946
|
+
# ```
|
|
9394
9947
|
class MatchWriteNode < Node
|
|
9395
9948
|
# Initialize a new MatchWriteNode node.
|
|
9396
9949
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, call: CallNode, targets: T::Array[LocalVariableTargetNode]).void }
|
|
@@ -9448,8 +10001,10 @@ module Prism
|
|
|
9448
10001
|
|
|
9449
10002
|
# Represents a module declaration involving the `module` keyword.
|
|
9450
10003
|
#
|
|
9451
|
-
#
|
|
9452
|
-
#
|
|
10004
|
+
# ```rb
|
|
10005
|
+
# module Foo end
|
|
10006
|
+
# ^^^^^^^^^^^^^^
|
|
10007
|
+
# ```
|
|
9453
10008
|
class ModuleNode < Node
|
|
9454
10009
|
# Initialize a new ModuleNode node.
|
|
9455
10010
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, locals: T::Array[Symbol], module_keyword_loc: Location, constant_path: ::T.any(ConstantReadNode, ConstantPathNode), body: ::T.nilable(::T.any(StatementsNode, BeginNode)), end_keyword_loc: Location, name: Symbol).void }
|
|
@@ -9541,13 +10096,17 @@ module Prism
|
|
|
9541
10096
|
|
|
9542
10097
|
# Represents a multi-target expression.
|
|
9543
10098
|
#
|
|
9544
|
-
#
|
|
9545
|
-
#
|
|
10099
|
+
# ```rb
|
|
10100
|
+
# a, (b, c) = 1, 2, 3
|
|
10101
|
+
# ^^^^^^
|
|
9546
10102
|
#
|
|
10103
|
+
# ```
|
|
9547
10104
|
# This can be a part of `MultiWriteNode` as above, or the target of a `for` loop
|
|
9548
10105
|
#
|
|
9549
|
-
#
|
|
9550
|
-
#
|
|
10106
|
+
# ```rb
|
|
10107
|
+
# for a, b in [[1, 2], [3, 4]]
|
|
10108
|
+
# ^^^^
|
|
10109
|
+
# ```
|
|
9551
10110
|
class MultiTargetNode < Node
|
|
9552
10111
|
# Initialize a new MultiTargetNode node.
|
|
9553
10112
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, lefts: T::Array[::T.any(LocalVariableTargetNode, InstanceVariableTargetNode, ClassVariableTargetNode, GlobalVariableTargetNode, ConstantTargetNode, ConstantPathTargetNode, CallTargetNode, IndexTargetNode, MultiTargetNode, RequiredParameterNode)], rest: ::T.nilable(::T.any(ImplicitRestNode, SplatNode)), rights: T::Array[::T.any(LocalVariableTargetNode, InstanceVariableTargetNode, ClassVariableTargetNode, GlobalVariableTargetNode, ConstantTargetNode, ConstantPathTargetNode, CallTargetNode, IndexTargetNode, MultiTargetNode, RequiredParameterNode)], lparen_loc: ::T.nilable(Location), rparen_loc: ::T.nilable(Location)).void }
|
|
@@ -9593,44 +10152,58 @@ module Prism
|
|
|
9593
10152
|
|
|
9594
10153
|
# Represents the targets expressions before a splat node.
|
|
9595
10154
|
#
|
|
9596
|
-
#
|
|
9597
|
-
#
|
|
10155
|
+
# ```rb
|
|
10156
|
+
# a, (b, c, *) = 1, 2, 3, 4, 5
|
|
10157
|
+
# ^^^^
|
|
9598
10158
|
#
|
|
10159
|
+
# ```
|
|
9599
10160
|
# The splat node can be absent, in that case all target expressions are in the left field.
|
|
9600
10161
|
#
|
|
9601
|
-
#
|
|
9602
|
-
#
|
|
10162
|
+
# ```rb
|
|
10163
|
+
# a, (b, c) = 1, 2, 3, 4, 5
|
|
10164
|
+
# ^^^^
|
|
10165
|
+
# ```
|
|
9603
10166
|
sig { returns(T::Array[::T.any(LocalVariableTargetNode, InstanceVariableTargetNode, ClassVariableTargetNode, GlobalVariableTargetNode, ConstantTargetNode, ConstantPathTargetNode, CallTargetNode, IndexTargetNode, MultiTargetNode, RequiredParameterNode)]) }
|
|
9604
10167
|
def lefts; end
|
|
9605
10168
|
|
|
9606
10169
|
# Represents a splat node in the target expression.
|
|
9607
10170
|
#
|
|
9608
|
-
#
|
|
9609
|
-
#
|
|
10171
|
+
# ```rb
|
|
10172
|
+
# a, (b, *c) = 1, 2, 3, 4
|
|
10173
|
+
# ^^
|
|
9610
10174
|
#
|
|
10175
|
+
# ```
|
|
9611
10176
|
# The variable can be empty, this results in a `SplatNode` with a `nil` expression field.
|
|
9612
10177
|
#
|
|
9613
|
-
#
|
|
9614
|
-
#
|
|
10178
|
+
# ```rb
|
|
10179
|
+
# a, (b, *) = 1, 2, 3, 4
|
|
10180
|
+
# ^
|
|
9615
10181
|
#
|
|
10182
|
+
# ```
|
|
9616
10183
|
# If the `*` is omitted, this field will contain an `ImplicitRestNode`
|
|
9617
10184
|
#
|
|
9618
|
-
#
|
|
9619
|
-
#
|
|
10185
|
+
# ```rb
|
|
10186
|
+
# a, (b,) = 1, 2, 3, 4
|
|
10187
|
+
# ^
|
|
10188
|
+
# ```
|
|
9620
10189
|
sig { returns(::T.nilable(::T.any(ImplicitRestNode, SplatNode))) }
|
|
9621
10190
|
def rest; end
|
|
9622
10191
|
|
|
9623
10192
|
# Represents the targets expressions after a splat node.
|
|
9624
10193
|
#
|
|
9625
|
-
#
|
|
9626
|
-
#
|
|
10194
|
+
# ```rb
|
|
10195
|
+
# a, (*, b, c) = 1, 2, 3, 4, 5
|
|
10196
|
+
# ^^^^
|
|
10197
|
+
# ```
|
|
9627
10198
|
sig { returns(T::Array[::T.any(LocalVariableTargetNode, InstanceVariableTargetNode, ClassVariableTargetNode, GlobalVariableTargetNode, ConstantTargetNode, ConstantPathTargetNode, CallTargetNode, IndexTargetNode, MultiTargetNode, RequiredParameterNode)]) }
|
|
9628
10199
|
def rights; end
|
|
9629
10200
|
|
|
9630
10201
|
# The Location of the opening parenthesis.
|
|
9631
10202
|
#
|
|
9632
|
-
#
|
|
9633
|
-
#
|
|
10203
|
+
# ```rb
|
|
10204
|
+
# a, (b, c) = 1, 2, 3
|
|
10205
|
+
# ^
|
|
10206
|
+
# ```
|
|
9634
10207
|
sig { returns(::T.nilable(Location)) }
|
|
9635
10208
|
def lparen_loc; end
|
|
9636
10209
|
|
|
@@ -9641,8 +10214,10 @@ module Prism
|
|
|
9641
10214
|
|
|
9642
10215
|
# The Location of the closing parenthesis.
|
|
9643
10216
|
#
|
|
9644
|
-
#
|
|
9645
|
-
#
|
|
10217
|
+
# ```rb
|
|
10218
|
+
# a, (b, c) = 1, 2, 3
|
|
10219
|
+
# ^
|
|
10220
|
+
# ```
|
|
9646
10221
|
sig { returns(::T.nilable(Location)) }
|
|
9647
10222
|
def rparen_loc; end
|
|
9648
10223
|
|
|
@@ -9665,8 +10240,10 @@ module Prism
|
|
|
9665
10240
|
|
|
9666
10241
|
# Represents a write to a multi-target expression.
|
|
9667
10242
|
#
|
|
9668
|
-
#
|
|
9669
|
-
#
|
|
10243
|
+
# ```rb
|
|
10244
|
+
# a, b, c = 1, 2, 3
|
|
10245
|
+
# ^^^^^^^^^^^^^^^^^
|
|
10246
|
+
# ```
|
|
9670
10247
|
class MultiWriteNode < Node
|
|
9671
10248
|
# Initialize a new MultiWriteNode node.
|
|
9672
10249
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, lefts: T::Array[::T.any(LocalVariableTargetNode, InstanceVariableTargetNode, ClassVariableTargetNode, GlobalVariableTargetNode, ConstantTargetNode, ConstantPathTargetNode, CallTargetNode, IndexTargetNode, MultiTargetNode)], rest: ::T.nilable(::T.any(ImplicitRestNode, SplatNode)), rights: T::Array[::T.any(LocalVariableTargetNode, InstanceVariableTargetNode, ClassVariableTargetNode, GlobalVariableTargetNode, ConstantTargetNode, ConstantPathTargetNode, CallTargetNode, IndexTargetNode, MultiTargetNode)], lparen_loc: ::T.nilable(Location), rparen_loc: ::T.nilable(Location), operator_loc: Location, value: Node).void }
|
|
@@ -9712,44 +10289,58 @@ module Prism
|
|
|
9712
10289
|
|
|
9713
10290
|
# Represents the targets expressions before a splat node.
|
|
9714
10291
|
#
|
|
9715
|
-
#
|
|
9716
|
-
#
|
|
10292
|
+
# ```rb
|
|
10293
|
+
# a, b, * = 1, 2, 3, 4, 5
|
|
10294
|
+
# ^^^^
|
|
9717
10295
|
#
|
|
10296
|
+
# ```
|
|
9718
10297
|
# The splat node can be absent, in that case all target expressions are in the left field.
|
|
9719
10298
|
#
|
|
9720
|
-
#
|
|
9721
|
-
#
|
|
10299
|
+
# ```rb
|
|
10300
|
+
# a, b, c = 1, 2, 3, 4, 5
|
|
10301
|
+
# ^^^^^^^
|
|
10302
|
+
# ```
|
|
9722
10303
|
sig { returns(T::Array[::T.any(LocalVariableTargetNode, InstanceVariableTargetNode, ClassVariableTargetNode, GlobalVariableTargetNode, ConstantTargetNode, ConstantPathTargetNode, CallTargetNode, IndexTargetNode, MultiTargetNode)]) }
|
|
9723
10304
|
def lefts; end
|
|
9724
10305
|
|
|
9725
10306
|
# Represents a splat node in the target expression.
|
|
9726
10307
|
#
|
|
9727
|
-
#
|
|
9728
|
-
#
|
|
10308
|
+
# ```rb
|
|
10309
|
+
# a, b, *c = 1, 2, 3, 4
|
|
10310
|
+
# ^^
|
|
9729
10311
|
#
|
|
10312
|
+
# ```
|
|
9730
10313
|
# The variable can be empty, this results in a `SplatNode` with a `nil` expression field.
|
|
9731
10314
|
#
|
|
9732
|
-
#
|
|
9733
|
-
#
|
|
10315
|
+
# ```rb
|
|
10316
|
+
# a, b, * = 1, 2, 3, 4
|
|
10317
|
+
# ^
|
|
9734
10318
|
#
|
|
10319
|
+
# ```
|
|
9735
10320
|
# If the `*` is omitted, this field will contain an `ImplicitRestNode`
|
|
9736
10321
|
#
|
|
9737
|
-
#
|
|
9738
|
-
#
|
|
10322
|
+
# ```rb
|
|
10323
|
+
# a, b, = 1, 2, 3, 4
|
|
10324
|
+
# ^
|
|
10325
|
+
# ```
|
|
9739
10326
|
sig { returns(::T.nilable(::T.any(ImplicitRestNode, SplatNode))) }
|
|
9740
10327
|
def rest; end
|
|
9741
10328
|
|
|
9742
10329
|
# Represents the targets expressions after a splat node.
|
|
9743
10330
|
#
|
|
9744
|
-
#
|
|
9745
|
-
#
|
|
10331
|
+
# ```rb
|
|
10332
|
+
# a, *, b, c = 1, 2, 3, 4, 5
|
|
10333
|
+
# ^^^^
|
|
10334
|
+
# ```
|
|
9746
10335
|
sig { returns(T::Array[::T.any(LocalVariableTargetNode, InstanceVariableTargetNode, ClassVariableTargetNode, GlobalVariableTargetNode, ConstantTargetNode, ConstantPathTargetNode, CallTargetNode, IndexTargetNode, MultiTargetNode)]) }
|
|
9747
10336
|
def rights; end
|
|
9748
10337
|
|
|
9749
10338
|
# The Location of the opening parenthesis.
|
|
9750
10339
|
#
|
|
9751
|
-
#
|
|
9752
|
-
#
|
|
10340
|
+
# ```rb
|
|
10341
|
+
# (a, b, c) = 1, 2, 3
|
|
10342
|
+
# ^
|
|
10343
|
+
# ```
|
|
9753
10344
|
sig { returns(::T.nilable(Location)) }
|
|
9754
10345
|
def lparen_loc; end
|
|
9755
10346
|
|
|
@@ -9760,8 +10351,10 @@ module Prism
|
|
|
9760
10351
|
|
|
9761
10352
|
# The Location of the closing parenthesis.
|
|
9762
10353
|
#
|
|
9763
|
-
#
|
|
9764
|
-
#
|
|
10354
|
+
# ```rb
|
|
10355
|
+
# (a, b, c) = 1, 2, 3
|
|
10356
|
+
# ^
|
|
10357
|
+
# ```
|
|
9765
10358
|
sig { returns(::T.nilable(Location)) }
|
|
9766
10359
|
def rparen_loc; end
|
|
9767
10360
|
|
|
@@ -9772,8 +10365,10 @@ module Prism
|
|
|
9772
10365
|
|
|
9773
10366
|
# The Location of the operator.
|
|
9774
10367
|
#
|
|
9775
|
-
#
|
|
9776
|
-
#
|
|
10368
|
+
# ```rb
|
|
10369
|
+
# a, b, c = 1, 2, 3
|
|
10370
|
+
# ^
|
|
10371
|
+
# ```
|
|
9777
10372
|
sig { returns(Location) }
|
|
9778
10373
|
def operator_loc; end
|
|
9779
10374
|
|
|
@@ -9784,8 +10379,10 @@ module Prism
|
|
|
9784
10379
|
|
|
9785
10380
|
# The value to write to the targets. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
9786
10381
|
#
|
|
9787
|
-
#
|
|
9788
|
-
#
|
|
10382
|
+
# ```rb
|
|
10383
|
+
# a, b, c = 1, 2, 3
|
|
10384
|
+
# ^^^^^^^
|
|
10385
|
+
# ```
|
|
9789
10386
|
sig { returns(Node) }
|
|
9790
10387
|
def value; end
|
|
9791
10388
|
|
|
@@ -9807,8 +10404,10 @@ module Prism
|
|
|
9807
10404
|
|
|
9808
10405
|
# Represents the use of the `next` keyword.
|
|
9809
10406
|
#
|
|
9810
|
-
#
|
|
9811
|
-
#
|
|
10407
|
+
# ```rb
|
|
10408
|
+
# next 1
|
|
10409
|
+
# ^^^^^^
|
|
10410
|
+
# ```
|
|
9812
10411
|
class NextNode < Node
|
|
9813
10412
|
# Initialize a new NextNode node.
|
|
9814
10413
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, arguments: ::T.nilable(ArgumentsNode), keyword_loc: Location).void }
|
|
@@ -9875,8 +10474,10 @@ module Prism
|
|
|
9875
10474
|
|
|
9876
10475
|
# Represents the use of the `nil` keyword.
|
|
9877
10476
|
#
|
|
9878
|
-
#
|
|
9879
|
-
#
|
|
10477
|
+
# ```rb
|
|
10478
|
+
# nil
|
|
10479
|
+
# ^^^
|
|
10480
|
+
# ```
|
|
9880
10481
|
class NilNode < Node
|
|
9881
10482
|
# Initialize a new NilNode node.
|
|
9882
10483
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer).void }
|
|
@@ -9926,9 +10527,11 @@ module Prism
|
|
|
9926
10527
|
|
|
9927
10528
|
# Represents the use of `&nil` inside method arguments.
|
|
9928
10529
|
#
|
|
9929
|
-
#
|
|
9930
|
-
#
|
|
9931
|
-
#
|
|
10530
|
+
# ```rb
|
|
10531
|
+
# def a(&nil)
|
|
10532
|
+
# ^^^^
|
|
10533
|
+
# end
|
|
10534
|
+
# ```
|
|
9932
10535
|
class NoBlockParameterNode < Node
|
|
9933
10536
|
# Initialize a new NoBlockParameterNode node.
|
|
9934
10537
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, operator_loc: Location, keyword_loc: Location).void }
|
|
@@ -10004,9 +10607,11 @@ module Prism
|
|
|
10004
10607
|
|
|
10005
10608
|
# Represents the use of `**nil` inside method arguments.
|
|
10006
10609
|
#
|
|
10007
|
-
#
|
|
10008
|
-
#
|
|
10009
|
-
#
|
|
10610
|
+
# ```rb
|
|
10611
|
+
# def a(**nil)
|
|
10612
|
+
# ^^^^^
|
|
10613
|
+
# end
|
|
10614
|
+
# ```
|
|
10010
10615
|
class NoKeywordsParameterNode < Node
|
|
10011
10616
|
# Initialize a new NoKeywordsParameterNode node.
|
|
10012
10617
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, operator_loc: Location, keyword_loc: Location).void }
|
|
@@ -10082,8 +10687,10 @@ module Prism
|
|
|
10082
10687
|
|
|
10083
10688
|
# Represents an implicit set of parameters through the use of numbered parameters within a block or lambda.
|
|
10084
10689
|
#
|
|
10085
|
-
#
|
|
10086
|
-
#
|
|
10690
|
+
# ```rb
|
|
10691
|
+
# -> { _1 + _2 }
|
|
10692
|
+
# ^^^^^^^^^^^^^^
|
|
10693
|
+
# ```
|
|
10087
10694
|
class NumberedParametersNode < Node
|
|
10088
10695
|
# Initialize a new NumberedParametersNode node.
|
|
10089
10696
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, maximum: Integer).void }
|
|
@@ -10137,8 +10744,10 @@ module Prism
|
|
|
10137
10744
|
|
|
10138
10745
|
# Represents reading a numbered reference to a capture in the previous match.
|
|
10139
10746
|
#
|
|
10140
|
-
#
|
|
10141
|
-
#
|
|
10747
|
+
# ```rb
|
|
10748
|
+
# $1
|
|
10749
|
+
# ^^
|
|
10750
|
+
# ```
|
|
10142
10751
|
class NumberedReferenceReadNode < Node
|
|
10143
10752
|
# Initialize a new NumberedReferenceReadNode node.
|
|
10144
10753
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, number: Integer).void }
|
|
@@ -10184,11 +10793,13 @@ module Prism
|
|
|
10184
10793
|
|
|
10185
10794
|
# The (1-indexed, from the left) number of the capture group. Numbered references that are too large result in this value being `0`.
|
|
10186
10795
|
#
|
|
10187
|
-
#
|
|
10796
|
+
# ```rb
|
|
10797
|
+
# $1 # number `1`
|
|
10188
10798
|
#
|
|
10189
|
-
#
|
|
10799
|
+
# $5432 # number `5432`
|
|
10190
10800
|
#
|
|
10191
|
-
#
|
|
10801
|
+
# $4294967296 # number `0`
|
|
10802
|
+
# ```
|
|
10192
10803
|
sig { returns(Integer) }
|
|
10193
10804
|
def number; end
|
|
10194
10805
|
|
|
@@ -10198,9 +10809,11 @@ module Prism
|
|
|
10198
10809
|
|
|
10199
10810
|
# Represents an optional keyword parameter to a method, block, or lambda definition.
|
|
10200
10811
|
#
|
|
10201
|
-
#
|
|
10202
|
-
#
|
|
10203
|
-
#
|
|
10812
|
+
# ```rb
|
|
10813
|
+
# def a(b: 1)
|
|
10814
|
+
# ^^^^
|
|
10815
|
+
# end
|
|
10816
|
+
# ```
|
|
10204
10817
|
class OptionalKeywordParameterNode < Node
|
|
10205
10818
|
# Initialize a new OptionalKeywordParameterNode node.
|
|
10206
10819
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, value: Node).void }
|
|
@@ -10271,9 +10884,11 @@ module Prism
|
|
|
10271
10884
|
|
|
10272
10885
|
# Represents an optional parameter to a method, block, or lambda definition.
|
|
10273
10886
|
#
|
|
10274
|
-
#
|
|
10275
|
-
#
|
|
10276
|
-
#
|
|
10887
|
+
# ```rb
|
|
10888
|
+
# def a(b = 1)
|
|
10889
|
+
# ^^^^^
|
|
10890
|
+
# end
|
|
10891
|
+
# ```
|
|
10277
10892
|
class OptionalParameterNode < Node
|
|
10278
10893
|
# Initialize a new OptionalParameterNode node.
|
|
10279
10894
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, operator_loc: Location, value: Node).void }
|
|
@@ -10357,8 +10972,10 @@ module Prism
|
|
|
10357
10972
|
|
|
10358
10973
|
# Represents the use of the `||` operator or the `or` keyword.
|
|
10359
10974
|
#
|
|
10360
|
-
#
|
|
10361
|
-
#
|
|
10975
|
+
# ```rb
|
|
10976
|
+
# left or right
|
|
10977
|
+
# ^^^^^^^^^^^^^
|
|
10978
|
+
# ```
|
|
10362
10979
|
class OrNode < Node
|
|
10363
10980
|
# Initialize a new OrNode node.
|
|
10364
10981
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, left: Node, right: Node, operator_loc: Location).void }
|
|
@@ -10404,28 +11021,34 @@ module Prism
|
|
|
10404
11021
|
|
|
10405
11022
|
# Represents the left side of the expression. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
10406
11023
|
#
|
|
10407
|
-
#
|
|
10408
|
-
#
|
|
11024
|
+
# ```rb
|
|
11025
|
+
# left or right
|
|
11026
|
+
# ^^^^
|
|
10409
11027
|
#
|
|
10410
|
-
#
|
|
10411
|
-
#
|
|
11028
|
+
# 1 || 2
|
|
11029
|
+
# ^
|
|
11030
|
+
# ```
|
|
10412
11031
|
sig { returns(Node) }
|
|
10413
11032
|
def left; end
|
|
10414
11033
|
|
|
10415
11034
|
# Represents the right side of the expression.
|
|
10416
11035
|
#
|
|
10417
|
-
#
|
|
10418
|
-
#
|
|
11036
|
+
# ```rb
|
|
11037
|
+
# left || right
|
|
11038
|
+
# ^^^^^
|
|
10419
11039
|
#
|
|
10420
|
-
#
|
|
10421
|
-
#
|
|
11040
|
+
# 1 or 2
|
|
11041
|
+
# ^
|
|
11042
|
+
# ```
|
|
10422
11043
|
sig { returns(Node) }
|
|
10423
11044
|
def right; end
|
|
10424
11045
|
|
|
10425
11046
|
# The Location of the `or` keyword or the `||` operator.
|
|
10426
11047
|
#
|
|
10427
|
-
#
|
|
10428
|
-
#
|
|
11048
|
+
# ```rb
|
|
11049
|
+
# left or right
|
|
11050
|
+
# ^^
|
|
11051
|
+
# ```
|
|
10429
11052
|
sig { returns(Location) }
|
|
10430
11053
|
def operator_loc; end
|
|
10431
11054
|
|
|
@@ -10444,9 +11067,11 @@ module Prism
|
|
|
10444
11067
|
|
|
10445
11068
|
# Represents the list of parameters on a method, block, or lambda definition.
|
|
10446
11069
|
#
|
|
10447
|
-
#
|
|
10448
|
-
#
|
|
10449
|
-
#
|
|
11070
|
+
# ```rb
|
|
11071
|
+
# def a(b, c, d)
|
|
11072
|
+
# ^^^^^^^
|
|
11073
|
+
# end
|
|
11074
|
+
# ```
|
|
10450
11075
|
class ParametersNode < Node
|
|
10451
11076
|
# Initialize a new ParametersNode node.
|
|
10452
11077
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, requireds: T::Array[::T.any(RequiredParameterNode, MultiTargetNode)], optionals: T::Array[OptionalParameterNode], rest: ::T.nilable(::T.any(RestParameterNode, ImplicitRestNode)), posts: T::Array[::T.any(RequiredParameterNode, MultiTargetNode)], keywords: T::Array[::T.any(RequiredKeywordParameterNode, OptionalKeywordParameterNode)], keyword_rest: ::T.nilable(::T.any(KeywordRestParameterNode, ForwardingParameterNode, NoKeywordsParameterNode)), block: ::T.nilable(::T.any(BlockParameterNode, NoBlockParameterNode))).void }
|
|
@@ -10524,8 +11149,10 @@ module Prism
|
|
|
10524
11149
|
|
|
10525
11150
|
# Represents a parenthesized expression
|
|
10526
11151
|
#
|
|
10527
|
-
#
|
|
10528
|
-
#
|
|
11152
|
+
# ```rb
|
|
11153
|
+
# (10 + 34)
|
|
11154
|
+
# ^^^^^^^^^
|
|
11155
|
+
# ```
|
|
10529
11156
|
class ParenthesesNode < Node
|
|
10530
11157
|
# Initialize a new ParenthesesNode node.
|
|
10531
11158
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, body: ::T.nilable(Node), opening_loc: Location, closing_loc: Location).void }
|
|
@@ -10609,8 +11236,10 @@ module Prism
|
|
|
10609
11236
|
|
|
10610
11237
|
# Represents the use of the `^` operator for pinning an expression in a pattern matching expression.
|
|
10611
11238
|
#
|
|
10612
|
-
#
|
|
10613
|
-
#
|
|
11239
|
+
# ```rb
|
|
11240
|
+
# foo in ^(bar)
|
|
11241
|
+
# ^^^^^^
|
|
11242
|
+
# ```
|
|
10614
11243
|
class PinnedExpressionNode < Node
|
|
10615
11244
|
# Initialize a new PinnedExpressionNode node.
|
|
10616
11245
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, expression: Node, operator_loc: Location, lparen_loc: Location, rparen_loc: Location).void }
|
|
@@ -10656,15 +11285,19 @@ module Prism
|
|
|
10656
11285
|
|
|
10657
11286
|
# The expression used in the pinned expression
|
|
10658
11287
|
#
|
|
10659
|
-
#
|
|
10660
|
-
#
|
|
11288
|
+
# ```rb
|
|
11289
|
+
# foo in ^(bar)
|
|
11290
|
+
# ^^^
|
|
11291
|
+
# ```
|
|
10661
11292
|
sig { returns(Node) }
|
|
10662
11293
|
def expression; end
|
|
10663
11294
|
|
|
10664
11295
|
# The Location of the `^` operator
|
|
10665
11296
|
#
|
|
10666
|
-
#
|
|
10667
|
-
#
|
|
11297
|
+
# ```rb
|
|
11298
|
+
# foo in ^(bar)
|
|
11299
|
+
# ^
|
|
11300
|
+
# ```
|
|
10668
11301
|
sig { returns(Location) }
|
|
10669
11302
|
def operator_loc; end
|
|
10670
11303
|
|
|
@@ -10675,8 +11308,10 @@ module Prism
|
|
|
10675
11308
|
|
|
10676
11309
|
# The Location of the opening parenthesis.
|
|
10677
11310
|
#
|
|
10678
|
-
#
|
|
10679
|
-
#
|
|
11311
|
+
# ```rb
|
|
11312
|
+
# foo in ^(bar)
|
|
11313
|
+
# ^
|
|
11314
|
+
# ```
|
|
10680
11315
|
sig { returns(Location) }
|
|
10681
11316
|
def lparen_loc; end
|
|
10682
11317
|
|
|
@@ -10687,8 +11322,10 @@ module Prism
|
|
|
10687
11322
|
|
|
10688
11323
|
# The Location of the closing parenthesis.
|
|
10689
11324
|
#
|
|
10690
|
-
#
|
|
10691
|
-
#
|
|
11325
|
+
# ```rb
|
|
11326
|
+
# foo in ^(bar)
|
|
11327
|
+
# ^
|
|
11328
|
+
# ```
|
|
10692
11329
|
sig { returns(Location) }
|
|
10693
11330
|
def rparen_loc; end
|
|
10694
11331
|
|
|
@@ -10715,8 +11352,10 @@ module Prism
|
|
|
10715
11352
|
|
|
10716
11353
|
# Represents the use of the `^` operator for pinning a variable in a pattern matching expression.
|
|
10717
11354
|
#
|
|
10718
|
-
#
|
|
10719
|
-
#
|
|
11355
|
+
# ```rb
|
|
11356
|
+
# foo in ^bar
|
|
11357
|
+
# ^^^^
|
|
11358
|
+
# ```
|
|
10720
11359
|
class PinnedVariableNode < Node
|
|
10721
11360
|
# Initialize a new PinnedVariableNode node.
|
|
10722
11361
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, variable: ::T.any(LocalVariableReadNode, InstanceVariableReadNode, ClassVariableReadNode, GlobalVariableReadNode, BackReferenceReadNode, NumberedReferenceReadNode, ItLocalVariableReadNode), operator_loc: Location).void }
|
|
@@ -10762,15 +11401,19 @@ module Prism
|
|
|
10762
11401
|
|
|
10763
11402
|
# The variable used in the pinned expression
|
|
10764
11403
|
#
|
|
10765
|
-
#
|
|
10766
|
-
#
|
|
11404
|
+
# ```rb
|
|
11405
|
+
# foo in ^bar
|
|
11406
|
+
# ^^^
|
|
11407
|
+
# ```
|
|
10767
11408
|
sig { returns(::T.any(LocalVariableReadNode, InstanceVariableReadNode, ClassVariableReadNode, GlobalVariableReadNode, BackReferenceReadNode, NumberedReferenceReadNode, ItLocalVariableReadNode)) }
|
|
10768
11409
|
def variable; end
|
|
10769
11410
|
|
|
10770
11411
|
# The Location of the `^` operator
|
|
10771
11412
|
#
|
|
10772
|
-
#
|
|
10773
|
-
#
|
|
11413
|
+
# ```rb
|
|
11414
|
+
# foo in ^bar
|
|
11415
|
+
# ^
|
|
11416
|
+
# ```
|
|
10774
11417
|
sig { returns(Location) }
|
|
10775
11418
|
def operator_loc; end
|
|
10776
11419
|
|
|
@@ -10789,8 +11432,10 @@ module Prism
|
|
|
10789
11432
|
|
|
10790
11433
|
# Represents the use of the `END` keyword.
|
|
10791
11434
|
#
|
|
10792
|
-
#
|
|
10793
|
-
#
|
|
11435
|
+
# ```rb
|
|
11436
|
+
# END { foo }
|
|
11437
|
+
# ^^^^^^^^^^^
|
|
11438
|
+
# ```
|
|
10794
11439
|
class PostExecutionNode < Node
|
|
10795
11440
|
# Initialize a new PostExecutionNode node.
|
|
10796
11441
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, statements: ::T.nilable(StatementsNode), keyword_loc: Location, opening_loc: Location, closing_loc: Location).void }
|
|
@@ -10883,8 +11528,10 @@ module Prism
|
|
|
10883
11528
|
|
|
10884
11529
|
# Represents the use of the `BEGIN` keyword.
|
|
10885
11530
|
#
|
|
10886
|
-
#
|
|
10887
|
-
#
|
|
11531
|
+
# ```rb
|
|
11532
|
+
# BEGIN { foo }
|
|
11533
|
+
# ^^^^^^^^^^^^^
|
|
11534
|
+
# ```
|
|
10888
11535
|
class PreExecutionNode < Node
|
|
10889
11536
|
# Initialize a new PreExecutionNode node.
|
|
10890
11537
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, statements: ::T.nilable(StatementsNode), keyword_loc: Location, opening_loc: Location, closing_loc: Location).void }
|
|
@@ -11033,11 +11680,13 @@ module Prism
|
|
|
11033
11680
|
|
|
11034
11681
|
# Represents the use of the `..` or `...` operators.
|
|
11035
11682
|
#
|
|
11036
|
-
#
|
|
11037
|
-
#
|
|
11683
|
+
# ```rb
|
|
11684
|
+
# 1..2
|
|
11685
|
+
# ^^^^
|
|
11038
11686
|
#
|
|
11039
|
-
#
|
|
11040
|
-
#
|
|
11687
|
+
# c if a =~ /left/ ... b =~ /right/
|
|
11688
|
+
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
11689
|
+
# ```
|
|
11041
11690
|
class RangeNode < Node
|
|
11042
11691
|
# Initialize a new RangeNode node.
|
|
11043
11692
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, left: ::T.nilable(Node), right: ::T.nilable(Node), operator_loc: Location).void }
|
|
@@ -11087,21 +11736,25 @@ module Prism
|
|
|
11087
11736
|
|
|
11088
11737
|
# The left-hand side of the range, if present. It can be either `nil` or any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
11089
11738
|
#
|
|
11090
|
-
#
|
|
11091
|
-
#
|
|
11739
|
+
# ```rb
|
|
11740
|
+
# 1...
|
|
11741
|
+
# ^
|
|
11092
11742
|
#
|
|
11093
|
-
#
|
|
11094
|
-
#
|
|
11743
|
+
# hello...goodbye
|
|
11744
|
+
# ^^^^^
|
|
11745
|
+
# ```
|
|
11095
11746
|
sig { returns(::T.nilable(Node)) }
|
|
11096
11747
|
def left; end
|
|
11097
11748
|
|
|
11098
11749
|
# The right-hand side of the range, if present. It can be either `nil` or any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
11099
11750
|
#
|
|
11100
|
-
#
|
|
11101
|
-
#
|
|
11751
|
+
# ```rb
|
|
11752
|
+
# ..5
|
|
11753
|
+
# ^
|
|
11102
11754
|
#
|
|
11103
|
-
#
|
|
11104
|
-
#
|
|
11755
|
+
# 1...foo
|
|
11756
|
+
# ^^^
|
|
11757
|
+
# ```
|
|
11105
11758
|
# If neither right-hand or left-hand side was included, this will be an ErrorRecoveryNode.
|
|
11106
11759
|
sig { returns(::T.nilable(Node)) }
|
|
11107
11760
|
def right; end
|
|
@@ -11125,8 +11778,10 @@ module Prism
|
|
|
11125
11778
|
|
|
11126
11779
|
# Represents a rational number literal.
|
|
11127
11780
|
#
|
|
11128
|
-
#
|
|
11129
|
-
#
|
|
11781
|
+
# ```rb
|
|
11782
|
+
# 1.0r
|
|
11783
|
+
# ^^^^
|
|
11784
|
+
# ```
|
|
11130
11785
|
class RationalNode < Node
|
|
11131
11786
|
# Initialize a new RationalNode node.
|
|
11132
11787
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, numerator: Integer, denominator: Integer).void }
|
|
@@ -11188,13 +11843,17 @@ module Prism
|
|
|
11188
11843
|
|
|
11189
11844
|
# The numerator of the rational number.
|
|
11190
11845
|
#
|
|
11191
|
-
#
|
|
11846
|
+
# ```rb
|
|
11847
|
+
# 1.5r # numerator 3
|
|
11848
|
+
# ```
|
|
11192
11849
|
sig { returns(Integer) }
|
|
11193
11850
|
def numerator; end
|
|
11194
11851
|
|
|
11195
11852
|
# The denominator of the rational number.
|
|
11196
11853
|
#
|
|
11197
|
-
#
|
|
11854
|
+
# ```rb
|
|
11855
|
+
# 1.5r # denominator 2
|
|
11856
|
+
# ```
|
|
11198
11857
|
sig { returns(Integer) }
|
|
11199
11858
|
def denominator; end
|
|
11200
11859
|
|
|
@@ -11204,8 +11863,10 @@ module Prism
|
|
|
11204
11863
|
|
|
11205
11864
|
# Represents the use of the `redo` keyword.
|
|
11206
11865
|
#
|
|
11207
|
-
#
|
|
11208
|
-
#
|
|
11866
|
+
# ```rb
|
|
11867
|
+
# redo
|
|
11868
|
+
# ^^^^
|
|
11869
|
+
# ```
|
|
11209
11870
|
class RedoNode < Node
|
|
11210
11871
|
# Initialize a new RedoNode node.
|
|
11211
11872
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer).void }
|
|
@@ -11255,8 +11916,10 @@ module Prism
|
|
|
11255
11916
|
|
|
11256
11917
|
# Represents a regular expression literal with no interpolation.
|
|
11257
11918
|
#
|
|
11258
|
-
#
|
|
11259
|
-
#
|
|
11919
|
+
# ```rb
|
|
11920
|
+
# /foo/i
|
|
11921
|
+
# ^^^^^^
|
|
11922
|
+
# ```
|
|
11260
11923
|
class RegularExpressionNode < Node
|
|
11261
11924
|
# Initialize a new RegularExpressionNode node.
|
|
11262
11925
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, opening_loc: Location, content_loc: Location, closing_loc: Location, unescaped: String).void }
|
|
@@ -11393,9 +12056,11 @@ module Prism
|
|
|
11393
12056
|
|
|
11394
12057
|
# Represents a required keyword parameter to a method, block, or lambda definition.
|
|
11395
12058
|
#
|
|
11396
|
-
#
|
|
11397
|
-
#
|
|
11398
|
-
#
|
|
12059
|
+
# ```rb
|
|
12060
|
+
# def a(b: )
|
|
12061
|
+
# ^^
|
|
12062
|
+
# end
|
|
12063
|
+
# ```
|
|
11399
12064
|
class RequiredKeywordParameterNode < Node
|
|
11400
12065
|
# Initialize a new RequiredKeywordParameterNode node.
|
|
11401
12066
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location).void }
|
|
@@ -11462,9 +12127,11 @@ module Prism
|
|
|
11462
12127
|
|
|
11463
12128
|
# Represents a required parameter to a method, block, or lambda definition.
|
|
11464
12129
|
#
|
|
11465
|
-
#
|
|
11466
|
-
#
|
|
11467
|
-
#
|
|
12130
|
+
# ```rb
|
|
12131
|
+
# def a(b)
|
|
12132
|
+
# ^
|
|
12133
|
+
# end
|
|
12134
|
+
# ```
|
|
11468
12135
|
class RequiredParameterNode < Node
|
|
11469
12136
|
# Initialize a new RequiredParameterNode node.
|
|
11470
12137
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol).void }
|
|
@@ -11522,8 +12189,10 @@ module Prism
|
|
|
11522
12189
|
|
|
11523
12190
|
# Represents an expression modified with a rescue.
|
|
11524
12191
|
#
|
|
11525
|
-
#
|
|
11526
|
-
#
|
|
12192
|
+
# ```rb
|
|
12193
|
+
# foo rescue nil
|
|
12194
|
+
# ^^^^^^^^^^^^^^
|
|
12195
|
+
# ```
|
|
11527
12196
|
class RescueModifierNode < Node
|
|
11528
12197
|
# Initialize a new RescueModifierNode node.
|
|
11529
12198
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, expression: Node, keyword_loc: Location, rescue_expression: Node).void }
|
|
@@ -11594,12 +12263,14 @@ module Prism
|
|
|
11594
12263
|
|
|
11595
12264
|
# Represents a rescue statement.
|
|
11596
12265
|
#
|
|
11597
|
-
#
|
|
11598
|
-
#
|
|
11599
|
-
#
|
|
11600
|
-
#
|
|
11601
|
-
#
|
|
12266
|
+
# ```rb
|
|
12267
|
+
# begin
|
|
12268
|
+
# rescue Foo, *splat, Bar => ex
|
|
12269
|
+
# foo
|
|
12270
|
+
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
12271
|
+
# end
|
|
11602
12272
|
#
|
|
12273
|
+
# ```
|
|
11603
12274
|
# `Foo, *splat, Bar` are in the `exceptions` field. `ex` is in the `reference` field.
|
|
11604
12275
|
class RescueNode < Node
|
|
11605
12276
|
# Initialize a new RescueNode node.
|
|
@@ -11705,9 +12376,11 @@ module Prism
|
|
|
11705
12376
|
|
|
11706
12377
|
# Represents a rest parameter to a method, block, or lambda definition.
|
|
11707
12378
|
#
|
|
11708
|
-
#
|
|
11709
|
-
#
|
|
11710
|
-
#
|
|
12379
|
+
# ```rb
|
|
12380
|
+
# def a(*b)
|
|
12381
|
+
# ^^
|
|
12382
|
+
# end
|
|
12383
|
+
# ```
|
|
11711
12384
|
class RestParameterNode < Node
|
|
11712
12385
|
# Initialize a new RestParameterNode node.
|
|
11713
12386
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: ::T.nilable(Symbol), name_loc: ::T.nilable(Location), operator_loc: Location).void }
|
|
@@ -11787,8 +12460,10 @@ module Prism
|
|
|
11787
12460
|
|
|
11788
12461
|
# Represents the use of the `retry` keyword.
|
|
11789
12462
|
#
|
|
11790
|
-
#
|
|
11791
|
-
#
|
|
12463
|
+
# ```rb
|
|
12464
|
+
# retry
|
|
12465
|
+
# ^^^^^
|
|
12466
|
+
# ```
|
|
11792
12467
|
class RetryNode < Node
|
|
11793
12468
|
# Initialize a new RetryNode node.
|
|
11794
12469
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer).void }
|
|
@@ -11838,8 +12513,10 @@ module Prism
|
|
|
11838
12513
|
|
|
11839
12514
|
# Represents the use of the `return` keyword.
|
|
11840
12515
|
#
|
|
11841
|
-
#
|
|
11842
|
-
#
|
|
12516
|
+
# ```rb
|
|
12517
|
+
# return 1
|
|
12518
|
+
# ^^^^^^^^
|
|
12519
|
+
# ```
|
|
11843
12520
|
class ReturnNode < Node
|
|
11844
12521
|
# Initialize a new ReturnNode node.
|
|
11845
12522
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, keyword_loc: Location, arguments: ::T.nilable(ArgumentsNode)).void }
|
|
@@ -11906,8 +12583,10 @@ module Prism
|
|
|
11906
12583
|
|
|
11907
12584
|
# Represents the `self` keyword.
|
|
11908
12585
|
#
|
|
11909
|
-
#
|
|
11910
|
-
#
|
|
12586
|
+
# ```rb
|
|
12587
|
+
# self
|
|
12588
|
+
# ^^^^
|
|
12589
|
+
# ```
|
|
11911
12590
|
class SelfNode < Node
|
|
11912
12591
|
# Initialize a new SelfNode node.
|
|
11913
12592
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer).void }
|
|
@@ -11957,9 +12636,11 @@ module Prism
|
|
|
11957
12636
|
|
|
11958
12637
|
# This node wraps a constant write to indicate that when the value is written, it should have its shareability state modified.
|
|
11959
12638
|
#
|
|
11960
|
-
#
|
|
11961
|
-
#
|
|
11962
|
-
#
|
|
12639
|
+
# ```rb
|
|
12640
|
+
# # shareable_constant_value: literal
|
|
12641
|
+
# C = { a: 1 }
|
|
12642
|
+
# ^^^^^^^^^^^^
|
|
12643
|
+
# ```
|
|
11963
12644
|
class ShareableConstantNode < Node
|
|
11964
12645
|
# Initialize a new ShareableConstantNode node.
|
|
11965
12646
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, write: ::T.any(ConstantWriteNode, ConstantAndWriteNode, ConstantOrWriteNode, ConstantOperatorWriteNode, ConstantPathWriteNode, ConstantPathAndWriteNode, ConstantPathOrWriteNode, ConstantPathOperatorWriteNode)).void }
|
|
@@ -12025,8 +12706,10 @@ module Prism
|
|
|
12025
12706
|
|
|
12026
12707
|
# Represents a singleton class declaration involving the `class` keyword.
|
|
12027
12708
|
#
|
|
12028
|
-
#
|
|
12029
|
-
#
|
|
12709
|
+
# ```rb
|
|
12710
|
+
# class << self end
|
|
12711
|
+
# ^^^^^^^^^^^^^^^^^
|
|
12712
|
+
# ```
|
|
12030
12713
|
class SingletonClassNode < Node
|
|
12031
12714
|
# Initialize a new SingletonClassNode node.
|
|
12032
12715
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, locals: T::Array[Symbol], class_keyword_loc: Location, operator_loc: Location, expression: Node, body: ::T.nilable(::T.any(StatementsNode, BeginNode)), end_keyword_loc: Location).void }
|
|
@@ -12127,8 +12810,10 @@ module Prism
|
|
|
12127
12810
|
|
|
12128
12811
|
# Represents the use of the `__ENCODING__` keyword.
|
|
12129
12812
|
#
|
|
12130
|
-
#
|
|
12131
|
-
#
|
|
12813
|
+
# ```rb
|
|
12814
|
+
# __ENCODING__
|
|
12815
|
+
# ^^^^^^^^^^^^
|
|
12816
|
+
# ```
|
|
12132
12817
|
class SourceEncodingNode < Node
|
|
12133
12818
|
# Initialize a new SourceEncodingNode node.
|
|
12134
12819
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer).void }
|
|
@@ -12178,8 +12863,10 @@ module Prism
|
|
|
12178
12863
|
|
|
12179
12864
|
# Represents the use of the `__FILE__` keyword.
|
|
12180
12865
|
#
|
|
12181
|
-
#
|
|
12182
|
-
#
|
|
12866
|
+
# ```rb
|
|
12867
|
+
# __FILE__
|
|
12868
|
+
# ^^^^^^^^
|
|
12869
|
+
# ```
|
|
12183
12870
|
class SourceFileNode < Node
|
|
12184
12871
|
# Initialize a new SourceFileNode node.
|
|
12185
12872
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, filepath: String).void }
|
|
@@ -12249,8 +12936,10 @@ module Prism
|
|
|
12249
12936
|
|
|
12250
12937
|
# Represents the use of the `__LINE__` keyword.
|
|
12251
12938
|
#
|
|
12252
|
-
#
|
|
12253
|
-
#
|
|
12939
|
+
# ```rb
|
|
12940
|
+
# __LINE__
|
|
12941
|
+
# ^^^^^^^^
|
|
12942
|
+
# ```
|
|
12254
12943
|
class SourceLineNode < Node
|
|
12255
12944
|
# Initialize a new SourceLineNode node.
|
|
12256
12945
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer).void }
|
|
@@ -12300,8 +12989,10 @@ module Prism
|
|
|
12300
12989
|
|
|
12301
12990
|
# Represents the use of the splat operator.
|
|
12302
12991
|
#
|
|
12303
|
-
#
|
|
12304
|
-
#
|
|
12992
|
+
# ```rb
|
|
12993
|
+
# [*a]
|
|
12994
|
+
# ^^
|
|
12995
|
+
# ```
|
|
12305
12996
|
class SplatNode < Node
|
|
12306
12997
|
# Initialize a new SplatNode node.
|
|
12307
12998
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, operator_loc: Location, expression: ::T.nilable(Node)).void }
|
|
@@ -12368,8 +13059,10 @@ module Prism
|
|
|
12368
13059
|
|
|
12369
13060
|
# Represents a set of statements contained within some scope.
|
|
12370
13061
|
#
|
|
12371
|
-
#
|
|
12372
|
-
#
|
|
13062
|
+
# ```rb
|
|
13063
|
+
# foo; bar; baz
|
|
13064
|
+
# ^^^^^^^^^^^^^
|
|
13065
|
+
# ```
|
|
12373
13066
|
class StatementsNode < Node
|
|
12374
13067
|
# Initialize a new StatementsNode node.
|
|
12375
13068
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, body: T::Array[Node]).void }
|
|
@@ -12423,14 +13116,16 @@ module Prism
|
|
|
12423
13116
|
|
|
12424
13117
|
# Represents a string literal, a string contained within a `%w` list, or plain string content within an interpolated string.
|
|
12425
13118
|
#
|
|
12426
|
-
#
|
|
12427
|
-
#
|
|
13119
|
+
# ```rb
|
|
13120
|
+
# "foo"
|
|
13121
|
+
# ^^^^^
|
|
12428
13122
|
#
|
|
12429
|
-
#
|
|
12430
|
-
#
|
|
13123
|
+
# %w[foo]
|
|
13124
|
+
# ^^^
|
|
12431
13125
|
#
|
|
12432
|
-
#
|
|
12433
|
-
#
|
|
13126
|
+
# "foo #{bar} baz"
|
|
13127
|
+
# ^^^^ ^^^^
|
|
13128
|
+
# ```
|
|
12434
13129
|
class StringNode < Node
|
|
12435
13130
|
# Initialize a new StringNode node.
|
|
12436
13131
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, opening_loc: ::T.nilable(Location), content_loc: Location, closing_loc: ::T.nilable(Location), unescaped: String).void }
|
|
@@ -12539,12 +13234,14 @@ module Prism
|
|
|
12539
13234
|
|
|
12540
13235
|
# Represents the use of the `super` keyword with parentheses or arguments.
|
|
12541
13236
|
#
|
|
12542
|
-
#
|
|
12543
|
-
#
|
|
13237
|
+
# ```rb
|
|
13238
|
+
# super()
|
|
13239
|
+
# ^^^^^^^
|
|
12544
13240
|
#
|
|
12545
|
-
#
|
|
12546
|
-
#
|
|
13241
|
+
# super foo, bar
|
|
13242
|
+
# ^^^^^^^^^^^^^^
|
|
12547
13243
|
#
|
|
13244
|
+
# ```
|
|
12548
13245
|
# If no arguments are provided (except for a block), it would be a `ForwardingSuperNode` instead.
|
|
12549
13246
|
class SuperNode < Node
|
|
12550
13247
|
# Initialize a new SuperNode node.
|
|
@@ -12642,11 +13339,12 @@ module Prism
|
|
|
12642
13339
|
|
|
12643
13340
|
# Represents a symbol literal or a symbol contained within a `%i` list.
|
|
12644
13341
|
#
|
|
12645
|
-
#
|
|
12646
|
-
#
|
|
13342
|
+
# ```rb
|
|
13343
|
+
# ^^^^
|
|
12647
13344
|
#
|
|
12648
|
-
#
|
|
12649
|
-
#
|
|
13345
|
+
# %i[foo]
|
|
13346
|
+
# ^^^
|
|
13347
|
+
# ```
|
|
12650
13348
|
class SymbolNode < Node
|
|
12651
13349
|
# Initialize a new SymbolNode node.
|
|
12652
13350
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, opening_loc: ::T.nilable(Location), content_loc: Location, closing_loc: ::T.nilable(Location), unescaped: String).void }
|
|
@@ -12751,8 +13449,10 @@ module Prism
|
|
|
12751
13449
|
|
|
12752
13450
|
# Represents the use of the literal `true` keyword.
|
|
12753
13451
|
#
|
|
12754
|
-
#
|
|
12755
|
-
#
|
|
13452
|
+
# ```rb
|
|
13453
|
+
# true
|
|
13454
|
+
# ^^^^
|
|
13455
|
+
# ```
|
|
12756
13456
|
class TrueNode < Node
|
|
12757
13457
|
# Initialize a new TrueNode node.
|
|
12758
13458
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer).void }
|
|
@@ -12802,8 +13502,10 @@ module Prism
|
|
|
12802
13502
|
|
|
12803
13503
|
# Represents the use of the `undef` keyword.
|
|
12804
13504
|
#
|
|
12805
|
-
#
|
|
12806
|
-
#
|
|
13505
|
+
# ```rb
|
|
13506
|
+
# undef :foo, :bar, :baz
|
|
13507
|
+
# ^^^^^^^^^^^^^^^^^^^^^^
|
|
13508
|
+
# ```
|
|
12807
13509
|
class UndefNode < Node
|
|
12808
13510
|
# Initialize a new UndefNode node.
|
|
12809
13511
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, names: T::Array[::T.any(SymbolNode, InterpolatedSymbolNode)], keyword_loc: Location).void }
|
|
@@ -12870,11 +13572,13 @@ module Prism
|
|
|
12870
13572
|
|
|
12871
13573
|
# Represents the use of the `unless` keyword, either in the block form or the modifier form.
|
|
12872
13574
|
#
|
|
12873
|
-
#
|
|
12874
|
-
#
|
|
13575
|
+
# ```rb
|
|
13576
|
+
# bar unless foo
|
|
13577
|
+
# ^^^^^^^^^^^^^^
|
|
12875
13578
|
#
|
|
12876
|
-
#
|
|
12877
|
-
#
|
|
13579
|
+
# unless foo then bar end
|
|
13580
|
+
# ^^^^^^^^^^^^^^^^^^^^^^^
|
|
13581
|
+
# ```
|
|
12878
13582
|
class UnlessNode < Node
|
|
12879
13583
|
# Initialize a new UnlessNode node.
|
|
12880
13584
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, unless_keyword_loc: Location, predicate: Node, then_keyword_loc: ::T.nilable(Location), statements: ::T.nilable(StatementsNode), else_clause: ::T.nilable(ElseNode), end_keyword_loc: ::T.nilable(Location)).void }
|
|
@@ -12920,11 +13624,13 @@ module Prism
|
|
|
12920
13624
|
|
|
12921
13625
|
# The Location of the `unless` keyword.
|
|
12922
13626
|
#
|
|
12923
|
-
#
|
|
12924
|
-
#
|
|
13627
|
+
# ```rb
|
|
13628
|
+
# unless cond then bar end
|
|
13629
|
+
# ^^^^^^
|
|
12925
13630
|
#
|
|
12926
|
-
#
|
|
12927
|
-
#
|
|
13631
|
+
# bar unless cond
|
|
13632
|
+
# ^^^^^^
|
|
13633
|
+
# ```
|
|
12928
13634
|
sig { returns(Location) }
|
|
12929
13635
|
def unless_keyword_loc; end
|
|
12930
13636
|
|
|
@@ -12935,18 +13641,22 @@ module Prism
|
|
|
12935
13641
|
|
|
12936
13642
|
# The condition to be evaluated for the unless expression. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
12937
13643
|
#
|
|
12938
|
-
#
|
|
12939
|
-
#
|
|
13644
|
+
# ```rb
|
|
13645
|
+
# unless cond then bar end
|
|
13646
|
+
# ^^^^
|
|
12940
13647
|
#
|
|
12941
|
-
#
|
|
12942
|
-
#
|
|
13648
|
+
# bar unless cond
|
|
13649
|
+
# ^^^^
|
|
13650
|
+
# ```
|
|
12943
13651
|
sig { returns(Node) }
|
|
12944
13652
|
def predicate; end
|
|
12945
13653
|
|
|
12946
13654
|
# The Location of the `then` keyword, if present.
|
|
12947
13655
|
#
|
|
12948
|
-
#
|
|
12949
|
-
#
|
|
13656
|
+
# ```rb
|
|
13657
|
+
# unless cond then bar end
|
|
13658
|
+
# ^^^^
|
|
13659
|
+
# ```
|
|
12950
13660
|
sig { returns(::T.nilable(Location)) }
|
|
12951
13661
|
def then_keyword_loc; end
|
|
12952
13662
|
|
|
@@ -12958,22 +13668,28 @@ module Prism
|
|
|
12958
13668
|
# The body of statements that will executed if the unless condition is
|
|
12959
13669
|
# falsey. Will be `nil` if no body is provided.
|
|
12960
13670
|
#
|
|
12961
|
-
#
|
|
12962
|
-
#
|
|
13671
|
+
# ```rb
|
|
13672
|
+
# unless cond then bar end
|
|
13673
|
+
# ^^^
|
|
13674
|
+
# ```
|
|
12963
13675
|
sig { returns(::T.nilable(StatementsNode)) }
|
|
12964
13676
|
def statements; end
|
|
12965
13677
|
|
|
12966
13678
|
# The else clause of the unless expression, if present.
|
|
12967
13679
|
#
|
|
12968
|
-
#
|
|
12969
|
-
#
|
|
13680
|
+
# ```rb
|
|
13681
|
+
# unless cond then bar else baz end
|
|
13682
|
+
# ^^^^^^^^^^^^
|
|
13683
|
+
# ```
|
|
12970
13684
|
sig { returns(::T.nilable(ElseNode)) }
|
|
12971
13685
|
def else_clause; end
|
|
12972
13686
|
|
|
12973
13687
|
# The Location of the `end` keyword, if present.
|
|
12974
13688
|
#
|
|
12975
|
-
#
|
|
12976
|
-
#
|
|
13689
|
+
# ```rb
|
|
13690
|
+
# unless cond then bar end
|
|
13691
|
+
# ^^^
|
|
13692
|
+
# ```
|
|
12977
13693
|
sig { returns(::T.nilable(Location)) }
|
|
12978
13694
|
def end_keyword_loc; end
|
|
12979
13695
|
|
|
@@ -13000,11 +13716,13 @@ module Prism
|
|
|
13000
13716
|
|
|
13001
13717
|
# Represents the use of the `until` keyword, either in the block form or the modifier form.
|
|
13002
13718
|
#
|
|
13003
|
-
#
|
|
13004
|
-
#
|
|
13719
|
+
# ```rb
|
|
13720
|
+
# bar until foo
|
|
13721
|
+
# ^^^^^^^^^^^^^
|
|
13005
13722
|
#
|
|
13006
|
-
#
|
|
13007
|
-
#
|
|
13723
|
+
# until foo do bar end
|
|
13724
|
+
# ^^^^^^^^^^^^^^^^^^^^
|
|
13725
|
+
# ```
|
|
13008
13726
|
class UntilNode < Node
|
|
13009
13727
|
# Initialize a new UntilNode node.
|
|
13010
13728
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, until_keyword_loc: Location, do_keyword_loc: ::T.nilable(Location), end_keyword_loc: ::T.nilable(Location), predicate: Node, statements: ::T.nilable(StatementsNode)).void }
|
|
@@ -13105,10 +13823,12 @@ module Prism
|
|
|
13105
13823
|
|
|
13106
13824
|
# Represents the use of the `when` keyword within a case statement.
|
|
13107
13825
|
#
|
|
13108
|
-
#
|
|
13109
|
-
#
|
|
13110
|
-
#
|
|
13111
|
-
#
|
|
13826
|
+
# ```rb
|
|
13827
|
+
# case true
|
|
13828
|
+
# when true
|
|
13829
|
+
# ^^^^^^^^^
|
|
13830
|
+
# end
|
|
13831
|
+
# ```
|
|
13112
13832
|
class WhenNode < Node
|
|
13113
13833
|
# Initialize a new WhenNode node.
|
|
13114
13834
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, when_keyword_loc: Location, conditions: T::Array[Node], then_keyword_loc: ::T.nilable(Location), statements: ::T.nilable(StatementsNode)).void }
|
|
@@ -13192,11 +13912,13 @@ module Prism
|
|
|
13192
13912
|
|
|
13193
13913
|
# Represents the use of the `while` keyword, either in the block form or the modifier form.
|
|
13194
13914
|
#
|
|
13195
|
-
#
|
|
13196
|
-
#
|
|
13915
|
+
# ```rb
|
|
13916
|
+
# bar while foo
|
|
13917
|
+
# ^^^^^^^^^^^^^
|
|
13197
13918
|
#
|
|
13198
|
-
#
|
|
13199
|
-
#
|
|
13919
|
+
# while foo do bar end
|
|
13920
|
+
# ^^^^^^^^^^^^^^^^^^^^
|
|
13921
|
+
# ```
|
|
13200
13922
|
class WhileNode < Node
|
|
13201
13923
|
# Initialize a new WhileNode node.
|
|
13202
13924
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, while_keyword_loc: Location, do_keyword_loc: ::T.nilable(Location), end_keyword_loc: ::T.nilable(Location), predicate: Node, statements: ::T.nilable(StatementsNode)).void }
|
|
@@ -13297,8 +14019,10 @@ module Prism
|
|
|
13297
14019
|
|
|
13298
14020
|
# Represents an xstring literal with no interpolation.
|
|
13299
14021
|
#
|
|
13300
|
-
#
|
|
13301
|
-
#
|
|
14022
|
+
# ```rb
|
|
14023
|
+
# `foo`
|
|
14024
|
+
# ^^^^^
|
|
14025
|
+
# ```
|
|
13302
14026
|
class XStringNode < Node
|
|
13303
14027
|
# Initialize a new XStringNode node.
|
|
13304
14028
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, opening_loc: Location, content_loc: Location, closing_loc: Location, unescaped: String).void }
|
|
@@ -13399,8 +14123,10 @@ module Prism
|
|
|
13399
14123
|
|
|
13400
14124
|
# Represents the use of the `yield` keyword.
|
|
13401
14125
|
#
|
|
13402
|
-
#
|
|
13403
|
-
#
|
|
14126
|
+
# ```rb
|
|
14127
|
+
# yield 1
|
|
14128
|
+
# ^^^^^^^
|
|
14129
|
+
# ```
|
|
13404
14130
|
class YieldNode < Node
|
|
13405
14131
|
# Initialize a new YieldNode node.
|
|
13406
14132
|
sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, keyword_loc: Location, lparen_loc: ::T.nilable(Location), arguments: ::T.nilable(ArgumentsNode), rparen_loc: ::T.nilable(Location)).void }
|