prism 0.13.0 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +37 -1
- data/README.md +4 -1
- data/config.yml +96 -35
- data/docs/fuzzing.md +5 -10
- data/docs/prism.png +0 -0
- data/docs/serialization.md +10 -0
- data/ext/prism/api_node.c +239 -86
- data/ext/prism/extension.c +35 -48
- data/ext/prism/extension.h +1 -1
- data/include/prism/ast.h +170 -118
- data/include/prism/diagnostic.h +1 -0
- data/include/prism/node.h +8 -0
- data/include/prism/parser.h +26 -0
- data/include/prism/util/pm_buffer.h +3 -0
- data/include/prism/util/pm_constant_pool.h +21 -2
- data/include/prism/util/pm_string.h +2 -1
- data/include/prism/version.h +2 -2
- data/include/prism.h +1 -2
- data/lib/prism/compiler.rb +150 -141
- data/lib/prism/debug.rb +30 -26
- data/lib/prism/dispatcher.rb +42 -0
- data/lib/prism/dsl.rb +23 -8
- data/lib/prism/ffi.rb +4 -4
- data/lib/prism/lex_compat.rb +42 -8
- data/lib/prism/mutation_compiler.rb +18 -3
- data/lib/prism/node.rb +2061 -191
- data/lib/prism/node_ext.rb +44 -0
- data/lib/prism/parse_result.rb +32 -5
- data/lib/prism/pattern.rb +1 -1
- data/lib/prism/serialize.rb +95 -87
- data/lib/prism/visitor.rb +9 -0
- data/prism.gemspec +2 -3
- data/src/diagnostic.c +2 -1
- data/src/node.c +99 -32
- data/src/prettyprint.c +137 -80
- data/src/prism.c +1960 -843
- data/src/serialize.c +140 -79
- data/src/util/pm_buffer.c +9 -7
- data/src/util/pm_constant_pool.c +25 -11
- metadata +3 -4
- data/include/prism/unescape.h +0 -48
- data/src/unescape.c +0 -637
data/lib/prism/node.rb
CHANGED
@@ -130,6 +130,16 @@ module Prism
|
|
130
130
|
def type
|
131
131
|
:alias_global_variable_node
|
132
132
|
end
|
133
|
+
|
134
|
+
# Similar to #type, this method returns a symbol that you can use for
|
135
|
+
# splitting on the type of the node without having to do a long === chain.
|
136
|
+
# Note that like #type, it will still be slower than using == for a single
|
137
|
+
# class, but should be faster in a case statement or an array comparison.
|
138
|
+
#
|
139
|
+
# def self.type: () -> Symbol
|
140
|
+
def self.type
|
141
|
+
:alias_global_variable_node
|
142
|
+
end
|
133
143
|
end
|
134
144
|
|
135
145
|
# Represents the use of the `alias` keyword to alias a method.
|
@@ -224,6 +234,16 @@ module Prism
|
|
224
234
|
def type
|
225
235
|
:alias_method_node
|
226
236
|
end
|
237
|
+
|
238
|
+
# Similar to #type, this method returns a symbol that you can use for
|
239
|
+
# splitting on the type of the node without having to do a long === chain.
|
240
|
+
# Note that like #type, it will still be slower than using == for a single
|
241
|
+
# class, but should be faster in a case statement or an array comparison.
|
242
|
+
#
|
243
|
+
# def self.type: () -> Symbol
|
244
|
+
def self.type
|
245
|
+
:alias_method_node
|
246
|
+
end
|
227
247
|
end
|
228
248
|
|
229
249
|
# Represents an alternation pattern in pattern matching.
|
@@ -318,6 +338,16 @@ module Prism
|
|
318
338
|
def type
|
319
339
|
:alternation_pattern_node
|
320
340
|
end
|
341
|
+
|
342
|
+
# Similar to #type, this method returns a symbol that you can use for
|
343
|
+
# splitting on the type of the node without having to do a long === chain.
|
344
|
+
# Note that like #type, it will still be slower than using == for a single
|
345
|
+
# class, but should be faster in a case statement or an array comparison.
|
346
|
+
#
|
347
|
+
# def self.type: () -> Symbol
|
348
|
+
def self.type
|
349
|
+
:alternation_pattern_node
|
350
|
+
end
|
321
351
|
end
|
322
352
|
|
323
353
|
# Represents the use of the `&&` operator or the `and` keyword.
|
@@ -412,6 +442,16 @@ module Prism
|
|
412
442
|
def type
|
413
443
|
:and_node
|
414
444
|
end
|
445
|
+
|
446
|
+
# Similar to #type, this method returns a symbol that you can use for
|
447
|
+
# splitting on the type of the node without having to do a long === chain.
|
448
|
+
# Note that like #type, it will still be slower than using == for a single
|
449
|
+
# class, but should be faster in a case statement or an array comparison.
|
450
|
+
#
|
451
|
+
# def self.type: () -> Symbol
|
452
|
+
def self.type
|
453
|
+
:and_node
|
454
|
+
end
|
415
455
|
end
|
416
456
|
|
417
457
|
# Represents a set of arguments to a method or a keyword.
|
@@ -487,6 +527,16 @@ module Prism
|
|
487
527
|
def type
|
488
528
|
:arguments_node
|
489
529
|
end
|
530
|
+
|
531
|
+
# Similar to #type, this method returns a symbol that you can use for
|
532
|
+
# splitting on the type of the node without having to do a long === chain.
|
533
|
+
# Note that like #type, it will still be slower than using == for a single
|
534
|
+
# class, but should be faster in a case statement or an array comparison.
|
535
|
+
#
|
536
|
+
# def self.type: () -> Symbol
|
537
|
+
def self.type
|
538
|
+
:arguments_node
|
539
|
+
end
|
490
540
|
end
|
491
541
|
|
492
542
|
# Represents an array literal. This can be a regular array using brackets or
|
@@ -585,6 +635,16 @@ module Prism
|
|
585
635
|
def type
|
586
636
|
:array_node
|
587
637
|
end
|
638
|
+
|
639
|
+
# Similar to #type, this method returns a symbol that you can use for
|
640
|
+
# splitting on the type of the node without having to do a long === chain.
|
641
|
+
# Note that like #type, it will still be slower than using == for a single
|
642
|
+
# class, but should be faster in a case statement or an array comparison.
|
643
|
+
#
|
644
|
+
# def self.type: () -> Symbol
|
645
|
+
def self.type
|
646
|
+
:array_node
|
647
|
+
end
|
588
648
|
end
|
589
649
|
|
590
650
|
# Represents an array pattern in pattern matching.
|
@@ -727,6 +787,16 @@ module Prism
|
|
727
787
|
def type
|
728
788
|
:array_pattern_node
|
729
789
|
end
|
790
|
+
|
791
|
+
# Similar to #type, this method returns a symbol that you can use for
|
792
|
+
# splitting on the type of the node without having to do a long === chain.
|
793
|
+
# Note that like #type, it will still be slower than using == for a single
|
794
|
+
# class, but should be faster in a case statement or an array comparison.
|
795
|
+
#
|
796
|
+
# def self.type: () -> Symbol
|
797
|
+
def self.type
|
798
|
+
:array_pattern_node
|
799
|
+
end
|
730
800
|
end
|
731
801
|
|
732
802
|
# Represents a hash key/value pair.
|
@@ -828,6 +898,16 @@ module Prism
|
|
828
898
|
def type
|
829
899
|
:assoc_node
|
830
900
|
end
|
901
|
+
|
902
|
+
# Similar to #type, this method returns a symbol that you can use for
|
903
|
+
# splitting on the type of the node without having to do a long === chain.
|
904
|
+
# Note that like #type, it will still be slower than using == for a single
|
905
|
+
# class, but should be faster in a case statement or an array comparison.
|
906
|
+
#
|
907
|
+
# def self.type: () -> Symbol
|
908
|
+
def self.type
|
909
|
+
:assoc_node
|
910
|
+
end
|
831
911
|
end
|
832
912
|
|
833
913
|
# Represents a splat in a hash literal.
|
@@ -921,6 +1001,16 @@ module Prism
|
|
921
1001
|
def type
|
922
1002
|
:assoc_splat_node
|
923
1003
|
end
|
1004
|
+
|
1005
|
+
# Similar to #type, this method returns a symbol that you can use for
|
1006
|
+
# splitting on the type of the node without having to do a long === chain.
|
1007
|
+
# Note that like #type, it will still be slower than using == for a single
|
1008
|
+
# class, but should be faster in a case statement or an array comparison.
|
1009
|
+
#
|
1010
|
+
# def self.type: () -> Symbol
|
1011
|
+
def self.type
|
1012
|
+
:assoc_splat_node
|
1013
|
+
end
|
924
1014
|
end
|
925
1015
|
|
926
1016
|
# Represents reading a reference to a field in the previous match.
|
@@ -928,8 +1018,12 @@ module Prism
|
|
928
1018
|
# $'
|
929
1019
|
# ^^
|
930
1020
|
class BackReferenceReadNode < Node
|
931
|
-
#
|
932
|
-
|
1021
|
+
# attr_reader name: Symbol
|
1022
|
+
attr_reader :name
|
1023
|
+
|
1024
|
+
# def initialize: (name: Symbol, location: Location) -> void
|
1025
|
+
def initialize(name, location)
|
1026
|
+
@name = name
|
933
1027
|
@location = location
|
934
1028
|
end
|
935
1029
|
|
@@ -956,6 +1050,7 @@ module Prism
|
|
956
1050
|
# def copy: (**params) -> BackReferenceReadNode
|
957
1051
|
def copy(**params)
|
958
1052
|
BackReferenceReadNode.new(
|
1053
|
+
params.fetch(:name) { name },
|
959
1054
|
params.fetch(:location) { location },
|
960
1055
|
)
|
961
1056
|
end
|
@@ -965,11 +1060,12 @@ module Prism
|
|
965
1060
|
|
966
1061
|
# def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
|
967
1062
|
def deconstruct_keys(keys)
|
968
|
-
{ location: location }
|
1063
|
+
{ name: name, location: location }
|
969
1064
|
end
|
970
1065
|
|
971
1066
|
def inspect(inspector = NodeInspector.new)
|
972
1067
|
inspector << inspector.header(self)
|
1068
|
+
inspector << "└── name: #{name.inspect}\n"
|
973
1069
|
inspector.to_str
|
974
1070
|
end
|
975
1071
|
|
@@ -990,6 +1086,16 @@ module Prism
|
|
990
1086
|
def type
|
991
1087
|
:back_reference_read_node
|
992
1088
|
end
|
1089
|
+
|
1090
|
+
# Similar to #type, this method returns a symbol that you can use for
|
1091
|
+
# splitting on the type of the node without having to do a long === chain.
|
1092
|
+
# Note that like #type, it will still be slower than using == for a single
|
1093
|
+
# class, but should be faster in a case statement or an array comparison.
|
1094
|
+
#
|
1095
|
+
# def self.type: () -> Symbol
|
1096
|
+
def self.type
|
1097
|
+
:back_reference_read_node
|
1098
|
+
end
|
993
1099
|
end
|
994
1100
|
|
995
1101
|
# Represents a begin statement.
|
@@ -1136,6 +1242,16 @@ module Prism
|
|
1136
1242
|
def type
|
1137
1243
|
:begin_node
|
1138
1244
|
end
|
1245
|
+
|
1246
|
+
# Similar to #type, this method returns a symbol that you can use for
|
1247
|
+
# splitting on the type of the node without having to do a long === chain.
|
1248
|
+
# Note that like #type, it will still be slower than using == for a single
|
1249
|
+
# class, but should be faster in a case statement or an array comparison.
|
1250
|
+
#
|
1251
|
+
# def self.type: () -> Symbol
|
1252
|
+
def self.type
|
1253
|
+
:begin_node
|
1254
|
+
end
|
1139
1255
|
end
|
1140
1256
|
|
1141
1257
|
# Represents block method arguments.
|
@@ -1229,6 +1345,16 @@ module Prism
|
|
1229
1345
|
def type
|
1230
1346
|
:block_argument_node
|
1231
1347
|
end
|
1348
|
+
|
1349
|
+
# Similar to #type, this method returns a symbol that you can use for
|
1350
|
+
# splitting on the type of the node without having to do a long === chain.
|
1351
|
+
# Note that like #type, it will still be slower than using == for a single
|
1352
|
+
# class, but should be faster in a case statement or an array comparison.
|
1353
|
+
#
|
1354
|
+
# def self.type: () -> Symbol
|
1355
|
+
def self.type
|
1356
|
+
:block_argument_node
|
1357
|
+
end
|
1232
1358
|
end
|
1233
1359
|
|
1234
1360
|
# Represents a block local variable.
|
@@ -1304,6 +1430,16 @@ module Prism
|
|
1304
1430
|
def type
|
1305
1431
|
:block_local_variable_node
|
1306
1432
|
end
|
1433
|
+
|
1434
|
+
# Similar to #type, this method returns a symbol that you can use for
|
1435
|
+
# splitting on the type of the node without having to do a long === chain.
|
1436
|
+
# Note that like #type, it will still be slower than using == for a single
|
1437
|
+
# class, but should be faster in a case statement or an array comparison.
|
1438
|
+
#
|
1439
|
+
# def self.type: () -> Symbol
|
1440
|
+
def self.type
|
1441
|
+
:block_local_variable_node
|
1442
|
+
end
|
1307
1443
|
end
|
1308
1444
|
|
1309
1445
|
# Represents a block of ruby code.
|
@@ -1426,6 +1562,16 @@ module Prism
|
|
1426
1562
|
def type
|
1427
1563
|
:block_node
|
1428
1564
|
end
|
1565
|
+
|
1566
|
+
# Similar to #type, this method returns a symbol that you can use for
|
1567
|
+
# splitting on the type of the node without having to do a long === chain.
|
1568
|
+
# Note that like #type, it will still be slower than using == for a single
|
1569
|
+
# class, but should be faster in a case statement or an array comparison.
|
1570
|
+
#
|
1571
|
+
# def self.type: () -> Symbol
|
1572
|
+
def self.type
|
1573
|
+
:block_node
|
1574
|
+
end
|
1429
1575
|
end
|
1430
1576
|
|
1431
1577
|
# Represents a block parameter to a method, block, or lambda definition.
|
@@ -1519,6 +1665,16 @@ module Prism
|
|
1519
1665
|
def type
|
1520
1666
|
:block_parameter_node
|
1521
1667
|
end
|
1668
|
+
|
1669
|
+
# Similar to #type, this method returns a symbol that you can use for
|
1670
|
+
# splitting on the type of the node without having to do a long === chain.
|
1671
|
+
# Note that like #type, it will still be slower than using == for a single
|
1672
|
+
# class, but should be faster in a case statement or an array comparison.
|
1673
|
+
#
|
1674
|
+
# def self.type: () -> Symbol
|
1675
|
+
def self.type
|
1676
|
+
:block_parameter_node
|
1677
|
+
end
|
1522
1678
|
end
|
1523
1679
|
|
1524
1680
|
# Represents a block's parameters declaration.
|
@@ -1634,6 +1790,16 @@ module Prism
|
|
1634
1790
|
def type
|
1635
1791
|
:block_parameters_node
|
1636
1792
|
end
|
1793
|
+
|
1794
|
+
# Similar to #type, this method returns a symbol that you can use for
|
1795
|
+
# splitting on the type of the node without having to do a long === chain.
|
1796
|
+
# Note that like #type, it will still be slower than using == for a single
|
1797
|
+
# class, but should be faster in a case statement or an array comparison.
|
1798
|
+
#
|
1799
|
+
# def self.type: () -> Symbol
|
1800
|
+
def self.type
|
1801
|
+
:block_parameters_node
|
1802
|
+
end
|
1637
1803
|
end
|
1638
1804
|
|
1639
1805
|
# Represents the use of the `break` keyword.
|
@@ -1727,6 +1893,16 @@ module Prism
|
|
1727
1893
|
def type
|
1728
1894
|
:break_node
|
1729
1895
|
end
|
1896
|
+
|
1897
|
+
# Similar to #type, this method returns a symbol that you can use for
|
1898
|
+
# splitting on the type of the node without having to do a long === chain.
|
1899
|
+
# Note that like #type, it will still be slower than using == for a single
|
1900
|
+
# class, but should be faster in a case statement or an array comparison.
|
1901
|
+
#
|
1902
|
+
# def self.type: () -> Symbol
|
1903
|
+
def self.type
|
1904
|
+
:break_node
|
1905
|
+
end
|
1730
1906
|
end
|
1731
1907
|
|
1732
1908
|
# Represents the use of the `&&=` operator on a call.
|
@@ -1743,22 +1919,13 @@ module Prism
|
|
1743
1919
|
# attr_reader message_loc: Location?
|
1744
1920
|
attr_reader :message_loc
|
1745
1921
|
|
1746
|
-
# attr_reader opening_loc: Location?
|
1747
|
-
attr_reader :opening_loc
|
1748
|
-
|
1749
|
-
# attr_reader arguments: ArgumentsNode?
|
1750
|
-
attr_reader :arguments
|
1751
|
-
|
1752
|
-
# attr_reader closing_loc: Location?
|
1753
|
-
attr_reader :closing_loc
|
1754
|
-
|
1755
1922
|
# attr_reader flags: Integer
|
1756
1923
|
private attr_reader :flags
|
1757
1924
|
|
1758
|
-
# attr_reader read_name:
|
1925
|
+
# attr_reader read_name: Symbol
|
1759
1926
|
attr_reader :read_name
|
1760
1927
|
|
1761
|
-
# attr_reader write_name:
|
1928
|
+
# attr_reader write_name: Symbol
|
1762
1929
|
attr_reader :write_name
|
1763
1930
|
|
1764
1931
|
# attr_reader operator_loc: Location
|
@@ -1767,14 +1934,11 @@ module Prism
|
|
1767
1934
|
# attr_reader value: Node
|
1768
1935
|
attr_reader :value
|
1769
1936
|
|
1770
|
-
# def initialize: (receiver: Node?, call_operator_loc: Location?, message_loc: Location?,
|
1771
|
-
def initialize(receiver, call_operator_loc, message_loc,
|
1937
|
+
# def initialize: (receiver: Node?, call_operator_loc: Location?, message_loc: Location?, flags: Integer, read_name: Symbol, write_name: Symbol, operator_loc: Location, value: Node, location: Location) -> void
|
1938
|
+
def initialize(receiver, call_operator_loc, message_loc, flags, read_name, write_name, operator_loc, value, location)
|
1772
1939
|
@receiver = receiver
|
1773
1940
|
@call_operator_loc = call_operator_loc
|
1774
1941
|
@message_loc = message_loc
|
1775
|
-
@opening_loc = opening_loc
|
1776
|
-
@arguments = arguments
|
1777
|
-
@closing_loc = closing_loc
|
1778
1942
|
@flags = flags
|
1779
1943
|
@read_name = read_name
|
1780
1944
|
@write_name = write_name
|
@@ -1790,21 +1954,20 @@ module Prism
|
|
1790
1954
|
|
1791
1955
|
# def child_nodes: () -> Array[nil | Node]
|
1792
1956
|
def child_nodes
|
1793
|
-
[receiver,
|
1957
|
+
[receiver, value]
|
1794
1958
|
end
|
1795
1959
|
|
1796
1960
|
# def compact_child_nodes: () -> Array[Node]
|
1797
1961
|
def compact_child_nodes
|
1798
1962
|
compact = []
|
1799
1963
|
compact << receiver if receiver
|
1800
|
-
compact << arguments if arguments
|
1801
1964
|
compact << value
|
1802
1965
|
compact
|
1803
1966
|
end
|
1804
1967
|
|
1805
1968
|
# def comment_targets: () -> Array[Node | Location]
|
1806
1969
|
def comment_targets
|
1807
|
-
[*receiver, *call_operator_loc, *message_loc,
|
1970
|
+
[*receiver, *call_operator_loc, *message_loc, operator_loc, value]
|
1808
1971
|
end
|
1809
1972
|
|
1810
1973
|
# def copy: (**params) -> CallAndWriteNode
|
@@ -1813,9 +1976,6 @@ module Prism
|
|
1813
1976
|
params.fetch(:receiver) { receiver },
|
1814
1977
|
params.fetch(:call_operator_loc) { call_operator_loc },
|
1815
1978
|
params.fetch(:message_loc) { message_loc },
|
1816
|
-
params.fetch(:opening_loc) { opening_loc },
|
1817
|
-
params.fetch(:arguments) { arguments },
|
1818
|
-
params.fetch(:closing_loc) { closing_loc },
|
1819
1979
|
params.fetch(:flags) { flags },
|
1820
1980
|
params.fetch(:read_name) { read_name },
|
1821
1981
|
params.fetch(:write_name) { write_name },
|
@@ -1830,7 +1990,7 @@ module Prism
|
|
1830
1990
|
|
1831
1991
|
# def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
|
1832
1992
|
def deconstruct_keys(keys)
|
1833
|
-
{ receiver: receiver, call_operator_loc: call_operator_loc, message_loc: message_loc,
|
1993
|
+
{ receiver: receiver, call_operator_loc: call_operator_loc, message_loc: message_loc, flags: flags, read_name: read_name, write_name: write_name, operator_loc: operator_loc, value: value, location: location }
|
1834
1994
|
end
|
1835
1995
|
|
1836
1996
|
# def call_operator: () -> String?
|
@@ -1843,16 +2003,6 @@ module Prism
|
|
1843
2003
|
message_loc&.slice
|
1844
2004
|
end
|
1845
2005
|
|
1846
|
-
# def opening: () -> String?
|
1847
|
-
def opening
|
1848
|
-
opening_loc&.slice
|
1849
|
-
end
|
1850
|
-
|
1851
|
-
# def closing: () -> String?
|
1852
|
-
def closing
|
1853
|
-
closing_loc&.slice
|
1854
|
-
end
|
1855
|
-
|
1856
2006
|
# def safe_navigation?: () -> bool
|
1857
2007
|
def safe_navigation?
|
1858
2008
|
flags.anybits?(CallNodeFlags::SAFE_NAVIGATION)
|
@@ -1878,14 +2028,6 @@ module Prism
|
|
1878
2028
|
end
|
1879
2029
|
inspector << "├── call_operator_loc: #{inspector.location(call_operator_loc)}\n"
|
1880
2030
|
inspector << "├── message_loc: #{inspector.location(message_loc)}\n"
|
1881
|
-
inspector << "├── opening_loc: #{inspector.location(opening_loc)}\n"
|
1882
|
-
if (arguments = self.arguments).nil?
|
1883
|
-
inspector << "├── arguments: ∅\n"
|
1884
|
-
else
|
1885
|
-
inspector << "├── arguments:\n"
|
1886
|
-
inspector << arguments.inspect(inspector.child_inspector("│ ")).delete_prefix(inspector.prefix)
|
1887
|
-
end
|
1888
|
-
inspector << "├── closing_loc: #{inspector.location(closing_loc)}\n"
|
1889
2031
|
flags = [("safe_navigation" if safe_navigation?), ("variable_call" if variable_call?)].compact
|
1890
2032
|
inspector << "├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n"
|
1891
2033
|
inspector << "├── read_name: #{read_name.inspect}\n"
|
@@ -1913,6 +2055,16 @@ module Prism
|
|
1913
2055
|
def type
|
1914
2056
|
:call_and_write_node
|
1915
2057
|
end
|
2058
|
+
|
2059
|
+
# Similar to #type, this method returns a symbol that you can use for
|
2060
|
+
# splitting on the type of the node without having to do a long === chain.
|
2061
|
+
# Note that like #type, it will still be slower than using == for a single
|
2062
|
+
# class, but should be faster in a case statement or an array comparison.
|
2063
|
+
#
|
2064
|
+
# def self.type: () -> Symbol
|
2065
|
+
def self.type
|
2066
|
+
:call_and_write_node
|
2067
|
+
end
|
1916
2068
|
end
|
1917
2069
|
|
1918
2070
|
# Represents a method call, in all of the various forms that can take.
|
@@ -1959,10 +2111,10 @@ module Prism
|
|
1959
2111
|
# attr_reader flags: Integer
|
1960
2112
|
private attr_reader :flags
|
1961
2113
|
|
1962
|
-
# attr_reader name:
|
2114
|
+
# attr_reader name: Symbol
|
1963
2115
|
attr_reader :name
|
1964
2116
|
|
1965
|
-
# def initialize: (receiver: Node?, call_operator_loc: Location?, message_loc: Location?, opening_loc: Location?, arguments: ArgumentsNode?, closing_loc: Location?, block: Node?, flags: Integer, name:
|
2117
|
+
# def initialize: (receiver: Node?, call_operator_loc: Location?, message_loc: Location?, opening_loc: Location?, arguments: ArgumentsNode?, closing_loc: Location?, block: Node?, flags: Integer, name: Symbol, location: Location) -> void
|
1966
2118
|
def initialize(receiver, call_operator_loc, message_loc, opening_loc, arguments, closing_loc, block, flags, name, location)
|
1967
2119
|
@receiver = receiver
|
1968
2120
|
@call_operator_loc = call_operator_loc
|
@@ -2101,6 +2253,16 @@ module Prism
|
|
2101
2253
|
def type
|
2102
2254
|
:call_node
|
2103
2255
|
end
|
2256
|
+
|
2257
|
+
# Similar to #type, this method returns a symbol that you can use for
|
2258
|
+
# splitting on the type of the node without having to do a long === chain.
|
2259
|
+
# Note that like #type, it will still be slower than using == for a single
|
2260
|
+
# class, but should be faster in a case statement or an array comparison.
|
2261
|
+
#
|
2262
|
+
# def self.type: () -> Symbol
|
2263
|
+
def self.type
|
2264
|
+
:call_node
|
2265
|
+
end
|
2104
2266
|
end
|
2105
2267
|
|
2106
2268
|
# Represents the use of an assignment operator on a call.
|
@@ -2117,22 +2279,13 @@ module Prism
|
|
2117
2279
|
# attr_reader message_loc: Location?
|
2118
2280
|
attr_reader :message_loc
|
2119
2281
|
|
2120
|
-
# attr_reader opening_loc: Location?
|
2121
|
-
attr_reader :opening_loc
|
2122
|
-
|
2123
|
-
# attr_reader arguments: ArgumentsNode?
|
2124
|
-
attr_reader :arguments
|
2125
|
-
|
2126
|
-
# attr_reader closing_loc: Location?
|
2127
|
-
attr_reader :closing_loc
|
2128
|
-
|
2129
2282
|
# attr_reader flags: Integer
|
2130
2283
|
private attr_reader :flags
|
2131
2284
|
|
2132
|
-
# attr_reader read_name:
|
2285
|
+
# attr_reader read_name: Symbol
|
2133
2286
|
attr_reader :read_name
|
2134
2287
|
|
2135
|
-
# attr_reader write_name:
|
2288
|
+
# attr_reader write_name: Symbol
|
2136
2289
|
attr_reader :write_name
|
2137
2290
|
|
2138
2291
|
# attr_reader operator: Symbol
|
@@ -2144,14 +2297,11 @@ module Prism
|
|
2144
2297
|
# attr_reader value: Node
|
2145
2298
|
attr_reader :value
|
2146
2299
|
|
2147
|
-
# def initialize: (receiver: Node?, call_operator_loc: Location?, message_loc: Location?,
|
2148
|
-
def initialize(receiver, call_operator_loc, message_loc,
|
2300
|
+
# def initialize: (receiver: Node?, call_operator_loc: Location?, message_loc: Location?, flags: Integer, read_name: Symbol, write_name: Symbol, operator: Symbol, operator_loc: Location, value: Node, location: Location) -> void
|
2301
|
+
def initialize(receiver, call_operator_loc, message_loc, flags, read_name, write_name, operator, operator_loc, value, location)
|
2149
2302
|
@receiver = receiver
|
2150
2303
|
@call_operator_loc = call_operator_loc
|
2151
2304
|
@message_loc = message_loc
|
2152
|
-
@opening_loc = opening_loc
|
2153
|
-
@arguments = arguments
|
2154
|
-
@closing_loc = closing_loc
|
2155
2305
|
@flags = flags
|
2156
2306
|
@read_name = read_name
|
2157
2307
|
@write_name = write_name
|
@@ -2168,21 +2318,20 @@ module Prism
|
|
2168
2318
|
|
2169
2319
|
# def child_nodes: () -> Array[nil | Node]
|
2170
2320
|
def child_nodes
|
2171
|
-
[receiver,
|
2321
|
+
[receiver, value]
|
2172
2322
|
end
|
2173
2323
|
|
2174
2324
|
# def compact_child_nodes: () -> Array[Node]
|
2175
2325
|
def compact_child_nodes
|
2176
2326
|
compact = []
|
2177
2327
|
compact << receiver if receiver
|
2178
|
-
compact << arguments if arguments
|
2179
2328
|
compact << value
|
2180
2329
|
compact
|
2181
2330
|
end
|
2182
2331
|
|
2183
2332
|
# def comment_targets: () -> Array[Node | Location]
|
2184
2333
|
def comment_targets
|
2185
|
-
[*receiver, *call_operator_loc, *message_loc,
|
2334
|
+
[*receiver, *call_operator_loc, *message_loc, operator_loc, value]
|
2186
2335
|
end
|
2187
2336
|
|
2188
2337
|
# def copy: (**params) -> CallOperatorWriteNode
|
@@ -2191,9 +2340,6 @@ module Prism
|
|
2191
2340
|
params.fetch(:receiver) { receiver },
|
2192
2341
|
params.fetch(:call_operator_loc) { call_operator_loc },
|
2193
2342
|
params.fetch(:message_loc) { message_loc },
|
2194
|
-
params.fetch(:opening_loc) { opening_loc },
|
2195
|
-
params.fetch(:arguments) { arguments },
|
2196
|
-
params.fetch(:closing_loc) { closing_loc },
|
2197
2343
|
params.fetch(:flags) { flags },
|
2198
2344
|
params.fetch(:read_name) { read_name },
|
2199
2345
|
params.fetch(:write_name) { write_name },
|
@@ -2209,7 +2355,7 @@ module Prism
|
|
2209
2355
|
|
2210
2356
|
# def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
|
2211
2357
|
def deconstruct_keys(keys)
|
2212
|
-
{ receiver: receiver, call_operator_loc: call_operator_loc, message_loc: message_loc,
|
2358
|
+
{ receiver: receiver, call_operator_loc: call_operator_loc, message_loc: message_loc, flags: flags, read_name: read_name, write_name: write_name, operator: operator, operator_loc: operator_loc, value: value, location: location }
|
2213
2359
|
end
|
2214
2360
|
|
2215
2361
|
# def call_operator: () -> String?
|
@@ -2222,16 +2368,6 @@ module Prism
|
|
2222
2368
|
message_loc&.slice
|
2223
2369
|
end
|
2224
2370
|
|
2225
|
-
# def opening: () -> String?
|
2226
|
-
def opening
|
2227
|
-
opening_loc&.slice
|
2228
|
-
end
|
2229
|
-
|
2230
|
-
# def closing: () -> String?
|
2231
|
-
def closing
|
2232
|
-
closing_loc&.slice
|
2233
|
-
end
|
2234
|
-
|
2235
2371
|
# def safe_navigation?: () -> bool
|
2236
2372
|
def safe_navigation?
|
2237
2373
|
flags.anybits?(CallNodeFlags::SAFE_NAVIGATION)
|
@@ -2252,14 +2388,6 @@ module Prism
|
|
2252
2388
|
end
|
2253
2389
|
inspector << "├── call_operator_loc: #{inspector.location(call_operator_loc)}\n"
|
2254
2390
|
inspector << "├── message_loc: #{inspector.location(message_loc)}\n"
|
2255
|
-
inspector << "├── opening_loc: #{inspector.location(opening_loc)}\n"
|
2256
|
-
if (arguments = self.arguments).nil?
|
2257
|
-
inspector << "├── arguments: ∅\n"
|
2258
|
-
else
|
2259
|
-
inspector << "├── arguments:\n"
|
2260
|
-
inspector << arguments.inspect(inspector.child_inspector("│ ")).delete_prefix(inspector.prefix)
|
2261
|
-
end
|
2262
|
-
inspector << "├── closing_loc: #{inspector.location(closing_loc)}\n"
|
2263
2391
|
flags = [("safe_navigation" if safe_navigation?), ("variable_call" if variable_call?)].compact
|
2264
2392
|
inspector << "├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n"
|
2265
2393
|
inspector << "├── read_name: #{read_name.inspect}\n"
|
@@ -2288,6 +2416,16 @@ module Prism
|
|
2288
2416
|
def type
|
2289
2417
|
:call_operator_write_node
|
2290
2418
|
end
|
2419
|
+
|
2420
|
+
# Similar to #type, this method returns a symbol that you can use for
|
2421
|
+
# splitting on the type of the node without having to do a long === chain.
|
2422
|
+
# Note that like #type, it will still be slower than using == for a single
|
2423
|
+
# class, but should be faster in a case statement or an array comparison.
|
2424
|
+
#
|
2425
|
+
# def self.type: () -> Symbol
|
2426
|
+
def self.type
|
2427
|
+
:call_operator_write_node
|
2428
|
+
end
|
2291
2429
|
end
|
2292
2430
|
|
2293
2431
|
# Represents the use of the `||=` operator on a call.
|
@@ -2304,22 +2442,13 @@ module Prism
|
|
2304
2442
|
# attr_reader message_loc: Location?
|
2305
2443
|
attr_reader :message_loc
|
2306
2444
|
|
2307
|
-
# attr_reader opening_loc: Location?
|
2308
|
-
attr_reader :opening_loc
|
2309
|
-
|
2310
|
-
# attr_reader arguments: ArgumentsNode?
|
2311
|
-
attr_reader :arguments
|
2312
|
-
|
2313
|
-
# attr_reader closing_loc: Location?
|
2314
|
-
attr_reader :closing_loc
|
2315
|
-
|
2316
2445
|
# attr_reader flags: Integer
|
2317
2446
|
private attr_reader :flags
|
2318
2447
|
|
2319
|
-
# attr_reader read_name:
|
2448
|
+
# attr_reader read_name: Symbol
|
2320
2449
|
attr_reader :read_name
|
2321
2450
|
|
2322
|
-
# attr_reader write_name:
|
2451
|
+
# attr_reader write_name: Symbol
|
2323
2452
|
attr_reader :write_name
|
2324
2453
|
|
2325
2454
|
# attr_reader operator_loc: Location
|
@@ -2328,14 +2457,11 @@ module Prism
|
|
2328
2457
|
# attr_reader value: Node
|
2329
2458
|
attr_reader :value
|
2330
2459
|
|
2331
|
-
# def initialize: (receiver: Node?, call_operator_loc: Location?, message_loc: Location?,
|
2332
|
-
def initialize(receiver, call_operator_loc, message_loc,
|
2460
|
+
# def initialize: (receiver: Node?, call_operator_loc: Location?, message_loc: Location?, flags: Integer, read_name: Symbol, write_name: Symbol, operator_loc: Location, value: Node, location: Location) -> void
|
2461
|
+
def initialize(receiver, call_operator_loc, message_loc, flags, read_name, write_name, operator_loc, value, location)
|
2333
2462
|
@receiver = receiver
|
2334
2463
|
@call_operator_loc = call_operator_loc
|
2335
2464
|
@message_loc = message_loc
|
2336
|
-
@opening_loc = opening_loc
|
2337
|
-
@arguments = arguments
|
2338
|
-
@closing_loc = closing_loc
|
2339
2465
|
@flags = flags
|
2340
2466
|
@read_name = read_name
|
2341
2467
|
@write_name = write_name
|
@@ -2351,21 +2477,20 @@ module Prism
|
|
2351
2477
|
|
2352
2478
|
# def child_nodes: () -> Array[nil | Node]
|
2353
2479
|
def child_nodes
|
2354
|
-
[receiver,
|
2480
|
+
[receiver, value]
|
2355
2481
|
end
|
2356
2482
|
|
2357
2483
|
# def compact_child_nodes: () -> Array[Node]
|
2358
2484
|
def compact_child_nodes
|
2359
2485
|
compact = []
|
2360
2486
|
compact << receiver if receiver
|
2361
|
-
compact << arguments if arguments
|
2362
2487
|
compact << value
|
2363
2488
|
compact
|
2364
2489
|
end
|
2365
2490
|
|
2366
2491
|
# def comment_targets: () -> Array[Node | Location]
|
2367
2492
|
def comment_targets
|
2368
|
-
[*receiver, *call_operator_loc, *message_loc,
|
2493
|
+
[*receiver, *call_operator_loc, *message_loc, operator_loc, value]
|
2369
2494
|
end
|
2370
2495
|
|
2371
2496
|
# def copy: (**params) -> CallOrWriteNode
|
@@ -2374,9 +2499,6 @@ module Prism
|
|
2374
2499
|
params.fetch(:receiver) { receiver },
|
2375
2500
|
params.fetch(:call_operator_loc) { call_operator_loc },
|
2376
2501
|
params.fetch(:message_loc) { message_loc },
|
2377
|
-
params.fetch(:opening_loc) { opening_loc },
|
2378
|
-
params.fetch(:arguments) { arguments },
|
2379
|
-
params.fetch(:closing_loc) { closing_loc },
|
2380
2502
|
params.fetch(:flags) { flags },
|
2381
2503
|
params.fetch(:read_name) { read_name },
|
2382
2504
|
params.fetch(:write_name) { write_name },
|
@@ -2391,7 +2513,7 @@ module Prism
|
|
2391
2513
|
|
2392
2514
|
# def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
|
2393
2515
|
def deconstruct_keys(keys)
|
2394
|
-
{ receiver: receiver, call_operator_loc: call_operator_loc, message_loc: message_loc,
|
2516
|
+
{ receiver: receiver, call_operator_loc: call_operator_loc, message_loc: message_loc, flags: flags, read_name: read_name, write_name: write_name, operator_loc: operator_loc, value: value, location: location }
|
2395
2517
|
end
|
2396
2518
|
|
2397
2519
|
# def call_operator: () -> String?
|
@@ -2404,16 +2526,6 @@ module Prism
|
|
2404
2526
|
message_loc&.slice
|
2405
2527
|
end
|
2406
2528
|
|
2407
|
-
# def opening: () -> String?
|
2408
|
-
def opening
|
2409
|
-
opening_loc&.slice
|
2410
|
-
end
|
2411
|
-
|
2412
|
-
# def closing: () -> String?
|
2413
|
-
def closing
|
2414
|
-
closing_loc&.slice
|
2415
|
-
end
|
2416
|
-
|
2417
2529
|
# def safe_navigation?: () -> bool
|
2418
2530
|
def safe_navigation?
|
2419
2531
|
flags.anybits?(CallNodeFlags::SAFE_NAVIGATION)
|
@@ -2439,14 +2551,6 @@ module Prism
|
|
2439
2551
|
end
|
2440
2552
|
inspector << "├── call_operator_loc: #{inspector.location(call_operator_loc)}\n"
|
2441
2553
|
inspector << "├── message_loc: #{inspector.location(message_loc)}\n"
|
2442
|
-
inspector << "├── opening_loc: #{inspector.location(opening_loc)}\n"
|
2443
|
-
if (arguments = self.arguments).nil?
|
2444
|
-
inspector << "├── arguments: ∅\n"
|
2445
|
-
else
|
2446
|
-
inspector << "├── arguments:\n"
|
2447
|
-
inspector << arguments.inspect(inspector.child_inspector("│ ")).delete_prefix(inspector.prefix)
|
2448
|
-
end
|
2449
|
-
inspector << "├── closing_loc: #{inspector.location(closing_loc)}\n"
|
2450
2554
|
flags = [("safe_navigation" if safe_navigation?), ("variable_call" if variable_call?)].compact
|
2451
2555
|
inspector << "├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n"
|
2452
2556
|
inspector << "├── read_name: #{read_name.inspect}\n"
|
@@ -2474,6 +2578,16 @@ module Prism
|
|
2474
2578
|
def type
|
2475
2579
|
:call_or_write_node
|
2476
2580
|
end
|
2581
|
+
|
2582
|
+
# Similar to #type, this method returns a symbol that you can use for
|
2583
|
+
# splitting on the type of the node without having to do a long === chain.
|
2584
|
+
# Note that like #type, it will still be slower than using == for a single
|
2585
|
+
# class, but should be faster in a case statement or an array comparison.
|
2586
|
+
#
|
2587
|
+
# def self.type: () -> Symbol
|
2588
|
+
def self.type
|
2589
|
+
:call_or_write_node
|
2590
|
+
end
|
2477
2591
|
end
|
2478
2592
|
|
2479
2593
|
# Represents assigning to a local variable in pattern matching.
|
@@ -2568,6 +2682,16 @@ module Prism
|
|
2568
2682
|
def type
|
2569
2683
|
:capture_pattern_node
|
2570
2684
|
end
|
2685
|
+
|
2686
|
+
# Similar to #type, this method returns a symbol that you can use for
|
2687
|
+
# splitting on the type of the node without having to do a long === chain.
|
2688
|
+
# Note that like #type, it will still be slower than using == for a single
|
2689
|
+
# class, but should be faster in a case statement or an array comparison.
|
2690
|
+
#
|
2691
|
+
# def self.type: () -> Symbol
|
2692
|
+
def self.type
|
2693
|
+
:capture_pattern_node
|
2694
|
+
end
|
2571
2695
|
end
|
2572
2696
|
|
2573
2697
|
# Represents the use of a case statement.
|
@@ -2693,6 +2817,16 @@ module Prism
|
|
2693
2817
|
def type
|
2694
2818
|
:case_node
|
2695
2819
|
end
|
2820
|
+
|
2821
|
+
# Similar to #type, this method returns a symbol that you can use for
|
2822
|
+
# splitting on the type of the node without having to do a long === chain.
|
2823
|
+
# Note that like #type, it will still be slower than using == for a single
|
2824
|
+
# class, but should be faster in a case statement or an array comparison.
|
2825
|
+
#
|
2826
|
+
# def self.type: () -> Symbol
|
2827
|
+
def self.type
|
2828
|
+
:case_node
|
2829
|
+
end
|
2696
2830
|
end
|
2697
2831
|
|
2698
2832
|
# Represents a class declaration involving the `class` keyword.
|
@@ -2840,6 +2974,16 @@ module Prism
|
|
2840
2974
|
def type
|
2841
2975
|
:class_node
|
2842
2976
|
end
|
2977
|
+
|
2978
|
+
# Similar to #type, this method returns a symbol that you can use for
|
2979
|
+
# splitting on the type of the node without having to do a long === chain.
|
2980
|
+
# Note that like #type, it will still be slower than using == for a single
|
2981
|
+
# class, but should be faster in a case statement or an array comparison.
|
2982
|
+
#
|
2983
|
+
# def self.type: () -> Symbol
|
2984
|
+
def self.type
|
2985
|
+
:class_node
|
2986
|
+
end
|
2843
2987
|
end
|
2844
2988
|
|
2845
2989
|
# Represents the use of the `&&=` operator for assignment to a class variable.
|
@@ -2939,6 +3083,16 @@ module Prism
|
|
2939
3083
|
def type
|
2940
3084
|
:class_variable_and_write_node
|
2941
3085
|
end
|
3086
|
+
|
3087
|
+
# Similar to #type, this method returns a symbol that you can use for
|
3088
|
+
# splitting on the type of the node without having to do a long === chain.
|
3089
|
+
# Note that like #type, it will still be slower than using == for a single
|
3090
|
+
# class, but should be faster in a case statement or an array comparison.
|
3091
|
+
#
|
3092
|
+
# def self.type: () -> Symbol
|
3093
|
+
def self.type
|
3094
|
+
:class_variable_and_write_node
|
3095
|
+
end
|
2942
3096
|
end
|
2943
3097
|
|
2944
3098
|
# Represents assigning to a class variable using an operator that isn't `=`.
|
@@ -3039,6 +3193,16 @@ module Prism
|
|
3039
3193
|
def type
|
3040
3194
|
:class_variable_operator_write_node
|
3041
3195
|
end
|
3196
|
+
|
3197
|
+
# Similar to #type, this method returns a symbol that you can use for
|
3198
|
+
# splitting on the type of the node without having to do a long === chain.
|
3199
|
+
# Note that like #type, it will still be slower than using == for a single
|
3200
|
+
# class, but should be faster in a case statement or an array comparison.
|
3201
|
+
#
|
3202
|
+
# def self.type: () -> Symbol
|
3203
|
+
def self.type
|
3204
|
+
:class_variable_operator_write_node
|
3205
|
+
end
|
3042
3206
|
end
|
3043
3207
|
|
3044
3208
|
# Represents the use of the `||=` operator for assignment to a class variable.
|
@@ -3138,6 +3302,16 @@ module Prism
|
|
3138
3302
|
def type
|
3139
3303
|
:class_variable_or_write_node
|
3140
3304
|
end
|
3305
|
+
|
3306
|
+
# Similar to #type, this method returns a symbol that you can use for
|
3307
|
+
# splitting on the type of the node without having to do a long === chain.
|
3308
|
+
# Note that like #type, it will still be slower than using == for a single
|
3309
|
+
# class, but should be faster in a case statement or an array comparison.
|
3310
|
+
#
|
3311
|
+
# def self.type: () -> Symbol
|
3312
|
+
def self.type
|
3313
|
+
:class_variable_or_write_node
|
3314
|
+
end
|
3141
3315
|
end
|
3142
3316
|
|
3143
3317
|
# Represents referencing a class variable.
|
@@ -3213,6 +3387,16 @@ module Prism
|
|
3213
3387
|
def type
|
3214
3388
|
:class_variable_read_node
|
3215
3389
|
end
|
3390
|
+
|
3391
|
+
# Similar to #type, this method returns a symbol that you can use for
|
3392
|
+
# splitting on the type of the node without having to do a long === chain.
|
3393
|
+
# Note that like #type, it will still be slower than using == for a single
|
3394
|
+
# class, but should be faster in a case statement or an array comparison.
|
3395
|
+
#
|
3396
|
+
# def self.type: () -> Symbol
|
3397
|
+
def self.type
|
3398
|
+
:class_variable_read_node
|
3399
|
+
end
|
3216
3400
|
end
|
3217
3401
|
|
3218
3402
|
# Represents writing to a class variable in a context that doesn't have an explicit value.
|
@@ -3288,6 +3472,16 @@ module Prism
|
|
3288
3472
|
def type
|
3289
3473
|
:class_variable_target_node
|
3290
3474
|
end
|
3475
|
+
|
3476
|
+
# Similar to #type, this method returns a symbol that you can use for
|
3477
|
+
# splitting on the type of the node without having to do a long === chain.
|
3478
|
+
# Note that like #type, it will still be slower than using == for a single
|
3479
|
+
# class, but should be faster in a case statement or an array comparison.
|
3480
|
+
#
|
3481
|
+
# def self.type: () -> Symbol
|
3482
|
+
def self.type
|
3483
|
+
:class_variable_target_node
|
3484
|
+
end
|
3291
3485
|
end
|
3292
3486
|
|
3293
3487
|
# Represents writing to a class variable.
|
@@ -3387,6 +3581,16 @@ module Prism
|
|
3387
3581
|
def type
|
3388
3582
|
:class_variable_write_node
|
3389
3583
|
end
|
3584
|
+
|
3585
|
+
# Similar to #type, this method returns a symbol that you can use for
|
3586
|
+
# splitting on the type of the node without having to do a long === chain.
|
3587
|
+
# Note that like #type, it will still be slower than using == for a single
|
3588
|
+
# class, but should be faster in a case statement or an array comparison.
|
3589
|
+
#
|
3590
|
+
# def self.type: () -> Symbol
|
3591
|
+
def self.type
|
3592
|
+
:class_variable_write_node
|
3593
|
+
end
|
3390
3594
|
end
|
3391
3595
|
|
3392
3596
|
# Represents the use of the `&&=` operator for assignment to a constant.
|
@@ -3486,6 +3690,16 @@ module Prism
|
|
3486
3690
|
def type
|
3487
3691
|
:constant_and_write_node
|
3488
3692
|
end
|
3693
|
+
|
3694
|
+
# Similar to #type, this method returns a symbol that you can use for
|
3695
|
+
# splitting on the type of the node without having to do a long === chain.
|
3696
|
+
# Note that like #type, it will still be slower than using == for a single
|
3697
|
+
# class, but should be faster in a case statement or an array comparison.
|
3698
|
+
#
|
3699
|
+
# def self.type: () -> Symbol
|
3700
|
+
def self.type
|
3701
|
+
:constant_and_write_node
|
3702
|
+
end
|
3489
3703
|
end
|
3490
3704
|
|
3491
3705
|
# Represents assigning to a constant using an operator that isn't `=`.
|
@@ -3586,6 +3800,16 @@ module Prism
|
|
3586
3800
|
def type
|
3587
3801
|
:constant_operator_write_node
|
3588
3802
|
end
|
3803
|
+
|
3804
|
+
# Similar to #type, this method returns a symbol that you can use for
|
3805
|
+
# splitting on the type of the node without having to do a long === chain.
|
3806
|
+
# Note that like #type, it will still be slower than using == for a single
|
3807
|
+
# class, but should be faster in a case statement or an array comparison.
|
3808
|
+
#
|
3809
|
+
# def self.type: () -> Symbol
|
3810
|
+
def self.type
|
3811
|
+
:constant_operator_write_node
|
3812
|
+
end
|
3589
3813
|
end
|
3590
3814
|
|
3591
3815
|
# Represents the use of the `||=` operator for assignment to a constant.
|
@@ -3685,6 +3909,16 @@ module Prism
|
|
3685
3909
|
def type
|
3686
3910
|
:constant_or_write_node
|
3687
3911
|
end
|
3912
|
+
|
3913
|
+
# Similar to #type, this method returns a symbol that you can use for
|
3914
|
+
# splitting on the type of the node without having to do a long === chain.
|
3915
|
+
# Note that like #type, it will still be slower than using == for a single
|
3916
|
+
# class, but should be faster in a case statement or an array comparison.
|
3917
|
+
#
|
3918
|
+
# def self.type: () -> Symbol
|
3919
|
+
def self.type
|
3920
|
+
:constant_or_write_node
|
3921
|
+
end
|
3688
3922
|
end
|
3689
3923
|
|
3690
3924
|
# Represents the use of the `&&=` operator for assignment to a constant path.
|
@@ -3779,6 +4013,16 @@ module Prism
|
|
3779
4013
|
def type
|
3780
4014
|
:constant_path_and_write_node
|
3781
4015
|
end
|
4016
|
+
|
4017
|
+
# Similar to #type, this method returns a symbol that you can use for
|
4018
|
+
# splitting on the type of the node without having to do a long === chain.
|
4019
|
+
# Note that like #type, it will still be slower than using == for a single
|
4020
|
+
# class, but should be faster in a case statement or an array comparison.
|
4021
|
+
#
|
4022
|
+
# def self.type: () -> Symbol
|
4023
|
+
def self.type
|
4024
|
+
:constant_path_and_write_node
|
4025
|
+
end
|
3782
4026
|
end
|
3783
4027
|
|
3784
4028
|
# Represents accessing a constant through a path of `::` operators.
|
@@ -3880,6 +4124,16 @@ module Prism
|
|
3880
4124
|
def type
|
3881
4125
|
:constant_path_node
|
3882
4126
|
end
|
4127
|
+
|
4128
|
+
# Similar to #type, this method returns a symbol that you can use for
|
4129
|
+
# splitting on the type of the node without having to do a long === chain.
|
4130
|
+
# Note that like #type, it will still be slower than using == for a single
|
4131
|
+
# class, but should be faster in a case statement or an array comparison.
|
4132
|
+
#
|
4133
|
+
# def self.type: () -> Symbol
|
4134
|
+
def self.type
|
4135
|
+
:constant_path_node
|
4136
|
+
end
|
3883
4137
|
end
|
3884
4138
|
|
3885
4139
|
# Represents assigning to a constant path using an operator that isn't `=`.
|
@@ -3975,7 +4229,17 @@ module Prism
|
|
3975
4229
|
def type
|
3976
4230
|
:constant_path_operator_write_node
|
3977
4231
|
end
|
3978
|
-
|
4232
|
+
|
4233
|
+
# Similar to #type, this method returns a symbol that you can use for
|
4234
|
+
# splitting on the type of the node without having to do a long === chain.
|
4235
|
+
# Note that like #type, it will still be slower than using == for a single
|
4236
|
+
# class, but should be faster in a case statement or an array comparison.
|
4237
|
+
#
|
4238
|
+
# def self.type: () -> Symbol
|
4239
|
+
def self.type
|
4240
|
+
:constant_path_operator_write_node
|
4241
|
+
end
|
4242
|
+
end
|
3979
4243
|
|
3980
4244
|
# Represents the use of the `||=` operator for assignment to a constant path.
|
3981
4245
|
#
|
@@ -4069,6 +4333,16 @@ module Prism
|
|
4069
4333
|
def type
|
4070
4334
|
:constant_path_or_write_node
|
4071
4335
|
end
|
4336
|
+
|
4337
|
+
# Similar to #type, this method returns a symbol that you can use for
|
4338
|
+
# splitting on the type of the node without having to do a long === chain.
|
4339
|
+
# Note that like #type, it will still be slower than using == for a single
|
4340
|
+
# class, but should be faster in a case statement or an array comparison.
|
4341
|
+
#
|
4342
|
+
# def self.type: () -> Symbol
|
4343
|
+
def self.type
|
4344
|
+
:constant_path_or_write_node
|
4345
|
+
end
|
4072
4346
|
end
|
4073
4347
|
|
4074
4348
|
# Represents writing to a constant path in a context that doesn't have an explicit value.
|
@@ -4170,6 +4444,16 @@ module Prism
|
|
4170
4444
|
def type
|
4171
4445
|
:constant_path_target_node
|
4172
4446
|
end
|
4447
|
+
|
4448
|
+
# Similar to #type, this method returns a symbol that you can use for
|
4449
|
+
# splitting on the type of the node without having to do a long === chain.
|
4450
|
+
# Note that like #type, it will still be slower than using == for a single
|
4451
|
+
# class, but should be faster in a case statement or an array comparison.
|
4452
|
+
#
|
4453
|
+
# def self.type: () -> Symbol
|
4454
|
+
def self.type
|
4455
|
+
:constant_path_target_node
|
4456
|
+
end
|
4173
4457
|
end
|
4174
4458
|
|
4175
4459
|
# Represents writing to a constant path.
|
@@ -4270,6 +4554,16 @@ module Prism
|
|
4270
4554
|
def type
|
4271
4555
|
:constant_path_write_node
|
4272
4556
|
end
|
4557
|
+
|
4558
|
+
# Similar to #type, this method returns a symbol that you can use for
|
4559
|
+
# splitting on the type of the node without having to do a long === chain.
|
4560
|
+
# Note that like #type, it will still be slower than using == for a single
|
4561
|
+
# class, but should be faster in a case statement or an array comparison.
|
4562
|
+
#
|
4563
|
+
# def self.type: () -> Symbol
|
4564
|
+
def self.type
|
4565
|
+
:constant_path_write_node
|
4566
|
+
end
|
4273
4567
|
end
|
4274
4568
|
|
4275
4569
|
# Represents referencing a constant.
|
@@ -4345,6 +4639,16 @@ module Prism
|
|
4345
4639
|
def type
|
4346
4640
|
:constant_read_node
|
4347
4641
|
end
|
4642
|
+
|
4643
|
+
# Similar to #type, this method returns a symbol that you can use for
|
4644
|
+
# splitting on the type of the node without having to do a long === chain.
|
4645
|
+
# Note that like #type, it will still be slower than using == for a single
|
4646
|
+
# class, but should be faster in a case statement or an array comparison.
|
4647
|
+
#
|
4648
|
+
# def self.type: () -> Symbol
|
4649
|
+
def self.type
|
4650
|
+
:constant_read_node
|
4651
|
+
end
|
4348
4652
|
end
|
4349
4653
|
|
4350
4654
|
# Represents writing to a constant in a context that doesn't have an explicit value.
|
@@ -4420,6 +4724,16 @@ module Prism
|
|
4420
4724
|
def type
|
4421
4725
|
:constant_target_node
|
4422
4726
|
end
|
4727
|
+
|
4728
|
+
# Similar to #type, this method returns a symbol that you can use for
|
4729
|
+
# splitting on the type of the node without having to do a long === chain.
|
4730
|
+
# Note that like #type, it will still be slower than using == for a single
|
4731
|
+
# class, but should be faster in a case statement or an array comparison.
|
4732
|
+
#
|
4733
|
+
# def self.type: () -> Symbol
|
4734
|
+
def self.type
|
4735
|
+
:constant_target_node
|
4736
|
+
end
|
4423
4737
|
end
|
4424
4738
|
|
4425
4739
|
# Represents writing to a constant.
|
@@ -4519,6 +4833,16 @@ module Prism
|
|
4519
4833
|
def type
|
4520
4834
|
:constant_write_node
|
4521
4835
|
end
|
4836
|
+
|
4837
|
+
# Similar to #type, this method returns a symbol that you can use for
|
4838
|
+
# splitting on the type of the node without having to do a long === chain.
|
4839
|
+
# Note that like #type, it will still be slower than using == for a single
|
4840
|
+
# class, but should be faster in a case statement or an array comparison.
|
4841
|
+
#
|
4842
|
+
# def self.type: () -> Symbol
|
4843
|
+
def self.type
|
4844
|
+
:constant_write_node
|
4845
|
+
end
|
4522
4846
|
end
|
4523
4847
|
|
4524
4848
|
# Represents a method definition.
|
@@ -4710,6 +5034,16 @@ module Prism
|
|
4710
5034
|
def type
|
4711
5035
|
:def_node
|
4712
5036
|
end
|
5037
|
+
|
5038
|
+
# Similar to #type, this method returns a symbol that you can use for
|
5039
|
+
# splitting on the type of the node without having to do a long === chain.
|
5040
|
+
# Note that like #type, it will still be slower than using == for a single
|
5041
|
+
# class, but should be faster in a case statement or an array comparison.
|
5042
|
+
#
|
5043
|
+
# def self.type: () -> Symbol
|
5044
|
+
def self.type
|
5045
|
+
:def_node
|
5046
|
+
end
|
4713
5047
|
end
|
4714
5048
|
|
4715
5049
|
# Represents the use of the `defined?` keyword.
|
@@ -4819,6 +5153,16 @@ module Prism
|
|
4819
5153
|
def type
|
4820
5154
|
:defined_node
|
4821
5155
|
end
|
5156
|
+
|
5157
|
+
# Similar to #type, this method returns a symbol that you can use for
|
5158
|
+
# splitting on the type of the node without having to do a long === chain.
|
5159
|
+
# Note that like #type, it will still be slower than using == for a single
|
5160
|
+
# class, but should be faster in a case statement or an array comparison.
|
5161
|
+
#
|
5162
|
+
# def self.type: () -> Symbol
|
5163
|
+
def self.type
|
5164
|
+
:defined_node
|
5165
|
+
end
|
4822
5166
|
end
|
4823
5167
|
|
4824
5168
|
# Represents an `else` clause in a `case`, `if`, or `unless` statement.
|
@@ -4923,6 +5267,16 @@ module Prism
|
|
4923
5267
|
def type
|
4924
5268
|
:else_node
|
4925
5269
|
end
|
5270
|
+
|
5271
|
+
# Similar to #type, this method returns a symbol that you can use for
|
5272
|
+
# splitting on the type of the node without having to do a long === chain.
|
5273
|
+
# Note that like #type, it will still be slower than using == for a single
|
5274
|
+
# class, but should be faster in a case statement or an array comparison.
|
5275
|
+
#
|
5276
|
+
# def self.type: () -> Symbol
|
5277
|
+
def self.type
|
5278
|
+
:else_node
|
5279
|
+
end
|
4926
5280
|
end
|
4927
5281
|
|
4928
5282
|
# Represents an interpolated set of statements.
|
@@ -5027,6 +5381,16 @@ module Prism
|
|
5027
5381
|
def type
|
5028
5382
|
:embedded_statements_node
|
5029
5383
|
end
|
5384
|
+
|
5385
|
+
# Similar to #type, this method returns a symbol that you can use for
|
5386
|
+
# splitting on the type of the node without having to do a long === chain.
|
5387
|
+
# Note that like #type, it will still be slower than using == for a single
|
5388
|
+
# class, but should be faster in a case statement or an array comparison.
|
5389
|
+
#
|
5390
|
+
# def self.type: () -> Symbol
|
5391
|
+
def self.type
|
5392
|
+
:embedded_statements_node
|
5393
|
+
end
|
5030
5394
|
end
|
5031
5395
|
|
5032
5396
|
# Represents an interpolated variable.
|
@@ -5114,6 +5478,16 @@ module Prism
|
|
5114
5478
|
def type
|
5115
5479
|
:embedded_variable_node
|
5116
5480
|
end
|
5481
|
+
|
5482
|
+
# Similar to #type, this method returns a symbol that you can use for
|
5483
|
+
# splitting on the type of the node without having to do a long === chain.
|
5484
|
+
# Note that like #type, it will still be slower than using == for a single
|
5485
|
+
# class, but should be faster in a case statement or an array comparison.
|
5486
|
+
#
|
5487
|
+
# def self.type: () -> Symbol
|
5488
|
+
def self.type
|
5489
|
+
:embedded_variable_node
|
5490
|
+
end
|
5117
5491
|
end
|
5118
5492
|
|
5119
5493
|
# Represents an `ensure` clause in a `begin` statement.
|
@@ -5222,6 +5596,16 @@ module Prism
|
|
5222
5596
|
def type
|
5223
5597
|
:ensure_node
|
5224
5598
|
end
|
5599
|
+
|
5600
|
+
# Similar to #type, this method returns a symbol that you can use for
|
5601
|
+
# splitting on the type of the node without having to do a long === chain.
|
5602
|
+
# Note that like #type, it will still be slower than using == for a single
|
5603
|
+
# class, but should be faster in a case statement or an array comparison.
|
5604
|
+
#
|
5605
|
+
# def self.type: () -> Symbol
|
5606
|
+
def self.type
|
5607
|
+
:ensure_node
|
5608
|
+
end
|
5225
5609
|
end
|
5226
5610
|
|
5227
5611
|
# Represents the use of the literal `false` keyword.
|
@@ -5291,6 +5675,16 @@ module Prism
|
|
5291
5675
|
def type
|
5292
5676
|
:false_node
|
5293
5677
|
end
|
5678
|
+
|
5679
|
+
# Similar to #type, this method returns a symbol that you can use for
|
5680
|
+
# splitting on the type of the node without having to do a long === chain.
|
5681
|
+
# Note that like #type, it will still be slower than using == for a single
|
5682
|
+
# class, but should be faster in a case statement or an array comparison.
|
5683
|
+
#
|
5684
|
+
# def self.type: () -> Symbol
|
5685
|
+
def self.type
|
5686
|
+
:false_node
|
5687
|
+
end
|
5294
5688
|
end
|
5295
5689
|
|
5296
5690
|
# Represents a find pattern in pattern matching.
|
@@ -5424,6 +5818,16 @@ module Prism
|
|
5424
5818
|
def type
|
5425
5819
|
:find_pattern_node
|
5426
5820
|
end
|
5821
|
+
|
5822
|
+
# Similar to #type, this method returns a symbol that you can use for
|
5823
|
+
# splitting on the type of the node without having to do a long === chain.
|
5824
|
+
# Note that like #type, it will still be slower than using == for a single
|
5825
|
+
# class, but should be faster in a case statement or an array comparison.
|
5826
|
+
#
|
5827
|
+
# def self.type: () -> Symbol
|
5828
|
+
def self.type
|
5829
|
+
:find_pattern_node
|
5830
|
+
end
|
5427
5831
|
end
|
5428
5832
|
|
5429
5833
|
# Represents the use of the `..` or `...` operators to create flip flops.
|
@@ -5541,6 +5945,16 @@ module Prism
|
|
5541
5945
|
def type
|
5542
5946
|
:flip_flop_node
|
5543
5947
|
end
|
5948
|
+
|
5949
|
+
# Similar to #type, this method returns a symbol that you can use for
|
5950
|
+
# splitting on the type of the node without having to do a long === chain.
|
5951
|
+
# Note that like #type, it will still be slower than using == for a single
|
5952
|
+
# class, but should be faster in a case statement or an array comparison.
|
5953
|
+
#
|
5954
|
+
# def self.type: () -> Symbol
|
5955
|
+
def self.type
|
5956
|
+
:flip_flop_node
|
5957
|
+
end
|
5544
5958
|
end
|
5545
5959
|
|
5546
5960
|
# Represents a floating point number literal.
|
@@ -5610,6 +6024,16 @@ module Prism
|
|
5610
6024
|
def type
|
5611
6025
|
:float_node
|
5612
6026
|
end
|
6027
|
+
|
6028
|
+
# Similar to #type, this method returns a symbol that you can use for
|
6029
|
+
# splitting on the type of the node without having to do a long === chain.
|
6030
|
+
# Note that like #type, it will still be slower than using == for a single
|
6031
|
+
# class, but should be faster in a case statement or an array comparison.
|
6032
|
+
#
|
6033
|
+
# def self.type: () -> Symbol
|
6034
|
+
def self.type
|
6035
|
+
:float_node
|
6036
|
+
end
|
5613
6037
|
end
|
5614
6038
|
|
5615
6039
|
# Represents the use of the `for` keyword.
|
@@ -5752,6 +6176,16 @@ module Prism
|
|
5752
6176
|
def type
|
5753
6177
|
:for_node
|
5754
6178
|
end
|
6179
|
+
|
6180
|
+
# Similar to #type, this method returns a symbol that you can use for
|
6181
|
+
# splitting on the type of the node without having to do a long === chain.
|
6182
|
+
# Note that like #type, it will still be slower than using == for a single
|
6183
|
+
# class, but should be faster in a case statement or an array comparison.
|
6184
|
+
#
|
6185
|
+
# def self.type: () -> Symbol
|
6186
|
+
def self.type
|
6187
|
+
:for_node
|
6188
|
+
end
|
5755
6189
|
end
|
5756
6190
|
|
5757
6191
|
# Represents forwarding all arguments to this method to another method.
|
@@ -5823,6 +6257,16 @@ module Prism
|
|
5823
6257
|
def type
|
5824
6258
|
:forwarding_arguments_node
|
5825
6259
|
end
|
6260
|
+
|
6261
|
+
# Similar to #type, this method returns a symbol that you can use for
|
6262
|
+
# splitting on the type of the node without having to do a long === chain.
|
6263
|
+
# Note that like #type, it will still be slower than using == for a single
|
6264
|
+
# class, but should be faster in a case statement or an array comparison.
|
6265
|
+
#
|
6266
|
+
# def self.type: () -> Symbol
|
6267
|
+
def self.type
|
6268
|
+
:forwarding_arguments_node
|
6269
|
+
end
|
5826
6270
|
end
|
5827
6271
|
|
5828
6272
|
# Represents the use of the forwarding parameter in a method, block, or lambda declaration.
|
@@ -5893,6 +6337,16 @@ module Prism
|
|
5893
6337
|
def type
|
5894
6338
|
:forwarding_parameter_node
|
5895
6339
|
end
|
6340
|
+
|
6341
|
+
# Similar to #type, this method returns a symbol that you can use for
|
6342
|
+
# splitting on the type of the node without having to do a long === chain.
|
6343
|
+
# Note that like #type, it will still be slower than using == for a single
|
6344
|
+
# class, but should be faster in a case statement or an array comparison.
|
6345
|
+
#
|
6346
|
+
# def self.type: () -> Symbol
|
6347
|
+
def self.type
|
6348
|
+
:forwarding_parameter_node
|
6349
|
+
end
|
5896
6350
|
end
|
5897
6351
|
|
5898
6352
|
# Represents the use of the `super` keyword without parentheses or arguments.
|
@@ -5975,6 +6429,16 @@ module Prism
|
|
5975
6429
|
def type
|
5976
6430
|
:forwarding_super_node
|
5977
6431
|
end
|
6432
|
+
|
6433
|
+
# Similar to #type, this method returns a symbol that you can use for
|
6434
|
+
# splitting on the type of the node without having to do a long === chain.
|
6435
|
+
# Note that like #type, it will still be slower than using == for a single
|
6436
|
+
# class, but should be faster in a case statement or an array comparison.
|
6437
|
+
#
|
6438
|
+
# def self.type: () -> Symbol
|
6439
|
+
def self.type
|
6440
|
+
:forwarding_super_node
|
6441
|
+
end
|
5978
6442
|
end
|
5979
6443
|
|
5980
6444
|
# Represents the use of the `&&=` operator for assignment to a global variable.
|
@@ -6074,6 +6538,16 @@ module Prism
|
|
6074
6538
|
def type
|
6075
6539
|
:global_variable_and_write_node
|
6076
6540
|
end
|
6541
|
+
|
6542
|
+
# Similar to #type, this method returns a symbol that you can use for
|
6543
|
+
# splitting on the type of the node without having to do a long === chain.
|
6544
|
+
# Note that like #type, it will still be slower than using == for a single
|
6545
|
+
# class, but should be faster in a case statement or an array comparison.
|
6546
|
+
#
|
6547
|
+
# def self.type: () -> Symbol
|
6548
|
+
def self.type
|
6549
|
+
:global_variable_and_write_node
|
6550
|
+
end
|
6077
6551
|
end
|
6078
6552
|
|
6079
6553
|
# Represents assigning to a global variable using an operator that isn't `=`.
|
@@ -6174,6 +6648,16 @@ module Prism
|
|
6174
6648
|
def type
|
6175
6649
|
:global_variable_operator_write_node
|
6176
6650
|
end
|
6651
|
+
|
6652
|
+
# Similar to #type, this method returns a symbol that you can use for
|
6653
|
+
# splitting on the type of the node without having to do a long === chain.
|
6654
|
+
# Note that like #type, it will still be slower than using == for a single
|
6655
|
+
# class, but should be faster in a case statement or an array comparison.
|
6656
|
+
#
|
6657
|
+
# def self.type: () -> Symbol
|
6658
|
+
def self.type
|
6659
|
+
:global_variable_operator_write_node
|
6660
|
+
end
|
6177
6661
|
end
|
6178
6662
|
|
6179
6663
|
# Represents the use of the `||=` operator for assignment to a global variable.
|
@@ -6273,6 +6757,16 @@ module Prism
|
|
6273
6757
|
def type
|
6274
6758
|
:global_variable_or_write_node
|
6275
6759
|
end
|
6760
|
+
|
6761
|
+
# Similar to #type, this method returns a symbol that you can use for
|
6762
|
+
# splitting on the type of the node without having to do a long === chain.
|
6763
|
+
# Note that like #type, it will still be slower than using == for a single
|
6764
|
+
# class, but should be faster in a case statement or an array comparison.
|
6765
|
+
#
|
6766
|
+
# def self.type: () -> Symbol
|
6767
|
+
def self.type
|
6768
|
+
:global_variable_or_write_node
|
6769
|
+
end
|
6276
6770
|
end
|
6277
6771
|
|
6278
6772
|
# Represents referencing a global variable.
|
@@ -6348,6 +6842,16 @@ module Prism
|
|
6348
6842
|
def type
|
6349
6843
|
:global_variable_read_node
|
6350
6844
|
end
|
6845
|
+
|
6846
|
+
# Similar to #type, this method returns a symbol that you can use for
|
6847
|
+
# splitting on the type of the node without having to do a long === chain.
|
6848
|
+
# Note that like #type, it will still be slower than using == for a single
|
6849
|
+
# class, but should be faster in a case statement or an array comparison.
|
6850
|
+
#
|
6851
|
+
# def self.type: () -> Symbol
|
6852
|
+
def self.type
|
6853
|
+
:global_variable_read_node
|
6854
|
+
end
|
6351
6855
|
end
|
6352
6856
|
|
6353
6857
|
# Represents writing to a global variable in a context that doesn't have an explicit value.
|
@@ -6423,6 +6927,16 @@ module Prism
|
|
6423
6927
|
def type
|
6424
6928
|
:global_variable_target_node
|
6425
6929
|
end
|
6930
|
+
|
6931
|
+
# Similar to #type, this method returns a symbol that you can use for
|
6932
|
+
# splitting on the type of the node without having to do a long === chain.
|
6933
|
+
# Note that like #type, it will still be slower than using == for a single
|
6934
|
+
# class, but should be faster in a case statement or an array comparison.
|
6935
|
+
#
|
6936
|
+
# def self.type: () -> Symbol
|
6937
|
+
def self.type
|
6938
|
+
:global_variable_target_node
|
6939
|
+
end
|
6426
6940
|
end
|
6427
6941
|
|
6428
6942
|
# Represents writing to a global variable.
|
@@ -6522,6 +7036,16 @@ module Prism
|
|
6522
7036
|
def type
|
6523
7037
|
:global_variable_write_node
|
6524
7038
|
end
|
7039
|
+
|
7040
|
+
# Similar to #type, this method returns a symbol that you can use for
|
7041
|
+
# splitting on the type of the node without having to do a long === chain.
|
7042
|
+
# Note that like #type, it will still be slower than using == for a single
|
7043
|
+
# class, but should be faster in a case statement or an array comparison.
|
7044
|
+
#
|
7045
|
+
# def self.type: () -> Symbol
|
7046
|
+
def self.type
|
7047
|
+
:global_variable_write_node
|
7048
|
+
end
|
6525
7049
|
end
|
6526
7050
|
|
6527
7051
|
# Represents a hash literal.
|
@@ -6619,6 +7143,16 @@ module Prism
|
|
6619
7143
|
def type
|
6620
7144
|
:hash_node
|
6621
7145
|
end
|
7146
|
+
|
7147
|
+
# Similar to #type, this method returns a symbol that you can use for
|
7148
|
+
# splitting on the type of the node without having to do a long === chain.
|
7149
|
+
# Note that like #type, it will still be slower than using == for a single
|
7150
|
+
# class, but should be faster in a case statement or an array comparison.
|
7151
|
+
#
|
7152
|
+
# def self.type: () -> Symbol
|
7153
|
+
def self.type
|
7154
|
+
:hash_node
|
7155
|
+
end
|
6622
7156
|
end
|
6623
7157
|
|
6624
7158
|
# Represents a hash pattern in pattern matching.
|
@@ -6745,6 +7279,16 @@ module Prism
|
|
6745
7279
|
def type
|
6746
7280
|
:hash_pattern_node
|
6747
7281
|
end
|
7282
|
+
|
7283
|
+
# Similar to #type, this method returns a symbol that you can use for
|
7284
|
+
# splitting on the type of the node without having to do a long === chain.
|
7285
|
+
# Note that like #type, it will still be slower than using == for a single
|
7286
|
+
# class, but should be faster in a case statement or an array comparison.
|
7287
|
+
#
|
7288
|
+
# def self.type: () -> Symbol
|
7289
|
+
def self.type
|
7290
|
+
:hash_pattern_node
|
7291
|
+
end
|
6748
7292
|
end
|
6749
7293
|
|
6750
7294
|
# Represents the use of the `if` keyword, either in the block form or the modifier form.
|
@@ -6876,6 +7420,16 @@ module Prism
|
|
6876
7420
|
def type
|
6877
7421
|
:if_node
|
6878
7422
|
end
|
7423
|
+
|
7424
|
+
# Similar to #type, this method returns a symbol that you can use for
|
7425
|
+
# splitting on the type of the node without having to do a long === chain.
|
7426
|
+
# Note that like #type, it will still be slower than using == for a single
|
7427
|
+
# class, but should be faster in a case statement or an array comparison.
|
7428
|
+
#
|
7429
|
+
# def self.type: () -> Symbol
|
7430
|
+
def self.type
|
7431
|
+
:if_node
|
7432
|
+
end
|
6879
7433
|
end
|
6880
7434
|
|
6881
7435
|
# Represents an imaginary number literal.
|
@@ -6952,6 +7506,16 @@ module Prism
|
|
6952
7506
|
def type
|
6953
7507
|
:imaginary_node
|
6954
7508
|
end
|
7509
|
+
|
7510
|
+
# Similar to #type, this method returns a symbol that you can use for
|
7511
|
+
# splitting on the type of the node without having to do a long === chain.
|
7512
|
+
# Note that like #type, it will still be slower than using == for a single
|
7513
|
+
# class, but should be faster in a case statement or an array comparison.
|
7514
|
+
#
|
7515
|
+
# def self.type: () -> Symbol
|
7516
|
+
def self.type
|
7517
|
+
:imaginary_node
|
7518
|
+
end
|
6955
7519
|
end
|
6956
7520
|
|
6957
7521
|
# Represents a node that is implicitly being added to the tree but doesn't
|
@@ -7032,6 +7596,16 @@ module Prism
|
|
7032
7596
|
def type
|
7033
7597
|
:implicit_node
|
7034
7598
|
end
|
7599
|
+
|
7600
|
+
# Similar to #type, this method returns a symbol that you can use for
|
7601
|
+
# splitting on the type of the node without having to do a long === chain.
|
7602
|
+
# Note that like #type, it will still be slower than using == for a single
|
7603
|
+
# class, but should be faster in a case statement or an array comparison.
|
7604
|
+
#
|
7605
|
+
# def self.type: () -> Symbol
|
7606
|
+
def self.type
|
7607
|
+
:implicit_node
|
7608
|
+
end
|
7035
7609
|
end
|
7036
7610
|
|
7037
7611
|
# Represents the use of the `in` keyword in a case statement.
|
@@ -7144,18 +7718,43 @@ module Prism
|
|
7144
7718
|
def type
|
7145
7719
|
:in_node
|
7146
7720
|
end
|
7721
|
+
|
7722
|
+
# Similar to #type, this method returns a symbol that you can use for
|
7723
|
+
# splitting on the type of the node without having to do a long === chain.
|
7724
|
+
# Note that like #type, it will still be slower than using == for a single
|
7725
|
+
# class, but should be faster in a case statement or an array comparison.
|
7726
|
+
#
|
7727
|
+
# def self.type: () -> Symbol
|
7728
|
+
def self.type
|
7729
|
+
:in_node
|
7730
|
+
end
|
7147
7731
|
end
|
7148
7732
|
|
7149
|
-
# Represents the use of the `&&=` operator
|
7733
|
+
# Represents the use of the `&&=` operator on a call to the `[]` method.
|
7150
7734
|
#
|
7151
|
-
#
|
7152
|
-
#
|
7153
|
-
class
|
7154
|
-
# attr_reader
|
7155
|
-
attr_reader :
|
7735
|
+
# foo.bar[baz] &&= value
|
7736
|
+
# ^^^^^^^^^^^^^^^^^^^^^^
|
7737
|
+
class IndexAndWriteNode < Node
|
7738
|
+
# attr_reader receiver: Node?
|
7739
|
+
attr_reader :receiver
|
7156
7740
|
|
7157
|
-
# attr_reader
|
7158
|
-
attr_reader :
|
7741
|
+
# attr_reader call_operator_loc: Location?
|
7742
|
+
attr_reader :call_operator_loc
|
7743
|
+
|
7744
|
+
# attr_reader opening_loc: Location
|
7745
|
+
attr_reader :opening_loc
|
7746
|
+
|
7747
|
+
# attr_reader arguments: ArgumentsNode?
|
7748
|
+
attr_reader :arguments
|
7749
|
+
|
7750
|
+
# attr_reader closing_loc: Location
|
7751
|
+
attr_reader :closing_loc
|
7752
|
+
|
7753
|
+
# attr_reader block: Node?
|
7754
|
+
attr_reader :block
|
7755
|
+
|
7756
|
+
# attr_reader flags: Integer
|
7757
|
+
private attr_reader :flags
|
7159
7758
|
|
7160
7759
|
# attr_reader operator_loc: Location
|
7161
7760
|
attr_reader :operator_loc
|
@@ -7163,10 +7762,15 @@ module Prism
|
|
7163
7762
|
# attr_reader value: Node
|
7164
7763
|
attr_reader :value
|
7165
7764
|
|
7166
|
-
# def initialize: (
|
7167
|
-
def initialize(
|
7168
|
-
@
|
7169
|
-
@
|
7765
|
+
# def initialize: (receiver: Node?, call_operator_loc: Location?, opening_loc: Location, arguments: ArgumentsNode?, closing_loc: Location, block: Node?, flags: Integer, operator_loc: Location, value: Node, location: Location) -> void
|
7766
|
+
def initialize(receiver, call_operator_loc, opening_loc, arguments, closing_loc, block, flags, operator_loc, value, location)
|
7767
|
+
@receiver = receiver
|
7768
|
+
@call_operator_loc = call_operator_loc
|
7769
|
+
@opening_loc = opening_loc
|
7770
|
+
@arguments = arguments
|
7771
|
+
@closing_loc = closing_loc
|
7772
|
+
@block = block
|
7773
|
+
@flags = flags
|
7170
7774
|
@operator_loc = operator_loc
|
7171
7775
|
@value = value
|
7172
7776
|
@location = location
|
@@ -7174,29 +7778,39 @@ module Prism
|
|
7174
7778
|
|
7175
7779
|
# def accept: (visitor: Visitor) -> void
|
7176
7780
|
def accept(visitor)
|
7177
|
-
visitor.
|
7781
|
+
visitor.visit_index_and_write_node(self)
|
7178
7782
|
end
|
7179
7783
|
|
7180
7784
|
# def child_nodes: () -> Array[nil | Node]
|
7181
7785
|
def child_nodes
|
7182
|
-
[value]
|
7786
|
+
[receiver, arguments, block, value]
|
7183
7787
|
end
|
7184
7788
|
|
7185
7789
|
# def compact_child_nodes: () -> Array[Node]
|
7186
7790
|
def compact_child_nodes
|
7187
|
-
[
|
7791
|
+
compact = []
|
7792
|
+
compact << receiver if receiver
|
7793
|
+
compact << arguments if arguments
|
7794
|
+
compact << block if block
|
7795
|
+
compact << value
|
7796
|
+
compact
|
7188
7797
|
end
|
7189
7798
|
|
7190
7799
|
# def comment_targets: () -> Array[Node | Location]
|
7191
7800
|
def comment_targets
|
7192
|
-
[
|
7801
|
+
[*receiver, *call_operator_loc, opening_loc, *arguments, closing_loc, *block, operator_loc, value]
|
7193
7802
|
end
|
7194
7803
|
|
7195
|
-
# def copy: (**params) ->
|
7804
|
+
# def copy: (**params) -> IndexAndWriteNode
|
7196
7805
|
def copy(**params)
|
7197
|
-
|
7198
|
-
params.fetch(:
|
7199
|
-
params.fetch(:
|
7806
|
+
IndexAndWriteNode.new(
|
7807
|
+
params.fetch(:receiver) { receiver },
|
7808
|
+
params.fetch(:call_operator_loc) { call_operator_loc },
|
7809
|
+
params.fetch(:opening_loc) { opening_loc },
|
7810
|
+
params.fetch(:arguments) { arguments },
|
7811
|
+
params.fetch(:closing_loc) { closing_loc },
|
7812
|
+
params.fetch(:block) { block },
|
7813
|
+
params.fetch(:flags) { flags },
|
7200
7814
|
params.fetch(:operator_loc) { operator_loc },
|
7201
7815
|
params.fetch(:value) { value },
|
7202
7816
|
params.fetch(:location) { location },
|
@@ -7208,7 +7822,32 @@ module Prism
|
|
7208
7822
|
|
7209
7823
|
# def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
|
7210
7824
|
def deconstruct_keys(keys)
|
7211
|
-
{
|
7825
|
+
{ receiver: receiver, call_operator_loc: call_operator_loc, opening_loc: opening_loc, arguments: arguments, closing_loc: closing_loc, block: block, flags: flags, operator_loc: operator_loc, value: value, location: location }
|
7826
|
+
end
|
7827
|
+
|
7828
|
+
# def call_operator: () -> String?
|
7829
|
+
def call_operator
|
7830
|
+
call_operator_loc&.slice
|
7831
|
+
end
|
7832
|
+
|
7833
|
+
# def opening: () -> String
|
7834
|
+
def opening
|
7835
|
+
opening_loc.slice
|
7836
|
+
end
|
7837
|
+
|
7838
|
+
# def closing: () -> String
|
7839
|
+
def closing
|
7840
|
+
closing_loc.slice
|
7841
|
+
end
|
7842
|
+
|
7843
|
+
# def safe_navigation?: () -> bool
|
7844
|
+
def safe_navigation?
|
7845
|
+
flags.anybits?(CallNodeFlags::SAFE_NAVIGATION)
|
7846
|
+
end
|
7847
|
+
|
7848
|
+
# def variable_call?: () -> bool
|
7849
|
+
def variable_call?
|
7850
|
+
flags.anybits?(CallNodeFlags::VARIABLE_CALL)
|
7212
7851
|
end
|
7213
7852
|
|
7214
7853
|
# def operator: () -> String
|
@@ -7218,8 +7857,29 @@ module Prism
|
|
7218
7857
|
|
7219
7858
|
def inspect(inspector = NodeInspector.new)
|
7220
7859
|
inspector << inspector.header(self)
|
7221
|
-
|
7222
|
-
|
7860
|
+
if (receiver = self.receiver).nil?
|
7861
|
+
inspector << "├── receiver: ∅\n"
|
7862
|
+
else
|
7863
|
+
inspector << "├── receiver:\n"
|
7864
|
+
inspector << receiver.inspect(inspector.child_inspector("│ ")).delete_prefix(inspector.prefix)
|
7865
|
+
end
|
7866
|
+
inspector << "├── call_operator_loc: #{inspector.location(call_operator_loc)}\n"
|
7867
|
+
inspector << "├── opening_loc: #{inspector.location(opening_loc)}\n"
|
7868
|
+
if (arguments = self.arguments).nil?
|
7869
|
+
inspector << "├── arguments: ∅\n"
|
7870
|
+
else
|
7871
|
+
inspector << "├── arguments:\n"
|
7872
|
+
inspector << arguments.inspect(inspector.child_inspector("│ ")).delete_prefix(inspector.prefix)
|
7873
|
+
end
|
7874
|
+
inspector << "├── closing_loc: #{inspector.location(closing_loc)}\n"
|
7875
|
+
if (block = self.block).nil?
|
7876
|
+
inspector << "├── block: ∅\n"
|
7877
|
+
else
|
7878
|
+
inspector << "├── block:\n"
|
7879
|
+
inspector << block.inspect(inspector.child_inspector("│ ")).delete_prefix(inspector.prefix)
|
7880
|
+
end
|
7881
|
+
flags = [("safe_navigation" if safe_navigation?), ("variable_call" if variable_call?)].compact
|
7882
|
+
inspector << "├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n"
|
7223
7883
|
inspector << "├── operator_loc: #{inspector.location(operator_loc)}\n"
|
7224
7884
|
inspector << "└── value:\n"
|
7225
7885
|
inspector << inspector.child_node(value, " ")
|
@@ -7241,17 +7901,507 @@ module Prism
|
|
7241
7901
|
#
|
7242
7902
|
# def type: () -> Symbol
|
7243
7903
|
def type
|
7244
|
-
:
|
7904
|
+
:index_and_write_node
|
7905
|
+
end
|
7906
|
+
|
7907
|
+
# Similar to #type, this method returns a symbol that you can use for
|
7908
|
+
# splitting on the type of the node without having to do a long === chain.
|
7909
|
+
# Note that like #type, it will still be slower than using == for a single
|
7910
|
+
# class, but should be faster in a case statement or an array comparison.
|
7911
|
+
#
|
7912
|
+
# def self.type: () -> Symbol
|
7913
|
+
def self.type
|
7914
|
+
:index_and_write_node
|
7245
7915
|
end
|
7246
7916
|
end
|
7247
7917
|
|
7248
|
-
# Represents
|
7918
|
+
# Represents the use of an assignment operator on a call to `[]`.
|
7249
7919
|
#
|
7250
|
-
#
|
7251
|
-
#
|
7252
|
-
class
|
7253
|
-
# attr_reader
|
7254
|
-
attr_reader :
|
7920
|
+
# foo.bar[baz] += value
|
7921
|
+
# ^^^^^^^^^^^^^^^^^^^^^
|
7922
|
+
class IndexOperatorWriteNode < Node
|
7923
|
+
# attr_reader receiver: Node?
|
7924
|
+
attr_reader :receiver
|
7925
|
+
|
7926
|
+
# attr_reader call_operator_loc: Location?
|
7927
|
+
attr_reader :call_operator_loc
|
7928
|
+
|
7929
|
+
# attr_reader opening_loc: Location
|
7930
|
+
attr_reader :opening_loc
|
7931
|
+
|
7932
|
+
# attr_reader arguments: ArgumentsNode?
|
7933
|
+
attr_reader :arguments
|
7934
|
+
|
7935
|
+
# attr_reader closing_loc: Location
|
7936
|
+
attr_reader :closing_loc
|
7937
|
+
|
7938
|
+
# attr_reader block: Node?
|
7939
|
+
attr_reader :block
|
7940
|
+
|
7941
|
+
# attr_reader flags: Integer
|
7942
|
+
private attr_reader :flags
|
7943
|
+
|
7944
|
+
# attr_reader operator: Symbol
|
7945
|
+
attr_reader :operator
|
7946
|
+
|
7947
|
+
# attr_reader operator_loc: Location
|
7948
|
+
attr_reader :operator_loc
|
7949
|
+
|
7950
|
+
# attr_reader value: Node
|
7951
|
+
attr_reader :value
|
7952
|
+
|
7953
|
+
# def initialize: (receiver: Node?, call_operator_loc: Location?, opening_loc: Location, arguments: ArgumentsNode?, closing_loc: Location, block: Node?, flags: Integer, operator: Symbol, operator_loc: Location, value: Node, location: Location) -> void
|
7954
|
+
def initialize(receiver, call_operator_loc, opening_loc, arguments, closing_loc, block, flags, operator, operator_loc, value, location)
|
7955
|
+
@receiver = receiver
|
7956
|
+
@call_operator_loc = call_operator_loc
|
7957
|
+
@opening_loc = opening_loc
|
7958
|
+
@arguments = arguments
|
7959
|
+
@closing_loc = closing_loc
|
7960
|
+
@block = block
|
7961
|
+
@flags = flags
|
7962
|
+
@operator = operator
|
7963
|
+
@operator_loc = operator_loc
|
7964
|
+
@value = value
|
7965
|
+
@location = location
|
7966
|
+
end
|
7967
|
+
|
7968
|
+
# def accept: (visitor: Visitor) -> void
|
7969
|
+
def accept(visitor)
|
7970
|
+
visitor.visit_index_operator_write_node(self)
|
7971
|
+
end
|
7972
|
+
|
7973
|
+
# def child_nodes: () -> Array[nil | Node]
|
7974
|
+
def child_nodes
|
7975
|
+
[receiver, arguments, block, value]
|
7976
|
+
end
|
7977
|
+
|
7978
|
+
# def compact_child_nodes: () -> Array[Node]
|
7979
|
+
def compact_child_nodes
|
7980
|
+
compact = []
|
7981
|
+
compact << receiver if receiver
|
7982
|
+
compact << arguments if arguments
|
7983
|
+
compact << block if block
|
7984
|
+
compact << value
|
7985
|
+
compact
|
7986
|
+
end
|
7987
|
+
|
7988
|
+
# def comment_targets: () -> Array[Node | Location]
|
7989
|
+
def comment_targets
|
7990
|
+
[*receiver, *call_operator_loc, opening_loc, *arguments, closing_loc, *block, operator_loc, value]
|
7991
|
+
end
|
7992
|
+
|
7993
|
+
# def copy: (**params) -> IndexOperatorWriteNode
|
7994
|
+
def copy(**params)
|
7995
|
+
IndexOperatorWriteNode.new(
|
7996
|
+
params.fetch(:receiver) { receiver },
|
7997
|
+
params.fetch(:call_operator_loc) { call_operator_loc },
|
7998
|
+
params.fetch(:opening_loc) { opening_loc },
|
7999
|
+
params.fetch(:arguments) { arguments },
|
8000
|
+
params.fetch(:closing_loc) { closing_loc },
|
8001
|
+
params.fetch(:block) { block },
|
8002
|
+
params.fetch(:flags) { flags },
|
8003
|
+
params.fetch(:operator) { operator },
|
8004
|
+
params.fetch(:operator_loc) { operator_loc },
|
8005
|
+
params.fetch(:value) { value },
|
8006
|
+
params.fetch(:location) { location },
|
8007
|
+
)
|
8008
|
+
end
|
8009
|
+
|
8010
|
+
# def deconstruct: () -> Array[nil | Node]
|
8011
|
+
alias deconstruct child_nodes
|
8012
|
+
|
8013
|
+
# def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
|
8014
|
+
def deconstruct_keys(keys)
|
8015
|
+
{ receiver: receiver, call_operator_loc: call_operator_loc, opening_loc: opening_loc, arguments: arguments, closing_loc: closing_loc, block: block, flags: flags, operator: operator, operator_loc: operator_loc, value: value, location: location }
|
8016
|
+
end
|
8017
|
+
|
8018
|
+
# def call_operator: () -> String?
|
8019
|
+
def call_operator
|
8020
|
+
call_operator_loc&.slice
|
8021
|
+
end
|
8022
|
+
|
8023
|
+
# def opening: () -> String
|
8024
|
+
def opening
|
8025
|
+
opening_loc.slice
|
8026
|
+
end
|
8027
|
+
|
8028
|
+
# def closing: () -> String
|
8029
|
+
def closing
|
8030
|
+
closing_loc.slice
|
8031
|
+
end
|
8032
|
+
|
8033
|
+
# def safe_navigation?: () -> bool
|
8034
|
+
def safe_navigation?
|
8035
|
+
flags.anybits?(CallNodeFlags::SAFE_NAVIGATION)
|
8036
|
+
end
|
8037
|
+
|
8038
|
+
# def variable_call?: () -> bool
|
8039
|
+
def variable_call?
|
8040
|
+
flags.anybits?(CallNodeFlags::VARIABLE_CALL)
|
8041
|
+
end
|
8042
|
+
|
8043
|
+
def inspect(inspector = NodeInspector.new)
|
8044
|
+
inspector << inspector.header(self)
|
8045
|
+
if (receiver = self.receiver).nil?
|
8046
|
+
inspector << "├── receiver: ∅\n"
|
8047
|
+
else
|
8048
|
+
inspector << "├── receiver:\n"
|
8049
|
+
inspector << receiver.inspect(inspector.child_inspector("│ ")).delete_prefix(inspector.prefix)
|
8050
|
+
end
|
8051
|
+
inspector << "├── call_operator_loc: #{inspector.location(call_operator_loc)}\n"
|
8052
|
+
inspector << "├── opening_loc: #{inspector.location(opening_loc)}\n"
|
8053
|
+
if (arguments = self.arguments).nil?
|
8054
|
+
inspector << "├── arguments: ∅\n"
|
8055
|
+
else
|
8056
|
+
inspector << "├── arguments:\n"
|
8057
|
+
inspector << arguments.inspect(inspector.child_inspector("│ ")).delete_prefix(inspector.prefix)
|
8058
|
+
end
|
8059
|
+
inspector << "├── closing_loc: #{inspector.location(closing_loc)}\n"
|
8060
|
+
if (block = self.block).nil?
|
8061
|
+
inspector << "├── block: ∅\n"
|
8062
|
+
else
|
8063
|
+
inspector << "├── block:\n"
|
8064
|
+
inspector << block.inspect(inspector.child_inspector("│ ")).delete_prefix(inspector.prefix)
|
8065
|
+
end
|
8066
|
+
flags = [("safe_navigation" if safe_navigation?), ("variable_call" if variable_call?)].compact
|
8067
|
+
inspector << "├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n"
|
8068
|
+
inspector << "├── operator: #{operator.inspect}\n"
|
8069
|
+
inspector << "├── operator_loc: #{inspector.location(operator_loc)}\n"
|
8070
|
+
inspector << "└── value:\n"
|
8071
|
+
inspector << inspector.child_node(value, " ")
|
8072
|
+
inspector.to_str
|
8073
|
+
end
|
8074
|
+
|
8075
|
+
# Sometimes you want to check an instance of a node against a list of
|
8076
|
+
# classes to see what kind of behavior to perform. Usually this is done by
|
8077
|
+
# calling `[cls1, cls2].include?(node.class)` or putting the node into a
|
8078
|
+
# case statement and doing `case node; when cls1; when cls2; end`. Both of
|
8079
|
+
# these approaches are relatively slow because of the constant lookups,
|
8080
|
+
# method calls, and/or array allocations.
|
8081
|
+
#
|
8082
|
+
# Instead, you can call #type, which will return to you a symbol that you
|
8083
|
+
# can use for comparison. This is faster than the other approaches because
|
8084
|
+
# it uses a single integer comparison, but also because if you're on CRuby
|
8085
|
+
# you can take advantage of the fact that case statements with all symbol
|
8086
|
+
# keys will use a jump table.
|
8087
|
+
#
|
8088
|
+
# def type: () -> Symbol
|
8089
|
+
def type
|
8090
|
+
:index_operator_write_node
|
8091
|
+
end
|
8092
|
+
|
8093
|
+
# Similar to #type, this method returns a symbol that you can use for
|
8094
|
+
# splitting on the type of the node without having to do a long === chain.
|
8095
|
+
# Note that like #type, it will still be slower than using == for a single
|
8096
|
+
# class, but should be faster in a case statement or an array comparison.
|
8097
|
+
#
|
8098
|
+
# def self.type: () -> Symbol
|
8099
|
+
def self.type
|
8100
|
+
:index_operator_write_node
|
8101
|
+
end
|
8102
|
+
end
|
8103
|
+
|
8104
|
+
# Represents the use of the `||=` operator on a call to `[]`.
|
8105
|
+
#
|
8106
|
+
# foo.bar[baz] ||= value
|
8107
|
+
# ^^^^^^^^^^^^^^^^^^^^^^
|
8108
|
+
class IndexOrWriteNode < Node
|
8109
|
+
# attr_reader receiver: Node?
|
8110
|
+
attr_reader :receiver
|
8111
|
+
|
8112
|
+
# attr_reader call_operator_loc: Location?
|
8113
|
+
attr_reader :call_operator_loc
|
8114
|
+
|
8115
|
+
# attr_reader opening_loc: Location
|
8116
|
+
attr_reader :opening_loc
|
8117
|
+
|
8118
|
+
# attr_reader arguments: ArgumentsNode?
|
8119
|
+
attr_reader :arguments
|
8120
|
+
|
8121
|
+
# attr_reader closing_loc: Location
|
8122
|
+
attr_reader :closing_loc
|
8123
|
+
|
8124
|
+
# attr_reader block: Node?
|
8125
|
+
attr_reader :block
|
8126
|
+
|
8127
|
+
# attr_reader flags: Integer
|
8128
|
+
private attr_reader :flags
|
8129
|
+
|
8130
|
+
# attr_reader operator_loc: Location
|
8131
|
+
attr_reader :operator_loc
|
8132
|
+
|
8133
|
+
# attr_reader value: Node
|
8134
|
+
attr_reader :value
|
8135
|
+
|
8136
|
+
# def initialize: (receiver: Node?, call_operator_loc: Location?, opening_loc: Location, arguments: ArgumentsNode?, closing_loc: Location, block: Node?, flags: Integer, operator_loc: Location, value: Node, location: Location) -> void
|
8137
|
+
def initialize(receiver, call_operator_loc, opening_loc, arguments, closing_loc, block, flags, operator_loc, value, location)
|
8138
|
+
@receiver = receiver
|
8139
|
+
@call_operator_loc = call_operator_loc
|
8140
|
+
@opening_loc = opening_loc
|
8141
|
+
@arguments = arguments
|
8142
|
+
@closing_loc = closing_loc
|
8143
|
+
@block = block
|
8144
|
+
@flags = flags
|
8145
|
+
@operator_loc = operator_loc
|
8146
|
+
@value = value
|
8147
|
+
@location = location
|
8148
|
+
end
|
8149
|
+
|
8150
|
+
# def accept: (visitor: Visitor) -> void
|
8151
|
+
def accept(visitor)
|
8152
|
+
visitor.visit_index_or_write_node(self)
|
8153
|
+
end
|
8154
|
+
|
8155
|
+
# def child_nodes: () -> Array[nil | Node]
|
8156
|
+
def child_nodes
|
8157
|
+
[receiver, arguments, block, value]
|
8158
|
+
end
|
8159
|
+
|
8160
|
+
# def compact_child_nodes: () -> Array[Node]
|
8161
|
+
def compact_child_nodes
|
8162
|
+
compact = []
|
8163
|
+
compact << receiver if receiver
|
8164
|
+
compact << arguments if arguments
|
8165
|
+
compact << block if block
|
8166
|
+
compact << value
|
8167
|
+
compact
|
8168
|
+
end
|
8169
|
+
|
8170
|
+
# def comment_targets: () -> Array[Node | Location]
|
8171
|
+
def comment_targets
|
8172
|
+
[*receiver, *call_operator_loc, opening_loc, *arguments, closing_loc, *block, operator_loc, value]
|
8173
|
+
end
|
8174
|
+
|
8175
|
+
# def copy: (**params) -> IndexOrWriteNode
|
8176
|
+
def copy(**params)
|
8177
|
+
IndexOrWriteNode.new(
|
8178
|
+
params.fetch(:receiver) { receiver },
|
8179
|
+
params.fetch(:call_operator_loc) { call_operator_loc },
|
8180
|
+
params.fetch(:opening_loc) { opening_loc },
|
8181
|
+
params.fetch(:arguments) { arguments },
|
8182
|
+
params.fetch(:closing_loc) { closing_loc },
|
8183
|
+
params.fetch(:block) { block },
|
8184
|
+
params.fetch(:flags) { flags },
|
8185
|
+
params.fetch(:operator_loc) { operator_loc },
|
8186
|
+
params.fetch(:value) { value },
|
8187
|
+
params.fetch(:location) { location },
|
8188
|
+
)
|
8189
|
+
end
|
8190
|
+
|
8191
|
+
# def deconstruct: () -> Array[nil | Node]
|
8192
|
+
alias deconstruct child_nodes
|
8193
|
+
|
8194
|
+
# def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
|
8195
|
+
def deconstruct_keys(keys)
|
8196
|
+
{ receiver: receiver, call_operator_loc: call_operator_loc, opening_loc: opening_loc, arguments: arguments, closing_loc: closing_loc, block: block, flags: flags, operator_loc: operator_loc, value: value, location: location }
|
8197
|
+
end
|
8198
|
+
|
8199
|
+
# def call_operator: () -> String?
|
8200
|
+
def call_operator
|
8201
|
+
call_operator_loc&.slice
|
8202
|
+
end
|
8203
|
+
|
8204
|
+
# def opening: () -> String
|
8205
|
+
def opening
|
8206
|
+
opening_loc.slice
|
8207
|
+
end
|
8208
|
+
|
8209
|
+
# def closing: () -> String
|
8210
|
+
def closing
|
8211
|
+
closing_loc.slice
|
8212
|
+
end
|
8213
|
+
|
8214
|
+
# def safe_navigation?: () -> bool
|
8215
|
+
def safe_navigation?
|
8216
|
+
flags.anybits?(CallNodeFlags::SAFE_NAVIGATION)
|
8217
|
+
end
|
8218
|
+
|
8219
|
+
# def variable_call?: () -> bool
|
8220
|
+
def variable_call?
|
8221
|
+
flags.anybits?(CallNodeFlags::VARIABLE_CALL)
|
8222
|
+
end
|
8223
|
+
|
8224
|
+
# def operator: () -> String
|
8225
|
+
def operator
|
8226
|
+
operator_loc.slice
|
8227
|
+
end
|
8228
|
+
|
8229
|
+
def inspect(inspector = NodeInspector.new)
|
8230
|
+
inspector << inspector.header(self)
|
8231
|
+
if (receiver = self.receiver).nil?
|
8232
|
+
inspector << "├── receiver: ∅\n"
|
8233
|
+
else
|
8234
|
+
inspector << "├── receiver:\n"
|
8235
|
+
inspector << receiver.inspect(inspector.child_inspector("│ ")).delete_prefix(inspector.prefix)
|
8236
|
+
end
|
8237
|
+
inspector << "├── call_operator_loc: #{inspector.location(call_operator_loc)}\n"
|
8238
|
+
inspector << "├── opening_loc: #{inspector.location(opening_loc)}\n"
|
8239
|
+
if (arguments = self.arguments).nil?
|
8240
|
+
inspector << "├── arguments: ∅\n"
|
8241
|
+
else
|
8242
|
+
inspector << "├── arguments:\n"
|
8243
|
+
inspector << arguments.inspect(inspector.child_inspector("│ ")).delete_prefix(inspector.prefix)
|
8244
|
+
end
|
8245
|
+
inspector << "├── closing_loc: #{inspector.location(closing_loc)}\n"
|
8246
|
+
if (block = self.block).nil?
|
8247
|
+
inspector << "├── block: ∅\n"
|
8248
|
+
else
|
8249
|
+
inspector << "├── block:\n"
|
8250
|
+
inspector << block.inspect(inspector.child_inspector("│ ")).delete_prefix(inspector.prefix)
|
8251
|
+
end
|
8252
|
+
flags = [("safe_navigation" if safe_navigation?), ("variable_call" if variable_call?)].compact
|
8253
|
+
inspector << "├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n"
|
8254
|
+
inspector << "├── operator_loc: #{inspector.location(operator_loc)}\n"
|
8255
|
+
inspector << "└── value:\n"
|
8256
|
+
inspector << inspector.child_node(value, " ")
|
8257
|
+
inspector.to_str
|
8258
|
+
end
|
8259
|
+
|
8260
|
+
# Sometimes you want to check an instance of a node against a list of
|
8261
|
+
# classes to see what kind of behavior to perform. Usually this is done by
|
8262
|
+
# calling `[cls1, cls2].include?(node.class)` or putting the node into a
|
8263
|
+
# case statement and doing `case node; when cls1; when cls2; end`. Both of
|
8264
|
+
# these approaches are relatively slow because of the constant lookups,
|
8265
|
+
# method calls, and/or array allocations.
|
8266
|
+
#
|
8267
|
+
# Instead, you can call #type, which will return to you a symbol that you
|
8268
|
+
# can use for comparison. This is faster than the other approaches because
|
8269
|
+
# it uses a single integer comparison, but also because if you're on CRuby
|
8270
|
+
# you can take advantage of the fact that case statements with all symbol
|
8271
|
+
# keys will use a jump table.
|
8272
|
+
#
|
8273
|
+
# def type: () -> Symbol
|
8274
|
+
def type
|
8275
|
+
:index_or_write_node
|
8276
|
+
end
|
8277
|
+
|
8278
|
+
# Similar to #type, this method returns a symbol that you can use for
|
8279
|
+
# splitting on the type of the node without having to do a long === chain.
|
8280
|
+
# Note that like #type, it will still be slower than using == for a single
|
8281
|
+
# class, but should be faster in a case statement or an array comparison.
|
8282
|
+
#
|
8283
|
+
# def self.type: () -> Symbol
|
8284
|
+
def self.type
|
8285
|
+
:index_or_write_node
|
8286
|
+
end
|
8287
|
+
end
|
8288
|
+
|
8289
|
+
# Represents the use of the `&&=` operator for assignment to an instance variable.
|
8290
|
+
#
|
8291
|
+
# @target &&= value
|
8292
|
+
# ^^^^^^^^^^^^^^^^^
|
8293
|
+
class InstanceVariableAndWriteNode < Node
|
8294
|
+
# attr_reader name: Symbol
|
8295
|
+
attr_reader :name
|
8296
|
+
|
8297
|
+
# attr_reader name_loc: Location
|
8298
|
+
attr_reader :name_loc
|
8299
|
+
|
8300
|
+
# attr_reader operator_loc: Location
|
8301
|
+
attr_reader :operator_loc
|
8302
|
+
|
8303
|
+
# attr_reader value: Node
|
8304
|
+
attr_reader :value
|
8305
|
+
|
8306
|
+
# def initialize: (name: Symbol, name_loc: Location, operator_loc: Location, value: Node, location: Location) -> void
|
8307
|
+
def initialize(name, name_loc, operator_loc, value, location)
|
8308
|
+
@name = name
|
8309
|
+
@name_loc = name_loc
|
8310
|
+
@operator_loc = operator_loc
|
8311
|
+
@value = value
|
8312
|
+
@location = location
|
8313
|
+
end
|
8314
|
+
|
8315
|
+
# def accept: (visitor: Visitor) -> void
|
8316
|
+
def accept(visitor)
|
8317
|
+
visitor.visit_instance_variable_and_write_node(self)
|
8318
|
+
end
|
8319
|
+
|
8320
|
+
# def child_nodes: () -> Array[nil | Node]
|
8321
|
+
def child_nodes
|
8322
|
+
[value]
|
8323
|
+
end
|
8324
|
+
|
8325
|
+
# def compact_child_nodes: () -> Array[Node]
|
8326
|
+
def compact_child_nodes
|
8327
|
+
[value]
|
8328
|
+
end
|
8329
|
+
|
8330
|
+
# def comment_targets: () -> Array[Node | Location]
|
8331
|
+
def comment_targets
|
8332
|
+
[name_loc, operator_loc, value]
|
8333
|
+
end
|
8334
|
+
|
8335
|
+
# def copy: (**params) -> InstanceVariableAndWriteNode
|
8336
|
+
def copy(**params)
|
8337
|
+
InstanceVariableAndWriteNode.new(
|
8338
|
+
params.fetch(:name) { name },
|
8339
|
+
params.fetch(:name_loc) { name_loc },
|
8340
|
+
params.fetch(:operator_loc) { operator_loc },
|
8341
|
+
params.fetch(:value) { value },
|
8342
|
+
params.fetch(:location) { location },
|
8343
|
+
)
|
8344
|
+
end
|
8345
|
+
|
8346
|
+
# def deconstruct: () -> Array[nil | Node]
|
8347
|
+
alias deconstruct child_nodes
|
8348
|
+
|
8349
|
+
# def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
|
8350
|
+
def deconstruct_keys(keys)
|
8351
|
+
{ name: name, name_loc: name_loc, operator_loc: operator_loc, value: value, location: location }
|
8352
|
+
end
|
8353
|
+
|
8354
|
+
# def operator: () -> String
|
8355
|
+
def operator
|
8356
|
+
operator_loc.slice
|
8357
|
+
end
|
8358
|
+
|
8359
|
+
def inspect(inspector = NodeInspector.new)
|
8360
|
+
inspector << inspector.header(self)
|
8361
|
+
inspector << "├── name: #{name.inspect}\n"
|
8362
|
+
inspector << "├── name_loc: #{inspector.location(name_loc)}\n"
|
8363
|
+
inspector << "├── operator_loc: #{inspector.location(operator_loc)}\n"
|
8364
|
+
inspector << "└── value:\n"
|
8365
|
+
inspector << inspector.child_node(value, " ")
|
8366
|
+
inspector.to_str
|
8367
|
+
end
|
8368
|
+
|
8369
|
+
# Sometimes you want to check an instance of a node against a list of
|
8370
|
+
# classes to see what kind of behavior to perform. Usually this is done by
|
8371
|
+
# calling `[cls1, cls2].include?(node.class)` or putting the node into a
|
8372
|
+
# case statement and doing `case node; when cls1; when cls2; end`. Both of
|
8373
|
+
# these approaches are relatively slow because of the constant lookups,
|
8374
|
+
# method calls, and/or array allocations.
|
8375
|
+
#
|
8376
|
+
# Instead, you can call #type, which will return to you a symbol that you
|
8377
|
+
# can use for comparison. This is faster than the other approaches because
|
8378
|
+
# it uses a single integer comparison, but also because if you're on CRuby
|
8379
|
+
# you can take advantage of the fact that case statements with all symbol
|
8380
|
+
# keys will use a jump table.
|
8381
|
+
#
|
8382
|
+
# def type: () -> Symbol
|
8383
|
+
def type
|
8384
|
+
:instance_variable_and_write_node
|
8385
|
+
end
|
8386
|
+
|
8387
|
+
# Similar to #type, this method returns a symbol that you can use for
|
8388
|
+
# splitting on the type of the node without having to do a long === chain.
|
8389
|
+
# Note that like #type, it will still be slower than using == for a single
|
8390
|
+
# class, but should be faster in a case statement or an array comparison.
|
8391
|
+
#
|
8392
|
+
# def self.type: () -> Symbol
|
8393
|
+
def self.type
|
8394
|
+
:instance_variable_and_write_node
|
8395
|
+
end
|
8396
|
+
end
|
8397
|
+
|
8398
|
+
# Represents assigning to an instance variable using an operator that isn't `=`.
|
8399
|
+
#
|
8400
|
+
# @target += value
|
8401
|
+
# ^^^^^^^^^^^^^^^^
|
8402
|
+
class InstanceVariableOperatorWriteNode < Node
|
8403
|
+
# attr_reader name: Symbol
|
8404
|
+
attr_reader :name
|
7255
8405
|
|
7256
8406
|
# attr_reader name_loc: Location
|
7257
8407
|
attr_reader :name_loc
|
@@ -7343,6 +8493,16 @@ module Prism
|
|
7343
8493
|
def type
|
7344
8494
|
:instance_variable_operator_write_node
|
7345
8495
|
end
|
8496
|
+
|
8497
|
+
# Similar to #type, this method returns a symbol that you can use for
|
8498
|
+
# splitting on the type of the node without having to do a long === chain.
|
8499
|
+
# Note that like #type, it will still be slower than using == for a single
|
8500
|
+
# class, but should be faster in a case statement or an array comparison.
|
8501
|
+
#
|
8502
|
+
# def self.type: () -> Symbol
|
8503
|
+
def self.type
|
8504
|
+
:instance_variable_operator_write_node
|
8505
|
+
end
|
7346
8506
|
end
|
7347
8507
|
|
7348
8508
|
# Represents the use of the `||=` operator for assignment to an instance variable.
|
@@ -7442,6 +8602,16 @@ module Prism
|
|
7442
8602
|
def type
|
7443
8603
|
:instance_variable_or_write_node
|
7444
8604
|
end
|
8605
|
+
|
8606
|
+
# Similar to #type, this method returns a symbol that you can use for
|
8607
|
+
# splitting on the type of the node without having to do a long === chain.
|
8608
|
+
# Note that like #type, it will still be slower than using == for a single
|
8609
|
+
# class, but should be faster in a case statement or an array comparison.
|
8610
|
+
#
|
8611
|
+
# def self.type: () -> Symbol
|
8612
|
+
def self.type
|
8613
|
+
:instance_variable_or_write_node
|
8614
|
+
end
|
7445
8615
|
end
|
7446
8616
|
|
7447
8617
|
# Represents referencing an instance variable.
|
@@ -7517,6 +8687,16 @@ module Prism
|
|
7517
8687
|
def type
|
7518
8688
|
:instance_variable_read_node
|
7519
8689
|
end
|
8690
|
+
|
8691
|
+
# Similar to #type, this method returns a symbol that you can use for
|
8692
|
+
# splitting on the type of the node without having to do a long === chain.
|
8693
|
+
# Note that like #type, it will still be slower than using == for a single
|
8694
|
+
# class, but should be faster in a case statement or an array comparison.
|
8695
|
+
#
|
8696
|
+
# def self.type: () -> Symbol
|
8697
|
+
def self.type
|
8698
|
+
:instance_variable_read_node
|
8699
|
+
end
|
7520
8700
|
end
|
7521
8701
|
|
7522
8702
|
# Represents writing to an instance variable in a context that doesn't have an explicit value.
|
@@ -7592,6 +8772,16 @@ module Prism
|
|
7592
8772
|
def type
|
7593
8773
|
:instance_variable_target_node
|
7594
8774
|
end
|
8775
|
+
|
8776
|
+
# Similar to #type, this method returns a symbol that you can use for
|
8777
|
+
# splitting on the type of the node without having to do a long === chain.
|
8778
|
+
# Note that like #type, it will still be slower than using == for a single
|
8779
|
+
# class, but should be faster in a case statement or an array comparison.
|
8780
|
+
#
|
8781
|
+
# def self.type: () -> Symbol
|
8782
|
+
def self.type
|
8783
|
+
:instance_variable_target_node
|
8784
|
+
end
|
7595
8785
|
end
|
7596
8786
|
|
7597
8787
|
# Represents writing to an instance variable.
|
@@ -7691,6 +8881,16 @@ module Prism
|
|
7691
8881
|
def type
|
7692
8882
|
:instance_variable_write_node
|
7693
8883
|
end
|
8884
|
+
|
8885
|
+
# Similar to #type, this method returns a symbol that you can use for
|
8886
|
+
# splitting on the type of the node without having to do a long === chain.
|
8887
|
+
# Note that like #type, it will still be slower than using == for a single
|
8888
|
+
# class, but should be faster in a case statement or an array comparison.
|
8889
|
+
#
|
8890
|
+
# def self.type: () -> Symbol
|
8891
|
+
def self.type
|
8892
|
+
:instance_variable_write_node
|
8893
|
+
end
|
7694
8894
|
end
|
7695
8895
|
|
7696
8896
|
# Represents an integer number literal.
|
@@ -7787,6 +8987,16 @@ module Prism
|
|
7787
8987
|
def type
|
7788
8988
|
:integer_node
|
7789
8989
|
end
|
8990
|
+
|
8991
|
+
# Similar to #type, this method returns a symbol that you can use for
|
8992
|
+
# splitting on the type of the node without having to do a long === chain.
|
8993
|
+
# Note that like #type, it will still be slower than using == for a single
|
8994
|
+
# class, but should be faster in a case statement or an array comparison.
|
8995
|
+
#
|
8996
|
+
# def self.type: () -> Symbol
|
8997
|
+
def self.type
|
8998
|
+
:integer_node
|
8999
|
+
end
|
7790
9000
|
end
|
7791
9001
|
|
7792
9002
|
# Represents a regular expression literal that contains interpolation that
|
@@ -7886,6 +9096,11 @@ module Prism
|
|
7886
9096
|
flags.anybits?(RegularExpressionFlags::MULTI_LINE)
|
7887
9097
|
end
|
7888
9098
|
|
9099
|
+
# def once?: () -> bool
|
9100
|
+
def once?
|
9101
|
+
flags.anybits?(RegularExpressionFlags::ONCE)
|
9102
|
+
end
|
9103
|
+
|
7889
9104
|
# def euc_jp?: () -> bool
|
7890
9105
|
def euc_jp?
|
7891
9106
|
flags.anybits?(RegularExpressionFlags::EUC_JP)
|
@@ -7906,17 +9121,12 @@ module Prism
|
|
7906
9121
|
flags.anybits?(RegularExpressionFlags::UTF_8)
|
7907
9122
|
end
|
7908
9123
|
|
7909
|
-
# def once?: () -> bool
|
7910
|
-
def once?
|
7911
|
-
flags.anybits?(RegularExpressionFlags::ONCE)
|
7912
|
-
end
|
7913
|
-
|
7914
9124
|
def inspect(inspector = NodeInspector.new)
|
7915
9125
|
inspector << inspector.header(self)
|
7916
9126
|
inspector << "├── opening_loc: #{inspector.location(opening_loc)}\n"
|
7917
9127
|
inspector << "├── parts: #{inspector.list("#{inspector.prefix}│ ", parts)}"
|
7918
9128
|
inspector << "├── closing_loc: #{inspector.location(closing_loc)}\n"
|
7919
|
-
flags = [("ignore_case" if ignore_case?), ("extended" if extended?), ("multi_line" if multi_line?), ("
|
9129
|
+
flags = [("ignore_case" if ignore_case?), ("extended" if extended?), ("multi_line" if multi_line?), ("once" if once?), ("euc_jp" if euc_jp?), ("ascii_8bit" if ascii_8bit?), ("windows_31j" if windows_31j?), ("utf_8" if utf_8?)].compact
|
7920
9130
|
inspector << "└── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n"
|
7921
9131
|
inspector.to_str
|
7922
9132
|
end
|
@@ -7938,6 +9148,16 @@ module Prism
|
|
7938
9148
|
def type
|
7939
9149
|
:interpolated_match_last_line_node
|
7940
9150
|
end
|
9151
|
+
|
9152
|
+
# Similar to #type, this method returns a symbol that you can use for
|
9153
|
+
# splitting on the type of the node without having to do a long === chain.
|
9154
|
+
# Note that like #type, it will still be slower than using == for a single
|
9155
|
+
# class, but should be faster in a case statement or an array comparison.
|
9156
|
+
#
|
9157
|
+
# def self.type: () -> Symbol
|
9158
|
+
def self.type
|
9159
|
+
:interpolated_match_last_line_node
|
9160
|
+
end
|
7941
9161
|
end
|
7942
9162
|
|
7943
9163
|
# Represents a regular expression literal that contains interpolation.
|
@@ -8035,6 +9255,11 @@ module Prism
|
|
8035
9255
|
flags.anybits?(RegularExpressionFlags::MULTI_LINE)
|
8036
9256
|
end
|
8037
9257
|
|
9258
|
+
# def once?: () -> bool
|
9259
|
+
def once?
|
9260
|
+
flags.anybits?(RegularExpressionFlags::ONCE)
|
9261
|
+
end
|
9262
|
+
|
8038
9263
|
# def euc_jp?: () -> bool
|
8039
9264
|
def euc_jp?
|
8040
9265
|
flags.anybits?(RegularExpressionFlags::EUC_JP)
|
@@ -8055,17 +9280,12 @@ module Prism
|
|
8055
9280
|
flags.anybits?(RegularExpressionFlags::UTF_8)
|
8056
9281
|
end
|
8057
9282
|
|
8058
|
-
# def once?: () -> bool
|
8059
|
-
def once?
|
8060
|
-
flags.anybits?(RegularExpressionFlags::ONCE)
|
8061
|
-
end
|
8062
|
-
|
8063
9283
|
def inspect(inspector = NodeInspector.new)
|
8064
9284
|
inspector << inspector.header(self)
|
8065
9285
|
inspector << "├── opening_loc: #{inspector.location(opening_loc)}\n"
|
8066
9286
|
inspector << "├── parts: #{inspector.list("#{inspector.prefix}│ ", parts)}"
|
8067
9287
|
inspector << "├── closing_loc: #{inspector.location(closing_loc)}\n"
|
8068
|
-
flags = [("ignore_case" if ignore_case?), ("extended" if extended?), ("multi_line" if multi_line?), ("
|
9288
|
+
flags = [("ignore_case" if ignore_case?), ("extended" if extended?), ("multi_line" if multi_line?), ("once" if once?), ("euc_jp" if euc_jp?), ("ascii_8bit" if ascii_8bit?), ("windows_31j" if windows_31j?), ("utf_8" if utf_8?)].compact
|
8069
9289
|
inspector << "└── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n"
|
8070
9290
|
inspector.to_str
|
8071
9291
|
end
|
@@ -8087,6 +9307,16 @@ module Prism
|
|
8087
9307
|
def type
|
8088
9308
|
:interpolated_regular_expression_node
|
8089
9309
|
end
|
9310
|
+
|
9311
|
+
# Similar to #type, this method returns a symbol that you can use for
|
9312
|
+
# splitting on the type of the node without having to do a long === chain.
|
9313
|
+
# Note that like #type, it will still be slower than using == for a single
|
9314
|
+
# class, but should be faster in a case statement or an array comparison.
|
9315
|
+
#
|
9316
|
+
# def self.type: () -> Symbol
|
9317
|
+
def self.type
|
9318
|
+
:interpolated_regular_expression_node
|
9319
|
+
end
|
8090
9320
|
end
|
8091
9321
|
|
8092
9322
|
# Represents a string literal that contains interpolation.
|
@@ -8189,6 +9419,16 @@ module Prism
|
|
8189
9419
|
def type
|
8190
9420
|
:interpolated_string_node
|
8191
9421
|
end
|
9422
|
+
|
9423
|
+
# Similar to #type, this method returns a symbol that you can use for
|
9424
|
+
# splitting on the type of the node without having to do a long === chain.
|
9425
|
+
# Note that like #type, it will still be slower than using == for a single
|
9426
|
+
# class, but should be faster in a case statement or an array comparison.
|
9427
|
+
#
|
9428
|
+
# def self.type: () -> Symbol
|
9429
|
+
def self.type
|
9430
|
+
:interpolated_string_node
|
9431
|
+
end
|
8192
9432
|
end
|
8193
9433
|
|
8194
9434
|
# Represents a symbol literal that contains interpolation.
|
@@ -8291,6 +9531,16 @@ module Prism
|
|
8291
9531
|
def type
|
8292
9532
|
:interpolated_symbol_node
|
8293
9533
|
end
|
9534
|
+
|
9535
|
+
# Similar to #type, this method returns a symbol that you can use for
|
9536
|
+
# splitting on the type of the node without having to do a long === chain.
|
9537
|
+
# Note that like #type, it will still be slower than using == for a single
|
9538
|
+
# class, but should be faster in a case statement or an array comparison.
|
9539
|
+
#
|
9540
|
+
# def self.type: () -> Symbol
|
9541
|
+
def self.type
|
9542
|
+
:interpolated_symbol_node
|
9543
|
+
end
|
8294
9544
|
end
|
8295
9545
|
|
8296
9546
|
# Represents an xstring literal that contains interpolation.
|
@@ -8393,6 +9643,16 @@ module Prism
|
|
8393
9643
|
def type
|
8394
9644
|
:interpolated_x_string_node
|
8395
9645
|
end
|
9646
|
+
|
9647
|
+
# Similar to #type, this method returns a symbol that you can use for
|
9648
|
+
# splitting on the type of the node without having to do a long === chain.
|
9649
|
+
# Note that like #type, it will still be slower than using == for a single
|
9650
|
+
# class, but should be faster in a case statement or an array comparison.
|
9651
|
+
#
|
9652
|
+
# def self.type: () -> Symbol
|
9653
|
+
def self.type
|
9654
|
+
:interpolated_x_string_node
|
9655
|
+
end
|
8396
9656
|
end
|
8397
9657
|
|
8398
9658
|
# Represents a hash literal without opening and closing braces.
|
@@ -8468,6 +9728,16 @@ module Prism
|
|
8468
9728
|
def type
|
8469
9729
|
:keyword_hash_node
|
8470
9730
|
end
|
9731
|
+
|
9732
|
+
# Similar to #type, this method returns a symbol that you can use for
|
9733
|
+
# splitting on the type of the node without having to do a long === chain.
|
9734
|
+
# Note that like #type, it will still be slower than using == for a single
|
9735
|
+
# class, but should be faster in a case statement or an array comparison.
|
9736
|
+
#
|
9737
|
+
# def self.type: () -> Symbol
|
9738
|
+
def self.type
|
9739
|
+
:keyword_hash_node
|
9740
|
+
end
|
8471
9741
|
end
|
8472
9742
|
|
8473
9743
|
# Represents a keyword parameter to a method, block, or lambda definition.
|
@@ -8567,6 +9837,16 @@ module Prism
|
|
8567
9837
|
def type
|
8568
9838
|
:keyword_parameter_node
|
8569
9839
|
end
|
9840
|
+
|
9841
|
+
# Similar to #type, this method returns a symbol that you can use for
|
9842
|
+
# splitting on the type of the node without having to do a long === chain.
|
9843
|
+
# Note that like #type, it will still be slower than using == for a single
|
9844
|
+
# class, but should be faster in a case statement or an array comparison.
|
9845
|
+
#
|
9846
|
+
# def self.type: () -> Symbol
|
9847
|
+
def self.type
|
9848
|
+
:keyword_parameter_node
|
9849
|
+
end
|
8570
9850
|
end
|
8571
9851
|
|
8572
9852
|
# Represents a keyword rest parameter to a method, block, or lambda definition.
|
@@ -8660,6 +9940,16 @@ module Prism
|
|
8660
9940
|
def type
|
8661
9941
|
:keyword_rest_parameter_node
|
8662
9942
|
end
|
9943
|
+
|
9944
|
+
# Similar to #type, this method returns a symbol that you can use for
|
9945
|
+
# splitting on the type of the node without having to do a long === chain.
|
9946
|
+
# Note that like #type, it will still be slower than using == for a single
|
9947
|
+
# class, but should be faster in a case statement or an array comparison.
|
9948
|
+
#
|
9949
|
+
# def self.type: () -> Symbol
|
9950
|
+
def self.type
|
9951
|
+
:keyword_rest_parameter_node
|
9952
|
+
end
|
8663
9953
|
end
|
8664
9954
|
|
8665
9955
|
# Represents using a lambda literal (not the lambda method call).
|
@@ -8793,6 +10083,16 @@ module Prism
|
|
8793
10083
|
def type
|
8794
10084
|
:lambda_node
|
8795
10085
|
end
|
10086
|
+
|
10087
|
+
# Similar to #type, this method returns a symbol that you can use for
|
10088
|
+
# splitting on the type of the node without having to do a long === chain.
|
10089
|
+
# Note that like #type, it will still be slower than using == for a single
|
10090
|
+
# class, but should be faster in a case statement or an array comparison.
|
10091
|
+
#
|
10092
|
+
# def self.type: () -> Symbol
|
10093
|
+
def self.type
|
10094
|
+
:lambda_node
|
10095
|
+
end
|
8796
10096
|
end
|
8797
10097
|
|
8798
10098
|
# Represents the use of the `&&=` operator for assignment to a local variable.
|
@@ -8898,6 +10198,16 @@ module Prism
|
|
8898
10198
|
def type
|
8899
10199
|
:local_variable_and_write_node
|
8900
10200
|
end
|
10201
|
+
|
10202
|
+
# Similar to #type, this method returns a symbol that you can use for
|
10203
|
+
# splitting on the type of the node without having to do a long === chain.
|
10204
|
+
# Note that like #type, it will still be slower than using == for a single
|
10205
|
+
# class, but should be faster in a case statement or an array comparison.
|
10206
|
+
#
|
10207
|
+
# def self.type: () -> Symbol
|
10208
|
+
def self.type
|
10209
|
+
:local_variable_and_write_node
|
10210
|
+
end
|
8901
10211
|
end
|
8902
10212
|
|
8903
10213
|
# Represents assigning to a local variable using an operator that isn't `=`.
|
@@ -9004,6 +10314,16 @@ module Prism
|
|
9004
10314
|
def type
|
9005
10315
|
:local_variable_operator_write_node
|
9006
10316
|
end
|
10317
|
+
|
10318
|
+
# Similar to #type, this method returns a symbol that you can use for
|
10319
|
+
# splitting on the type of the node without having to do a long === chain.
|
10320
|
+
# Note that like #type, it will still be slower than using == for a single
|
10321
|
+
# class, but should be faster in a case statement or an array comparison.
|
10322
|
+
#
|
10323
|
+
# def self.type: () -> Symbol
|
10324
|
+
def self.type
|
10325
|
+
:local_variable_operator_write_node
|
10326
|
+
end
|
9007
10327
|
end
|
9008
10328
|
|
9009
10329
|
# Represents the use of the `||=` operator for assignment to a local variable.
|
@@ -9109,6 +10429,16 @@ module Prism
|
|
9109
10429
|
def type
|
9110
10430
|
:local_variable_or_write_node
|
9111
10431
|
end
|
10432
|
+
|
10433
|
+
# Similar to #type, this method returns a symbol that you can use for
|
10434
|
+
# splitting on the type of the node without having to do a long === chain.
|
10435
|
+
# Note that like #type, it will still be slower than using == for a single
|
10436
|
+
# class, but should be faster in a case statement or an array comparison.
|
10437
|
+
#
|
10438
|
+
# def self.type: () -> Symbol
|
10439
|
+
def self.type
|
10440
|
+
:local_variable_or_write_node
|
10441
|
+
end
|
9112
10442
|
end
|
9113
10443
|
|
9114
10444
|
# Represents reading a local variable. Note that this requires that a local
|
@@ -9192,6 +10522,16 @@ module Prism
|
|
9192
10522
|
def type
|
9193
10523
|
:local_variable_read_node
|
9194
10524
|
end
|
10525
|
+
|
10526
|
+
# Similar to #type, this method returns a symbol that you can use for
|
10527
|
+
# splitting on the type of the node without having to do a long === chain.
|
10528
|
+
# Note that like #type, it will still be slower than using == for a single
|
10529
|
+
# class, but should be faster in a case statement or an array comparison.
|
10530
|
+
#
|
10531
|
+
# def self.type: () -> Symbol
|
10532
|
+
def self.type
|
10533
|
+
:local_variable_read_node
|
10534
|
+
end
|
9195
10535
|
end
|
9196
10536
|
|
9197
10537
|
# Represents writing to a local variable in a context that doesn't have an explicit value.
|
@@ -9273,6 +10613,16 @@ module Prism
|
|
9273
10613
|
def type
|
9274
10614
|
:local_variable_target_node
|
9275
10615
|
end
|
10616
|
+
|
10617
|
+
# Similar to #type, this method returns a symbol that you can use for
|
10618
|
+
# splitting on the type of the node without having to do a long === chain.
|
10619
|
+
# Note that like #type, it will still be slower than using == for a single
|
10620
|
+
# class, but should be faster in a case statement or an array comparison.
|
10621
|
+
#
|
10622
|
+
# def self.type: () -> Symbol
|
10623
|
+
def self.type
|
10624
|
+
:local_variable_target_node
|
10625
|
+
end
|
9276
10626
|
end
|
9277
10627
|
|
9278
10628
|
# Represents writing to a local variable.
|
@@ -9378,6 +10728,16 @@ module Prism
|
|
9378
10728
|
def type
|
9379
10729
|
:local_variable_write_node
|
9380
10730
|
end
|
10731
|
+
|
10732
|
+
# Similar to #type, this method returns a symbol that you can use for
|
10733
|
+
# splitting on the type of the node without having to do a long === chain.
|
10734
|
+
# Note that like #type, it will still be slower than using == for a single
|
10735
|
+
# class, but should be faster in a case statement or an array comparison.
|
10736
|
+
#
|
10737
|
+
# def self.type: () -> Symbol
|
10738
|
+
def self.type
|
10739
|
+
:local_variable_write_node
|
10740
|
+
end
|
9381
10741
|
end
|
9382
10742
|
|
9383
10743
|
# Represents a regular expression literal used in the predicate of a
|
@@ -9482,6 +10842,11 @@ module Prism
|
|
9482
10842
|
flags.anybits?(RegularExpressionFlags::MULTI_LINE)
|
9483
10843
|
end
|
9484
10844
|
|
10845
|
+
# def once?: () -> bool
|
10846
|
+
def once?
|
10847
|
+
flags.anybits?(RegularExpressionFlags::ONCE)
|
10848
|
+
end
|
10849
|
+
|
9485
10850
|
# def euc_jp?: () -> bool
|
9486
10851
|
def euc_jp?
|
9487
10852
|
flags.anybits?(RegularExpressionFlags::EUC_JP)
|
@@ -9502,18 +10867,13 @@ module Prism
|
|
9502
10867
|
flags.anybits?(RegularExpressionFlags::UTF_8)
|
9503
10868
|
end
|
9504
10869
|
|
9505
|
-
# def once?: () -> bool
|
9506
|
-
def once?
|
9507
|
-
flags.anybits?(RegularExpressionFlags::ONCE)
|
9508
|
-
end
|
9509
|
-
|
9510
10870
|
def inspect(inspector = NodeInspector.new)
|
9511
10871
|
inspector << inspector.header(self)
|
9512
10872
|
inspector << "├── opening_loc: #{inspector.location(opening_loc)}\n"
|
9513
10873
|
inspector << "├── content_loc: #{inspector.location(content_loc)}\n"
|
9514
10874
|
inspector << "├── closing_loc: #{inspector.location(closing_loc)}\n"
|
9515
10875
|
inspector << "├── unescaped: #{unescaped.inspect}\n"
|
9516
|
-
flags = [("ignore_case" if ignore_case?), ("extended" if extended?), ("multi_line" if multi_line?), ("
|
10876
|
+
flags = [("ignore_case" if ignore_case?), ("extended" if extended?), ("multi_line" if multi_line?), ("once" if once?), ("euc_jp" if euc_jp?), ("ascii_8bit" if ascii_8bit?), ("windows_31j" if windows_31j?), ("utf_8" if utf_8?)].compact
|
9517
10877
|
inspector << "└── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n"
|
9518
10878
|
inspector.to_str
|
9519
10879
|
end
|
@@ -9535,6 +10895,16 @@ module Prism
|
|
9535
10895
|
def type
|
9536
10896
|
:match_last_line_node
|
9537
10897
|
end
|
10898
|
+
|
10899
|
+
# Similar to #type, this method returns a symbol that you can use for
|
10900
|
+
# splitting on the type of the node without having to do a long === chain.
|
10901
|
+
# Note that like #type, it will still be slower than using == for a single
|
10902
|
+
# class, but should be faster in a case statement or an array comparison.
|
10903
|
+
#
|
10904
|
+
# def self.type: () -> Symbol
|
10905
|
+
def self.type
|
10906
|
+
:match_last_line_node
|
10907
|
+
end
|
9538
10908
|
end
|
9539
10909
|
|
9540
10910
|
# Represents the use of the modifier `in` operator.
|
@@ -9629,6 +10999,16 @@ module Prism
|
|
9629
10999
|
def type
|
9630
11000
|
:match_predicate_node
|
9631
11001
|
end
|
11002
|
+
|
11003
|
+
# Similar to #type, this method returns a symbol that you can use for
|
11004
|
+
# splitting on the type of the node without having to do a long === chain.
|
11005
|
+
# Note that like #type, it will still be slower than using == for a single
|
11006
|
+
# class, but should be faster in a case statement or an array comparison.
|
11007
|
+
#
|
11008
|
+
# def self.type: () -> Symbol
|
11009
|
+
def self.type
|
11010
|
+
:match_predicate_node
|
11011
|
+
end
|
9632
11012
|
end
|
9633
11013
|
|
9634
11014
|
# Represents the use of the `=>` operator.
|
@@ -9723,6 +11103,16 @@ module Prism
|
|
9723
11103
|
def type
|
9724
11104
|
:match_required_node
|
9725
11105
|
end
|
11106
|
+
|
11107
|
+
# Similar to #type, this method returns a symbol that you can use for
|
11108
|
+
# splitting on the type of the node without having to do a long === chain.
|
11109
|
+
# Note that like #type, it will still be slower than using == for a single
|
11110
|
+
# class, but should be faster in a case statement or an array comparison.
|
11111
|
+
#
|
11112
|
+
# def self.type: () -> Symbol
|
11113
|
+
def self.type
|
11114
|
+
:match_required_node
|
11115
|
+
end
|
9726
11116
|
end
|
9727
11117
|
|
9728
11118
|
# Represents writing local variables using a regular expression match with
|
@@ -9806,6 +11196,16 @@ module Prism
|
|
9806
11196
|
def type
|
9807
11197
|
:match_write_node
|
9808
11198
|
end
|
11199
|
+
|
11200
|
+
# Similar to #type, this method returns a symbol that you can use for
|
11201
|
+
# splitting on the type of the node without having to do a long === chain.
|
11202
|
+
# Note that like #type, it will still be slower than using == for a single
|
11203
|
+
# class, but should be faster in a case statement or an array comparison.
|
11204
|
+
#
|
11205
|
+
# def self.type: () -> Symbol
|
11206
|
+
def self.type
|
11207
|
+
:match_write_node
|
11208
|
+
end
|
9809
11209
|
end
|
9810
11210
|
|
9811
11211
|
# Represents a node that is missing from the source and results in a syntax
|
@@ -9873,6 +11273,16 @@ module Prism
|
|
9873
11273
|
def type
|
9874
11274
|
:missing_node
|
9875
11275
|
end
|
11276
|
+
|
11277
|
+
# Similar to #type, this method returns a symbol that you can use for
|
11278
|
+
# splitting on the type of the node without having to do a long === chain.
|
11279
|
+
# Note that like #type, it will still be slower than using == for a single
|
11280
|
+
# class, but should be faster in a case statement or an array comparison.
|
11281
|
+
#
|
11282
|
+
# def self.type: () -> Symbol
|
11283
|
+
def self.type
|
11284
|
+
:missing_node
|
11285
|
+
end
|
9876
11286
|
end
|
9877
11287
|
|
9878
11288
|
# Represents a module declaration involving the `module` keyword.
|
@@ -9997,6 +11407,16 @@ module Prism
|
|
9997
11407
|
def type
|
9998
11408
|
:module_node
|
9999
11409
|
end
|
11410
|
+
|
11411
|
+
# Similar to #type, this method returns a symbol that you can use for
|
11412
|
+
# splitting on the type of the node without having to do a long === chain.
|
11413
|
+
# Note that like #type, it will still be slower than using == for a single
|
11414
|
+
# class, but should be faster in a case statement or an array comparison.
|
11415
|
+
#
|
11416
|
+
# def self.type: () -> Symbol
|
11417
|
+
def self.type
|
11418
|
+
:module_node
|
11419
|
+
end
|
10000
11420
|
end
|
10001
11421
|
|
10002
11422
|
# Represents a multi-target expression.
|
@@ -10094,6 +11514,16 @@ module Prism
|
|
10094
11514
|
def type
|
10095
11515
|
:multi_target_node
|
10096
11516
|
end
|
11517
|
+
|
11518
|
+
# Similar to #type, this method returns a symbol that you can use for
|
11519
|
+
# splitting on the type of the node without having to do a long === chain.
|
11520
|
+
# Note that like #type, it will still be slower than using == for a single
|
11521
|
+
# class, but should be faster in a case statement or an array comparison.
|
11522
|
+
#
|
11523
|
+
# def self.type: () -> Symbol
|
11524
|
+
def self.type
|
11525
|
+
:multi_target_node
|
11526
|
+
end
|
10097
11527
|
end
|
10098
11528
|
|
10099
11529
|
# Represents a write to a multi-target expression.
|
@@ -10209,6 +11639,16 @@ module Prism
|
|
10209
11639
|
def type
|
10210
11640
|
:multi_write_node
|
10211
11641
|
end
|
11642
|
+
|
11643
|
+
# Similar to #type, this method returns a symbol that you can use for
|
11644
|
+
# splitting on the type of the node without having to do a long === chain.
|
11645
|
+
# Note that like #type, it will still be slower than using == for a single
|
11646
|
+
# class, but should be faster in a case statement or an array comparison.
|
11647
|
+
#
|
11648
|
+
# def self.type: () -> Symbol
|
11649
|
+
def self.type
|
11650
|
+
:multi_write_node
|
11651
|
+
end
|
10212
11652
|
end
|
10213
11653
|
|
10214
11654
|
# Represents the use of the `next` keyword.
|
@@ -10302,6 +11742,16 @@ module Prism
|
|
10302
11742
|
def type
|
10303
11743
|
:next_node
|
10304
11744
|
end
|
11745
|
+
|
11746
|
+
# Similar to #type, this method returns a symbol that you can use for
|
11747
|
+
# splitting on the type of the node without having to do a long === chain.
|
11748
|
+
# Note that like #type, it will still be slower than using == for a single
|
11749
|
+
# class, but should be faster in a case statement or an array comparison.
|
11750
|
+
#
|
11751
|
+
# def self.type: () -> Symbol
|
11752
|
+
def self.type
|
11753
|
+
:next_node
|
11754
|
+
end
|
10305
11755
|
end
|
10306
11756
|
|
10307
11757
|
# Represents the use of the `nil` keyword.
|
@@ -10371,6 +11821,16 @@ module Prism
|
|
10371
11821
|
def type
|
10372
11822
|
:nil_node
|
10373
11823
|
end
|
11824
|
+
|
11825
|
+
# Similar to #type, this method returns a symbol that you can use for
|
11826
|
+
# splitting on the type of the node without having to do a long === chain.
|
11827
|
+
# Note that like #type, it will still be slower than using == for a single
|
11828
|
+
# class, but should be faster in a case statement or an array comparison.
|
11829
|
+
#
|
11830
|
+
# def self.type: () -> Symbol
|
11831
|
+
def self.type
|
11832
|
+
:nil_node
|
11833
|
+
end
|
10374
11834
|
end
|
10375
11835
|
|
10376
11836
|
# Represents the use of `**nil` inside method arguments.
|
@@ -10463,6 +11923,16 @@ module Prism
|
|
10463
11923
|
def type
|
10464
11924
|
:no_keywords_parameter_node
|
10465
11925
|
end
|
11926
|
+
|
11927
|
+
# Similar to #type, this method returns a symbol that you can use for
|
11928
|
+
# splitting on the type of the node without having to do a long === chain.
|
11929
|
+
# Note that like #type, it will still be slower than using == for a single
|
11930
|
+
# class, but should be faster in a case statement or an array comparison.
|
11931
|
+
#
|
11932
|
+
# def self.type: () -> Symbol
|
11933
|
+
def self.type
|
11934
|
+
:no_keywords_parameter_node
|
11935
|
+
end
|
10466
11936
|
end
|
10467
11937
|
|
10468
11938
|
# Represents reading a numbered reference to a capture in the previous match.
|
@@ -10538,6 +12008,16 @@ module Prism
|
|
10538
12008
|
def type
|
10539
12009
|
:numbered_reference_read_node
|
10540
12010
|
end
|
12011
|
+
|
12012
|
+
# Similar to #type, this method returns a symbol that you can use for
|
12013
|
+
# splitting on the type of the node without having to do a long === chain.
|
12014
|
+
# Note that like #type, it will still be slower than using == for a single
|
12015
|
+
# class, but should be faster in a case statement or an array comparison.
|
12016
|
+
#
|
12017
|
+
# def self.type: () -> Symbol
|
12018
|
+
def self.type
|
12019
|
+
:numbered_reference_read_node
|
12020
|
+
end
|
10541
12021
|
end
|
10542
12022
|
|
10543
12023
|
# Represents an optional parameter to a method, block, or lambda definition.
|
@@ -10638,6 +12118,16 @@ module Prism
|
|
10638
12118
|
def type
|
10639
12119
|
:optional_parameter_node
|
10640
12120
|
end
|
12121
|
+
|
12122
|
+
# Similar to #type, this method returns a symbol that you can use for
|
12123
|
+
# splitting on the type of the node without having to do a long === chain.
|
12124
|
+
# Note that like #type, it will still be slower than using == for a single
|
12125
|
+
# class, but should be faster in a case statement or an array comparison.
|
12126
|
+
#
|
12127
|
+
# def self.type: () -> Symbol
|
12128
|
+
def self.type
|
12129
|
+
:optional_parameter_node
|
12130
|
+
end
|
10641
12131
|
end
|
10642
12132
|
|
10643
12133
|
# Represents the use of the `||` operator or the `or` keyword.
|
@@ -10732,6 +12222,16 @@ module Prism
|
|
10732
12222
|
def type
|
10733
12223
|
:or_node
|
10734
12224
|
end
|
12225
|
+
|
12226
|
+
# Similar to #type, this method returns a symbol that you can use for
|
12227
|
+
# splitting on the type of the node without having to do a long === chain.
|
12228
|
+
# Note that like #type, it will still be slower than using == for a single
|
12229
|
+
# class, but should be faster in a case statement or an array comparison.
|
12230
|
+
#
|
12231
|
+
# def self.type: () -> Symbol
|
12232
|
+
def self.type
|
12233
|
+
:or_node
|
12234
|
+
end
|
10735
12235
|
end
|
10736
12236
|
|
10737
12237
|
# Represents the list of parameters on a method, block, or lambda definition.
|
@@ -10867,6 +12367,16 @@ module Prism
|
|
10867
12367
|
def type
|
10868
12368
|
:parameters_node
|
10869
12369
|
end
|
12370
|
+
|
12371
|
+
# Similar to #type, this method returns a symbol that you can use for
|
12372
|
+
# splitting on the type of the node without having to do a long === chain.
|
12373
|
+
# Note that like #type, it will still be slower than using == for a single
|
12374
|
+
# class, but should be faster in a case statement or an array comparison.
|
12375
|
+
#
|
12376
|
+
# def self.type: () -> Symbol
|
12377
|
+
def self.type
|
12378
|
+
:parameters_node
|
12379
|
+
end
|
10870
12380
|
end
|
10871
12381
|
|
10872
12382
|
# Represents a parenthesized expression
|
@@ -10975,6 +12485,16 @@ module Prism
|
|
10975
12485
|
def type
|
10976
12486
|
:parentheses_node
|
10977
12487
|
end
|
12488
|
+
|
12489
|
+
# Similar to #type, this method returns a symbol that you can use for
|
12490
|
+
# splitting on the type of the node without having to do a long === chain.
|
12491
|
+
# Note that like #type, it will still be slower than using == for a single
|
12492
|
+
# class, but should be faster in a case statement or an array comparison.
|
12493
|
+
#
|
12494
|
+
# def self.type: () -> Symbol
|
12495
|
+
def self.type
|
12496
|
+
:parentheses_node
|
12497
|
+
end
|
10978
12498
|
end
|
10979
12499
|
|
10980
12500
|
# Represents the use of the `^` operator for pinning an expression in a
|
@@ -11085,6 +12605,16 @@ module Prism
|
|
11085
12605
|
def type
|
11086
12606
|
:pinned_expression_node
|
11087
12607
|
end
|
12608
|
+
|
12609
|
+
# Similar to #type, this method returns a symbol that you can use for
|
12610
|
+
# splitting on the type of the node without having to do a long === chain.
|
12611
|
+
# Note that like #type, it will still be slower than using == for a single
|
12612
|
+
# class, but should be faster in a case statement or an array comparison.
|
12613
|
+
#
|
12614
|
+
# def self.type: () -> Symbol
|
12615
|
+
def self.type
|
12616
|
+
:pinned_expression_node
|
12617
|
+
end
|
11088
12618
|
end
|
11089
12619
|
|
11090
12620
|
# Represents the use of the `^` operator for pinning a variable in a pattern
|
@@ -11173,6 +12703,16 @@ module Prism
|
|
11173
12703
|
def type
|
11174
12704
|
:pinned_variable_node
|
11175
12705
|
end
|
12706
|
+
|
12707
|
+
# Similar to #type, this method returns a symbol that you can use for
|
12708
|
+
# splitting on the type of the node without having to do a long === chain.
|
12709
|
+
# Note that like #type, it will still be slower than using == for a single
|
12710
|
+
# class, but should be faster in a case statement or an array comparison.
|
12711
|
+
#
|
12712
|
+
# def self.type: () -> Symbol
|
12713
|
+
def self.type
|
12714
|
+
:pinned_variable_node
|
12715
|
+
end
|
11176
12716
|
end
|
11177
12717
|
|
11178
12718
|
# Represents the use of the `END` keyword.
|
@@ -11288,6 +12828,16 @@ module Prism
|
|
11288
12828
|
def type
|
11289
12829
|
:post_execution_node
|
11290
12830
|
end
|
12831
|
+
|
12832
|
+
# Similar to #type, this method returns a symbol that you can use for
|
12833
|
+
# splitting on the type of the node without having to do a long === chain.
|
12834
|
+
# Note that like #type, it will still be slower than using == for a single
|
12835
|
+
# class, but should be faster in a case statement or an array comparison.
|
12836
|
+
#
|
12837
|
+
# def self.type: () -> Symbol
|
12838
|
+
def self.type
|
12839
|
+
:post_execution_node
|
12840
|
+
end
|
11291
12841
|
end
|
11292
12842
|
|
11293
12843
|
# Represents the use of the `BEGIN` keyword.
|
@@ -11403,6 +12953,16 @@ module Prism
|
|
11403
12953
|
def type
|
11404
12954
|
:pre_execution_node
|
11405
12955
|
end
|
12956
|
+
|
12957
|
+
# Similar to #type, this method returns a symbol that you can use for
|
12958
|
+
# splitting on the type of the node without having to do a long === chain.
|
12959
|
+
# Note that like #type, it will still be slower than using == for a single
|
12960
|
+
# class, but should be faster in a case statement or an array comparison.
|
12961
|
+
#
|
12962
|
+
# def self.type: () -> Symbol
|
12963
|
+
def self.type
|
12964
|
+
:pre_execution_node
|
12965
|
+
end
|
11406
12966
|
end
|
11407
12967
|
|
11408
12968
|
# The top level node of any parse tree.
|
@@ -11482,6 +13042,16 @@ module Prism
|
|
11482
13042
|
def type
|
11483
13043
|
:program_node
|
11484
13044
|
end
|
13045
|
+
|
13046
|
+
# Similar to #type, this method returns a symbol that you can use for
|
13047
|
+
# splitting on the type of the node without having to do a long === chain.
|
13048
|
+
# Note that like #type, it will still be slower than using == for a single
|
13049
|
+
# class, but should be faster in a case statement or an array comparison.
|
13050
|
+
#
|
13051
|
+
# def self.type: () -> Symbol
|
13052
|
+
def self.type
|
13053
|
+
:program_node
|
13054
|
+
end
|
11485
13055
|
end
|
11486
13056
|
|
11487
13057
|
# Represents the use of the `..` or `...` operators.
|
@@ -11602,6 +13172,16 @@ module Prism
|
|
11602
13172
|
def type
|
11603
13173
|
:range_node
|
11604
13174
|
end
|
13175
|
+
|
13176
|
+
# Similar to #type, this method returns a symbol that you can use for
|
13177
|
+
# splitting on the type of the node without having to do a long === chain.
|
13178
|
+
# Note that like #type, it will still be slower than using == for a single
|
13179
|
+
# class, but should be faster in a case statement or an array comparison.
|
13180
|
+
#
|
13181
|
+
# def self.type: () -> Symbol
|
13182
|
+
def self.type
|
13183
|
+
:range_node
|
13184
|
+
end
|
11605
13185
|
end
|
11606
13186
|
|
11607
13187
|
# Represents a rational number literal.
|
@@ -11678,6 +13258,16 @@ module Prism
|
|
11678
13258
|
def type
|
11679
13259
|
:rational_node
|
11680
13260
|
end
|
13261
|
+
|
13262
|
+
# Similar to #type, this method returns a symbol that you can use for
|
13263
|
+
# splitting on the type of the node without having to do a long === chain.
|
13264
|
+
# Note that like #type, it will still be slower than using == for a single
|
13265
|
+
# class, but should be faster in a case statement or an array comparison.
|
13266
|
+
#
|
13267
|
+
# def self.type: () -> Symbol
|
13268
|
+
def self.type
|
13269
|
+
:rational_node
|
13270
|
+
end
|
11681
13271
|
end
|
11682
13272
|
|
11683
13273
|
# Represents the use of the `redo` keyword.
|
@@ -11747,6 +13337,16 @@ module Prism
|
|
11747
13337
|
def type
|
11748
13338
|
:redo_node
|
11749
13339
|
end
|
13340
|
+
|
13341
|
+
# Similar to #type, this method returns a symbol that you can use for
|
13342
|
+
# splitting on the type of the node without having to do a long === chain.
|
13343
|
+
# Note that like #type, it will still be slower than using == for a single
|
13344
|
+
# class, but should be faster in a case statement or an array comparison.
|
13345
|
+
#
|
13346
|
+
# def self.type: () -> Symbol
|
13347
|
+
def self.type
|
13348
|
+
:redo_node
|
13349
|
+
end
|
11750
13350
|
end
|
11751
13351
|
|
11752
13352
|
# Represents a regular expression literal with no interpolation.
|
@@ -11849,6 +13449,11 @@ module Prism
|
|
11849
13449
|
flags.anybits?(RegularExpressionFlags::MULTI_LINE)
|
11850
13450
|
end
|
11851
13451
|
|
13452
|
+
# def once?: () -> bool
|
13453
|
+
def once?
|
13454
|
+
flags.anybits?(RegularExpressionFlags::ONCE)
|
13455
|
+
end
|
13456
|
+
|
11852
13457
|
# def euc_jp?: () -> bool
|
11853
13458
|
def euc_jp?
|
11854
13459
|
flags.anybits?(RegularExpressionFlags::EUC_JP)
|
@@ -11869,18 +13474,13 @@ module Prism
|
|
11869
13474
|
flags.anybits?(RegularExpressionFlags::UTF_8)
|
11870
13475
|
end
|
11871
13476
|
|
11872
|
-
# def once?: () -> bool
|
11873
|
-
def once?
|
11874
|
-
flags.anybits?(RegularExpressionFlags::ONCE)
|
11875
|
-
end
|
11876
|
-
|
11877
13477
|
def inspect(inspector = NodeInspector.new)
|
11878
13478
|
inspector << inspector.header(self)
|
11879
13479
|
inspector << "├── opening_loc: #{inspector.location(opening_loc)}\n"
|
11880
13480
|
inspector << "├── content_loc: #{inspector.location(content_loc)}\n"
|
11881
13481
|
inspector << "├── closing_loc: #{inspector.location(closing_loc)}\n"
|
11882
13482
|
inspector << "├── unescaped: #{unescaped.inspect}\n"
|
11883
|
-
flags = [("ignore_case" if ignore_case?), ("extended" if extended?), ("multi_line" if multi_line?), ("
|
13483
|
+
flags = [("ignore_case" if ignore_case?), ("extended" if extended?), ("multi_line" if multi_line?), ("once" if once?), ("euc_jp" if euc_jp?), ("ascii_8bit" if ascii_8bit?), ("windows_31j" if windows_31j?), ("utf_8" if utf_8?)].compact
|
11884
13484
|
inspector << "└── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n"
|
11885
13485
|
inspector.to_str
|
11886
13486
|
end
|
@@ -11902,6 +13502,16 @@ module Prism
|
|
11902
13502
|
def type
|
11903
13503
|
:regular_expression_node
|
11904
13504
|
end
|
13505
|
+
|
13506
|
+
# Similar to #type, this method returns a symbol that you can use for
|
13507
|
+
# splitting on the type of the node without having to do a long === chain.
|
13508
|
+
# Note that like #type, it will still be slower than using == for a single
|
13509
|
+
# class, but should be faster in a case statement or an array comparison.
|
13510
|
+
#
|
13511
|
+
# def self.type: () -> Symbol
|
13512
|
+
def self.type
|
13513
|
+
:regular_expression_node
|
13514
|
+
end
|
11905
13515
|
end
|
11906
13516
|
|
11907
13517
|
# Represents a destructured required parameter node.
|
@@ -12000,6 +13610,16 @@ module Prism
|
|
12000
13610
|
def type
|
12001
13611
|
:required_destructured_parameter_node
|
12002
13612
|
end
|
13613
|
+
|
13614
|
+
# Similar to #type, this method returns a symbol that you can use for
|
13615
|
+
# splitting on the type of the node without having to do a long === chain.
|
13616
|
+
# Note that like #type, it will still be slower than using == for a single
|
13617
|
+
# class, but should be faster in a case statement or an array comparison.
|
13618
|
+
#
|
13619
|
+
# def self.type: () -> Symbol
|
13620
|
+
def self.type
|
13621
|
+
:required_destructured_parameter_node
|
13622
|
+
end
|
12003
13623
|
end
|
12004
13624
|
|
12005
13625
|
# Represents a required parameter to a method, block, or lambda definition.
|
@@ -12076,6 +13696,16 @@ module Prism
|
|
12076
13696
|
def type
|
12077
13697
|
:required_parameter_node
|
12078
13698
|
end
|
13699
|
+
|
13700
|
+
# Similar to #type, this method returns a symbol that you can use for
|
13701
|
+
# splitting on the type of the node without having to do a long === chain.
|
13702
|
+
# Note that like #type, it will still be slower than using == for a single
|
13703
|
+
# class, but should be faster in a case statement or an array comparison.
|
13704
|
+
#
|
13705
|
+
# def self.type: () -> Symbol
|
13706
|
+
def self.type
|
13707
|
+
:required_parameter_node
|
13708
|
+
end
|
12079
13709
|
end
|
12080
13710
|
|
12081
13711
|
# Represents an expression modified with a rescue.
|
@@ -12174,6 +13804,16 @@ module Prism
|
|
12174
13804
|
def type
|
12175
13805
|
:rescue_modifier_node
|
12176
13806
|
end
|
13807
|
+
|
13808
|
+
# Similar to #type, this method returns a symbol that you can use for
|
13809
|
+
# splitting on the type of the node without having to do a long === chain.
|
13810
|
+
# Note that like #type, it will still be slower than using == for a single
|
13811
|
+
# class, but should be faster in a case statement or an array comparison.
|
13812
|
+
#
|
13813
|
+
# def self.type: () -> Symbol
|
13814
|
+
def self.type
|
13815
|
+
:rescue_modifier_node
|
13816
|
+
end
|
12177
13817
|
end
|
12178
13818
|
|
12179
13819
|
# Represents a rescue statement.
|
@@ -12315,6 +13955,16 @@ module Prism
|
|
12315
13955
|
def type
|
12316
13956
|
:rescue_node
|
12317
13957
|
end
|
13958
|
+
|
13959
|
+
# Similar to #type, this method returns a symbol that you can use for
|
13960
|
+
# splitting on the type of the node without having to do a long === chain.
|
13961
|
+
# Note that like #type, it will still be slower than using == for a single
|
13962
|
+
# class, but should be faster in a case statement or an array comparison.
|
13963
|
+
#
|
13964
|
+
# def self.type: () -> Symbol
|
13965
|
+
def self.type
|
13966
|
+
:rescue_node
|
13967
|
+
end
|
12318
13968
|
end
|
12319
13969
|
|
12320
13970
|
# Represents a rest parameter to a method, block, or lambda definition.
|
@@ -12408,6 +14058,16 @@ module Prism
|
|
12408
14058
|
def type
|
12409
14059
|
:rest_parameter_node
|
12410
14060
|
end
|
14061
|
+
|
14062
|
+
# Similar to #type, this method returns a symbol that you can use for
|
14063
|
+
# splitting on the type of the node without having to do a long === chain.
|
14064
|
+
# Note that like #type, it will still be slower than using == for a single
|
14065
|
+
# class, but should be faster in a case statement or an array comparison.
|
14066
|
+
#
|
14067
|
+
# def self.type: () -> Symbol
|
14068
|
+
def self.type
|
14069
|
+
:rest_parameter_node
|
14070
|
+
end
|
12411
14071
|
end
|
12412
14072
|
|
12413
14073
|
# Represents the use of the `retry` keyword.
|
@@ -12477,6 +14137,16 @@ module Prism
|
|
12477
14137
|
def type
|
12478
14138
|
:retry_node
|
12479
14139
|
end
|
14140
|
+
|
14141
|
+
# Similar to #type, this method returns a symbol that you can use for
|
14142
|
+
# splitting on the type of the node without having to do a long === chain.
|
14143
|
+
# Note that like #type, it will still be slower than using == for a single
|
14144
|
+
# class, but should be faster in a case statement or an array comparison.
|
14145
|
+
#
|
14146
|
+
# def self.type: () -> Symbol
|
14147
|
+
def self.type
|
14148
|
+
:retry_node
|
14149
|
+
end
|
12480
14150
|
end
|
12481
14151
|
|
12482
14152
|
# Represents the use of the `return` keyword.
|
@@ -12570,6 +14240,16 @@ module Prism
|
|
12570
14240
|
def type
|
12571
14241
|
:return_node
|
12572
14242
|
end
|
14243
|
+
|
14244
|
+
# Similar to #type, this method returns a symbol that you can use for
|
14245
|
+
# splitting on the type of the node without having to do a long === chain.
|
14246
|
+
# Note that like #type, it will still be slower than using == for a single
|
14247
|
+
# class, but should be faster in a case statement or an array comparison.
|
14248
|
+
#
|
14249
|
+
# def self.type: () -> Symbol
|
14250
|
+
def self.type
|
14251
|
+
:return_node
|
14252
|
+
end
|
12573
14253
|
end
|
12574
14254
|
|
12575
14255
|
# Represents the `self` keyword.
|
@@ -12639,6 +14319,16 @@ module Prism
|
|
12639
14319
|
def type
|
12640
14320
|
:self_node
|
12641
14321
|
end
|
14322
|
+
|
14323
|
+
# Similar to #type, this method returns a symbol that you can use for
|
14324
|
+
# splitting on the type of the node without having to do a long === chain.
|
14325
|
+
# Note that like #type, it will still be slower than using == for a single
|
14326
|
+
# class, but should be faster in a case statement or an array comparison.
|
14327
|
+
#
|
14328
|
+
# def self.type: () -> Symbol
|
14329
|
+
def self.type
|
14330
|
+
:self_node
|
14331
|
+
end
|
12642
14332
|
end
|
12643
14333
|
|
12644
14334
|
# Represents a singleton class declaration involving the `class` keyword.
|
@@ -12768,6 +14458,16 @@ module Prism
|
|
12768
14458
|
def type
|
12769
14459
|
:singleton_class_node
|
12770
14460
|
end
|
14461
|
+
|
14462
|
+
# Similar to #type, this method returns a symbol that you can use for
|
14463
|
+
# splitting on the type of the node without having to do a long === chain.
|
14464
|
+
# Note that like #type, it will still be slower than using == for a single
|
14465
|
+
# class, but should be faster in a case statement or an array comparison.
|
14466
|
+
#
|
14467
|
+
# def self.type: () -> Symbol
|
14468
|
+
def self.type
|
14469
|
+
:singleton_class_node
|
14470
|
+
end
|
12771
14471
|
end
|
12772
14472
|
|
12773
14473
|
# Represents the use of the `__ENCODING__` keyword.
|
@@ -12837,6 +14537,16 @@ module Prism
|
|
12837
14537
|
def type
|
12838
14538
|
:source_encoding_node
|
12839
14539
|
end
|
14540
|
+
|
14541
|
+
# Similar to #type, this method returns a symbol that you can use for
|
14542
|
+
# splitting on the type of the node without having to do a long === chain.
|
14543
|
+
# Note that like #type, it will still be slower than using == for a single
|
14544
|
+
# class, but should be faster in a case statement or an array comparison.
|
14545
|
+
#
|
14546
|
+
# def self.type: () -> Symbol
|
14547
|
+
def self.type
|
14548
|
+
:source_encoding_node
|
14549
|
+
end
|
12840
14550
|
end
|
12841
14551
|
|
12842
14552
|
# Represents the use of the `__FILE__` keyword.
|
@@ -12912,6 +14622,16 @@ module Prism
|
|
12912
14622
|
def type
|
12913
14623
|
:source_file_node
|
12914
14624
|
end
|
14625
|
+
|
14626
|
+
# Similar to #type, this method returns a symbol that you can use for
|
14627
|
+
# splitting on the type of the node without having to do a long === chain.
|
14628
|
+
# Note that like #type, it will still be slower than using == for a single
|
14629
|
+
# class, but should be faster in a case statement or an array comparison.
|
14630
|
+
#
|
14631
|
+
# def self.type: () -> Symbol
|
14632
|
+
def self.type
|
14633
|
+
:source_file_node
|
14634
|
+
end
|
12915
14635
|
end
|
12916
14636
|
|
12917
14637
|
# Represents the use of the `__LINE__` keyword.
|
@@ -12981,6 +14701,16 @@ module Prism
|
|
12981
14701
|
def type
|
12982
14702
|
:source_line_node
|
12983
14703
|
end
|
14704
|
+
|
14705
|
+
# Similar to #type, this method returns a symbol that you can use for
|
14706
|
+
# splitting on the type of the node without having to do a long === chain.
|
14707
|
+
# Note that like #type, it will still be slower than using == for a single
|
14708
|
+
# class, but should be faster in a case statement or an array comparison.
|
14709
|
+
#
|
14710
|
+
# def self.type: () -> Symbol
|
14711
|
+
def self.type
|
14712
|
+
:source_line_node
|
14713
|
+
end
|
12984
14714
|
end
|
12985
14715
|
|
12986
14716
|
# Represents the use of the splat operator.
|
@@ -13074,6 +14804,16 @@ module Prism
|
|
13074
14804
|
def type
|
13075
14805
|
:splat_node
|
13076
14806
|
end
|
14807
|
+
|
14808
|
+
# Similar to #type, this method returns a symbol that you can use for
|
14809
|
+
# splitting on the type of the node without having to do a long === chain.
|
14810
|
+
# Note that like #type, it will still be slower than using == for a single
|
14811
|
+
# class, but should be faster in a case statement or an array comparison.
|
14812
|
+
#
|
14813
|
+
# def self.type: () -> Symbol
|
14814
|
+
def self.type
|
14815
|
+
:splat_node
|
14816
|
+
end
|
13077
14817
|
end
|
13078
14818
|
|
13079
14819
|
# Represents a set of statements contained within some scope.
|
@@ -13149,6 +14889,16 @@ module Prism
|
|
13149
14889
|
def type
|
13150
14890
|
:statements_node
|
13151
14891
|
end
|
14892
|
+
|
14893
|
+
# Similar to #type, this method returns a symbol that you can use for
|
14894
|
+
# splitting on the type of the node without having to do a long === chain.
|
14895
|
+
# Note that like #type, it will still be slower than using == for a single
|
14896
|
+
# class, but should be faster in a case statement or an array comparison.
|
14897
|
+
#
|
14898
|
+
# def self.type: () -> Symbol
|
14899
|
+
def self.type
|
14900
|
+
:statements_node
|
14901
|
+
end
|
13152
14902
|
end
|
13153
14903
|
|
13154
14904
|
# Represents the use of compile-time string concatenation.
|
@@ -13232,6 +14982,16 @@ module Prism
|
|
13232
14982
|
def type
|
13233
14983
|
:string_concat_node
|
13234
14984
|
end
|
14985
|
+
|
14986
|
+
# Similar to #type, this method returns a symbol that you can use for
|
14987
|
+
# splitting on the type of the node without having to do a long === chain.
|
14988
|
+
# Note that like #type, it will still be slower than using == for a single
|
14989
|
+
# class, but should be faster in a case statement or an array comparison.
|
14990
|
+
#
|
14991
|
+
# def self.type: () -> Symbol
|
14992
|
+
def self.type
|
14993
|
+
:string_concat_node
|
14994
|
+
end
|
13235
14995
|
end
|
13236
14996
|
|
13237
14997
|
# Represents a string literal, a string contained within a `%w` list, or
|
@@ -13359,6 +15119,16 @@ module Prism
|
|
13359
15119
|
def type
|
13360
15120
|
:string_node
|
13361
15121
|
end
|
15122
|
+
|
15123
|
+
# Similar to #type, this method returns a symbol that you can use for
|
15124
|
+
# splitting on the type of the node without having to do a long === chain.
|
15125
|
+
# Note that like #type, it will still be slower than using == for a single
|
15126
|
+
# class, but should be faster in a case statement or an array comparison.
|
15127
|
+
#
|
15128
|
+
# def self.type: () -> Symbol
|
15129
|
+
def self.type
|
15130
|
+
:string_node
|
15131
|
+
end
|
13362
15132
|
end
|
13363
15133
|
|
13364
15134
|
# Represents the use of the `super` keyword with parentheses or arguments.
|
@@ -13489,6 +15259,16 @@ module Prism
|
|
13489
15259
|
def type
|
13490
15260
|
:super_node
|
13491
15261
|
end
|
15262
|
+
|
15263
|
+
# Similar to #type, this method returns a symbol that you can use for
|
15264
|
+
# splitting on the type of the node without having to do a long === chain.
|
15265
|
+
# Note that like #type, it will still be slower than using == for a single
|
15266
|
+
# class, but should be faster in a case statement or an array comparison.
|
15267
|
+
#
|
15268
|
+
# def self.type: () -> Symbol
|
15269
|
+
def self.type
|
15270
|
+
:super_node
|
15271
|
+
end
|
13492
15272
|
end
|
13493
15273
|
|
13494
15274
|
# Represents a symbol literal or a symbol contained within a `%i` list.
|
@@ -13600,6 +15380,16 @@ module Prism
|
|
13600
15380
|
def type
|
13601
15381
|
:symbol_node
|
13602
15382
|
end
|
15383
|
+
|
15384
|
+
# Similar to #type, this method returns a symbol that you can use for
|
15385
|
+
# splitting on the type of the node without having to do a long === chain.
|
15386
|
+
# Note that like #type, it will still be slower than using == for a single
|
15387
|
+
# class, but should be faster in a case statement or an array comparison.
|
15388
|
+
#
|
15389
|
+
# def self.type: () -> Symbol
|
15390
|
+
def self.type
|
15391
|
+
:symbol_node
|
15392
|
+
end
|
13603
15393
|
end
|
13604
15394
|
|
13605
15395
|
# Represents the use of the literal `true` keyword.
|
@@ -13669,6 +15459,16 @@ module Prism
|
|
13669
15459
|
def type
|
13670
15460
|
:true_node
|
13671
15461
|
end
|
15462
|
+
|
15463
|
+
# Similar to #type, this method returns a symbol that you can use for
|
15464
|
+
# splitting on the type of the node without having to do a long === chain.
|
15465
|
+
# Note that like #type, it will still be slower than using == for a single
|
15466
|
+
# class, but should be faster in a case statement or an array comparison.
|
15467
|
+
#
|
15468
|
+
# def self.type: () -> Symbol
|
15469
|
+
def self.type
|
15470
|
+
:true_node
|
15471
|
+
end
|
13672
15472
|
end
|
13673
15473
|
|
13674
15474
|
# Represents the use of the `undef` keyword.
|
@@ -13755,6 +15555,16 @@ module Prism
|
|
13755
15555
|
def type
|
13756
15556
|
:undef_node
|
13757
15557
|
end
|
15558
|
+
|
15559
|
+
# Similar to #type, this method returns a symbol that you can use for
|
15560
|
+
# splitting on the type of the node without having to do a long === chain.
|
15561
|
+
# Note that like #type, it will still be slower than using == for a single
|
15562
|
+
# class, but should be faster in a case statement or an array comparison.
|
15563
|
+
#
|
15564
|
+
# def self.type: () -> Symbol
|
15565
|
+
def self.type
|
15566
|
+
:undef_node
|
15567
|
+
end
|
13758
15568
|
end
|
13759
15569
|
|
13760
15570
|
# Represents the use of the `unless` keyword, either in the block form or the modifier form.
|
@@ -13886,6 +15696,16 @@ module Prism
|
|
13886
15696
|
def type
|
13887
15697
|
:unless_node
|
13888
15698
|
end
|
15699
|
+
|
15700
|
+
# Similar to #type, this method returns a symbol that you can use for
|
15701
|
+
# splitting on the type of the node without having to do a long === chain.
|
15702
|
+
# Note that like #type, it will still be slower than using == for a single
|
15703
|
+
# class, but should be faster in a case statement or an array comparison.
|
15704
|
+
#
|
15705
|
+
# def self.type: () -> Symbol
|
15706
|
+
def self.type
|
15707
|
+
:unless_node
|
15708
|
+
end
|
13889
15709
|
end
|
13890
15710
|
|
13891
15711
|
# Represents the use of the `until` keyword, either in the block form or the modifier form.
|
@@ -14017,6 +15837,16 @@ module Prism
|
|
14017
15837
|
def type
|
14018
15838
|
:until_node
|
14019
15839
|
end
|
15840
|
+
|
15841
|
+
# Similar to #type, this method returns a symbol that you can use for
|
15842
|
+
# splitting on the type of the node without having to do a long === chain.
|
15843
|
+
# Note that like #type, it will still be slower than using == for a single
|
15844
|
+
# class, but should be faster in a case statement or an array comparison.
|
15845
|
+
#
|
15846
|
+
# def self.type: () -> Symbol
|
15847
|
+
def self.type
|
15848
|
+
:until_node
|
15849
|
+
end
|
14020
15850
|
end
|
14021
15851
|
|
14022
15852
|
# Represents the use of the `when` keyword within a case statement.
|
@@ -14119,6 +15949,16 @@ module Prism
|
|
14119
15949
|
def type
|
14120
15950
|
:when_node
|
14121
15951
|
end
|
15952
|
+
|
15953
|
+
# Similar to #type, this method returns a symbol that you can use for
|
15954
|
+
# splitting on the type of the node without having to do a long === chain.
|
15955
|
+
# Note that like #type, it will still be slower than using == for a single
|
15956
|
+
# class, but should be faster in a case statement or an array comparison.
|
15957
|
+
#
|
15958
|
+
# def self.type: () -> Symbol
|
15959
|
+
def self.type
|
15960
|
+
:when_node
|
15961
|
+
end
|
14122
15962
|
end
|
14123
15963
|
|
14124
15964
|
# Represents the use of the `while` keyword, either in the block form or the modifier form.
|
@@ -14250,6 +16090,16 @@ module Prism
|
|
14250
16090
|
def type
|
14251
16091
|
:while_node
|
14252
16092
|
end
|
16093
|
+
|
16094
|
+
# Similar to #type, this method returns a symbol that you can use for
|
16095
|
+
# splitting on the type of the node without having to do a long === chain.
|
16096
|
+
# Note that like #type, it will still be slower than using == for a single
|
16097
|
+
# class, but should be faster in a case statement or an array comparison.
|
16098
|
+
#
|
16099
|
+
# def self.type: () -> Symbol
|
16100
|
+
def self.type
|
16101
|
+
:while_node
|
16102
|
+
end
|
14253
16103
|
end
|
14254
16104
|
|
14255
16105
|
# Represents an xstring literal with no interpolation.
|
@@ -14358,6 +16208,16 @@ module Prism
|
|
14358
16208
|
def type
|
14359
16209
|
:x_string_node
|
14360
16210
|
end
|
16211
|
+
|
16212
|
+
# Similar to #type, this method returns a symbol that you can use for
|
16213
|
+
# splitting on the type of the node without having to do a long === chain.
|
16214
|
+
# Note that like #type, it will still be slower than using == for a single
|
16215
|
+
# class, but should be faster in a case statement or an array comparison.
|
16216
|
+
#
|
16217
|
+
# def self.type: () -> Symbol
|
16218
|
+
def self.type
|
16219
|
+
:x_string_node
|
16220
|
+
end
|
14361
16221
|
end
|
14362
16222
|
|
14363
16223
|
# Represents the use of the `yield` keyword.
|
@@ -14473,6 +16333,16 @@ module Prism
|
|
14473
16333
|
def type
|
14474
16334
|
:yield_node
|
14475
16335
|
end
|
16336
|
+
|
16337
|
+
# Similar to #type, this method returns a symbol that you can use for
|
16338
|
+
# splitting on the type of the node without having to do a long === chain.
|
16339
|
+
# Note that like #type, it will still be slower than using == for a single
|
16340
|
+
# class, but should be faster in a case statement or an array comparison.
|
16341
|
+
#
|
16342
|
+
# def self.type: () -> Symbol
|
16343
|
+
def self.type
|
16344
|
+
:yield_node
|
16345
|
+
end
|
14476
16346
|
end
|
14477
16347
|
|
14478
16348
|
module CallNodeFlags
|
@@ -14517,24 +16387,24 @@ module Prism
|
|
14517
16387
|
# m - allows $ to match the end of lines within strings
|
14518
16388
|
MULTI_LINE = 1 << 2
|
14519
16389
|
|
16390
|
+
# o - only interpolates values into the regular expression once
|
16391
|
+
ONCE = 1 << 3
|
16392
|
+
|
14520
16393
|
# e - forces the EUC-JP encoding
|
14521
|
-
EUC_JP = 1 <<
|
16394
|
+
EUC_JP = 1 << 4
|
14522
16395
|
|
14523
16396
|
# n - forces the ASCII-8BIT encoding
|
14524
|
-
ASCII_8BIT = 1 <<
|
16397
|
+
ASCII_8BIT = 1 << 5
|
14525
16398
|
|
14526
16399
|
# s - forces the Windows-31J encoding
|
14527
|
-
WINDOWS_31J = 1 <<
|
16400
|
+
WINDOWS_31J = 1 << 6
|
14528
16401
|
|
14529
16402
|
# u - forces the UTF-8 encoding
|
14530
|
-
UTF_8 = 1 <<
|
14531
|
-
|
14532
|
-
# o - only interpolates values into the regular expression once
|
14533
|
-
ONCE = 1 << 7
|
16403
|
+
UTF_8 = 1 << 7
|
14534
16404
|
end
|
14535
16405
|
|
14536
16406
|
module StringFlags
|
14537
|
-
# frozen by virtue of a frozen_string_literal comment
|
16407
|
+
# frozen by virtue of a `frozen_string_literal` comment
|
14538
16408
|
FROZEN = 1 << 0
|
14539
16409
|
end
|
14540
16410
|
end
|