ed-precompiled_prism 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/BSDmakefile +58 -0
- data/CHANGELOG.md +723 -0
- data/CODE_OF_CONDUCT.md +76 -0
- data/CONTRIBUTING.md +58 -0
- data/LICENSE.md +7 -0
- data/Makefile +110 -0
- data/README.md +143 -0
- data/config.yml +4714 -0
- data/docs/build_system.md +119 -0
- data/docs/configuration.md +68 -0
- data/docs/cruby_compilation.md +27 -0
- data/docs/design.md +53 -0
- data/docs/encoding.md +121 -0
- data/docs/fuzzing.md +88 -0
- data/docs/heredocs.md +36 -0
- data/docs/javascript.md +118 -0
- data/docs/local_variable_depth.md +229 -0
- data/docs/mapping.md +117 -0
- data/docs/parser_translation.md +24 -0
- data/docs/parsing_rules.md +22 -0
- data/docs/releasing.md +98 -0
- data/docs/relocation.md +34 -0
- data/docs/ripper_translation.md +72 -0
- data/docs/ruby_api.md +44 -0
- data/docs/ruby_parser_translation.md +19 -0
- data/docs/serialization.md +233 -0
- data/docs/testing.md +55 -0
- data/ext/prism/api_node.c +6941 -0
- data/ext/prism/api_pack.c +276 -0
- data/ext/prism/extconf.rb +127 -0
- data/ext/prism/extension.c +1419 -0
- data/ext/prism/extension.h +19 -0
- data/include/prism/ast.h +8220 -0
- data/include/prism/defines.h +260 -0
- data/include/prism/diagnostic.h +456 -0
- data/include/prism/encoding.h +283 -0
- data/include/prism/node.h +129 -0
- data/include/prism/options.h +482 -0
- data/include/prism/pack.h +163 -0
- data/include/prism/parser.h +933 -0
- data/include/prism/prettyprint.h +34 -0
- data/include/prism/regexp.h +43 -0
- data/include/prism/static_literals.h +121 -0
- data/include/prism/util/pm_buffer.h +236 -0
- data/include/prism/util/pm_char.h +204 -0
- data/include/prism/util/pm_constant_pool.h +218 -0
- data/include/prism/util/pm_integer.h +130 -0
- data/include/prism/util/pm_list.h +103 -0
- data/include/prism/util/pm_memchr.h +29 -0
- data/include/prism/util/pm_newline_list.h +113 -0
- data/include/prism/util/pm_string.h +200 -0
- data/include/prism/util/pm_strncasecmp.h +32 -0
- data/include/prism/util/pm_strpbrk.h +46 -0
- data/include/prism/version.h +29 -0
- data/include/prism.h +408 -0
- data/lib/prism/compiler.rb +801 -0
- data/lib/prism/desugar_compiler.rb +392 -0
- data/lib/prism/dispatcher.rb +2210 -0
- data/lib/prism/dot_visitor.rb +4762 -0
- data/lib/prism/dsl.rb +1003 -0
- data/lib/prism/ffi.rb +570 -0
- data/lib/prism/inspect_visitor.rb +2392 -0
- data/lib/prism/lex_compat.rb +928 -0
- data/lib/prism/mutation_compiler.rb +772 -0
- data/lib/prism/node.rb +18816 -0
- data/lib/prism/node_ext.rb +511 -0
- data/lib/prism/pack.rb +230 -0
- data/lib/prism/parse_result/comments.rb +188 -0
- data/lib/prism/parse_result/errors.rb +66 -0
- data/lib/prism/parse_result/newlines.rb +155 -0
- data/lib/prism/parse_result.rb +911 -0
- data/lib/prism/pattern.rb +269 -0
- data/lib/prism/polyfill/append_as_bytes.rb +15 -0
- data/lib/prism/polyfill/byteindex.rb +13 -0
- data/lib/prism/polyfill/scan_byte.rb +14 -0
- data/lib/prism/polyfill/unpack1.rb +14 -0
- data/lib/prism/polyfill/warn.rb +36 -0
- data/lib/prism/reflection.rb +416 -0
- data/lib/prism/relocation.rb +505 -0
- data/lib/prism/serialize.rb +2398 -0
- data/lib/prism/string_query.rb +31 -0
- data/lib/prism/translation/parser/builder.rb +62 -0
- data/lib/prism/translation/parser/compiler.rb +2234 -0
- data/lib/prism/translation/parser/lexer.rb +820 -0
- data/lib/prism/translation/parser.rb +374 -0
- data/lib/prism/translation/parser33.rb +13 -0
- data/lib/prism/translation/parser34.rb +13 -0
- data/lib/prism/translation/parser35.rb +13 -0
- data/lib/prism/translation/parser_current.rb +24 -0
- data/lib/prism/translation/ripper/sexp.rb +126 -0
- data/lib/prism/translation/ripper/shim.rb +5 -0
- data/lib/prism/translation/ripper.rb +3474 -0
- data/lib/prism/translation/ruby_parser.rb +1929 -0
- data/lib/prism/translation.rb +16 -0
- data/lib/prism/visitor.rb +813 -0
- data/lib/prism.rb +97 -0
- data/prism.gemspec +174 -0
- data/rbi/prism/compiler.rbi +12 -0
- data/rbi/prism/dsl.rbi +524 -0
- data/rbi/prism/inspect_visitor.rbi +12 -0
- data/rbi/prism/node.rbi +8734 -0
- data/rbi/prism/node_ext.rbi +107 -0
- data/rbi/prism/parse_result.rbi +404 -0
- data/rbi/prism/reflection.rbi +58 -0
- data/rbi/prism/string_query.rbi +12 -0
- data/rbi/prism/translation/parser.rbi +11 -0
- data/rbi/prism/translation/parser33.rbi +6 -0
- data/rbi/prism/translation/parser34.rbi +6 -0
- data/rbi/prism/translation/parser35.rbi +6 -0
- data/rbi/prism/translation/ripper.rbi +15 -0
- data/rbi/prism/visitor.rbi +473 -0
- data/rbi/prism.rbi +66 -0
- data/sig/prism/compiler.rbs +9 -0
- data/sig/prism/dispatcher.rbs +19 -0
- data/sig/prism/dot_visitor.rbs +6 -0
- data/sig/prism/dsl.rbs +351 -0
- data/sig/prism/inspect_visitor.rbs +22 -0
- data/sig/prism/lex_compat.rbs +10 -0
- data/sig/prism/mutation_compiler.rbs +159 -0
- data/sig/prism/node.rbs +4028 -0
- data/sig/prism/node_ext.rbs +149 -0
- data/sig/prism/pack.rbs +43 -0
- data/sig/prism/parse_result/comments.rbs +38 -0
- data/sig/prism/parse_result.rbs +196 -0
- data/sig/prism/pattern.rbs +13 -0
- data/sig/prism/reflection.rbs +50 -0
- data/sig/prism/relocation.rbs +185 -0
- data/sig/prism/serialize.rbs +8 -0
- data/sig/prism/string_query.rbs +11 -0
- data/sig/prism/visitor.rbs +169 -0
- data/sig/prism.rbs +254 -0
- data/src/diagnostic.c +850 -0
- data/src/encoding.c +5235 -0
- data/src/node.c +8676 -0
- data/src/options.c +328 -0
- data/src/pack.c +509 -0
- data/src/prettyprint.c +8941 -0
- data/src/prism.c +23361 -0
- data/src/regexp.c +790 -0
- data/src/serialize.c +2268 -0
- data/src/static_literals.c +617 -0
- data/src/token_type.c +703 -0
- data/src/util/pm_buffer.c +357 -0
- data/src/util/pm_char.c +318 -0
- data/src/util/pm_constant_pool.c +342 -0
- data/src/util/pm_integer.c +670 -0
- data/src/util/pm_list.c +49 -0
- data/src/util/pm_memchr.c +35 -0
- data/src/util/pm_newline_list.c +125 -0
- data/src/util/pm_string.c +381 -0
- data/src/util/pm_strncasecmp.c +36 -0
- data/src/util/pm_strpbrk.c +206 -0
- metadata +195 -0
|
@@ -0,0 +1,511 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# :markup: markdown
|
|
3
|
+
|
|
4
|
+
#--
|
|
5
|
+
# Here we are reopening the prism module to provide methods on nodes that aren't
|
|
6
|
+
# templated and are meant as convenience methods.
|
|
7
|
+
#++
|
|
8
|
+
module Prism
|
|
9
|
+
class Node
|
|
10
|
+
def deprecated(*replacements) # :nodoc:
|
|
11
|
+
location = caller_locations(1, 1)
|
|
12
|
+
location = location[0].label if location
|
|
13
|
+
suggest = replacements.map { |replacement| "#{self.class}##{replacement}" }
|
|
14
|
+
|
|
15
|
+
warn(<<~MSG, uplevel: 1, category: :deprecated)
|
|
16
|
+
[deprecation]: #{self.class}##{location} is deprecated and will be \
|
|
17
|
+
removed in the next major version. Use #{suggest.join("/")} instead.
|
|
18
|
+
#{(caller(1, 3) || []).join("\n")}
|
|
19
|
+
MSG
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
module RegularExpressionOptions # :nodoc:
|
|
24
|
+
# Returns a numeric value that represents the flags that were used to create
|
|
25
|
+
# the regular expression.
|
|
26
|
+
def options
|
|
27
|
+
o = 0
|
|
28
|
+
o |= Regexp::IGNORECASE if flags.anybits?(RegularExpressionFlags::IGNORE_CASE)
|
|
29
|
+
o |= Regexp::EXTENDED if flags.anybits?(RegularExpressionFlags::EXTENDED)
|
|
30
|
+
o |= Regexp::MULTILINE if flags.anybits?(RegularExpressionFlags::MULTI_LINE)
|
|
31
|
+
o |= Regexp::FIXEDENCODING if flags.anybits?(RegularExpressionFlags::EUC_JP | RegularExpressionFlags::WINDOWS_31J | RegularExpressionFlags::UTF_8)
|
|
32
|
+
o |= Regexp::NOENCODING if flags.anybits?(RegularExpressionFlags::ASCII_8BIT)
|
|
33
|
+
o
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
class InterpolatedMatchLastLineNode < Node
|
|
38
|
+
include RegularExpressionOptions
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
class InterpolatedRegularExpressionNode < Node
|
|
42
|
+
include RegularExpressionOptions
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
class MatchLastLineNode < Node
|
|
46
|
+
include RegularExpressionOptions
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
class RegularExpressionNode < Node
|
|
50
|
+
include RegularExpressionOptions
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
private_constant :RegularExpressionOptions
|
|
54
|
+
|
|
55
|
+
module HeredocQuery # :nodoc:
|
|
56
|
+
# Returns true if this node was represented as a heredoc in the source code.
|
|
57
|
+
def heredoc?
|
|
58
|
+
opening&.start_with?("<<")
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
class InterpolatedStringNode < Node
|
|
63
|
+
include HeredocQuery
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
class InterpolatedXStringNode < Node
|
|
67
|
+
include HeredocQuery
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
class StringNode < Node
|
|
71
|
+
include HeredocQuery
|
|
72
|
+
|
|
73
|
+
# Occasionally it's helpful to treat a string as if it were interpolated so
|
|
74
|
+
# that there's a consistent interface for working with strings.
|
|
75
|
+
def to_interpolated
|
|
76
|
+
InterpolatedStringNode.new(
|
|
77
|
+
source,
|
|
78
|
+
-1,
|
|
79
|
+
location,
|
|
80
|
+
frozen? ? InterpolatedStringNodeFlags::FROZEN : 0,
|
|
81
|
+
opening_loc,
|
|
82
|
+
[copy(location: content_loc, opening_loc: nil, closing_loc: nil)],
|
|
83
|
+
closing_loc
|
|
84
|
+
)
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
class XStringNode < Node
|
|
89
|
+
include HeredocQuery
|
|
90
|
+
|
|
91
|
+
# Occasionally it's helpful to treat a string as if it were interpolated so
|
|
92
|
+
# that there's a consistent interface for working with strings.
|
|
93
|
+
def to_interpolated
|
|
94
|
+
InterpolatedXStringNode.new(
|
|
95
|
+
source,
|
|
96
|
+
-1,
|
|
97
|
+
location,
|
|
98
|
+
flags,
|
|
99
|
+
opening_loc,
|
|
100
|
+
[StringNode.new(source, node_id, content_loc, 0, nil, content_loc, nil, unescaped)],
|
|
101
|
+
closing_loc
|
|
102
|
+
)
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
private_constant :HeredocQuery
|
|
107
|
+
|
|
108
|
+
class ImaginaryNode < Node
|
|
109
|
+
# Returns the value of the node as a Ruby Complex.
|
|
110
|
+
def value
|
|
111
|
+
Complex(0, numeric.value)
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
class RationalNode < Node
|
|
116
|
+
# Returns the value of the node as a Ruby Rational.
|
|
117
|
+
def value
|
|
118
|
+
Rational(numerator, denominator)
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Returns the value of the node as an IntegerNode or a FloatNode. This
|
|
122
|
+
# method is deprecated in favor of #value or #numerator/#denominator.
|
|
123
|
+
def numeric
|
|
124
|
+
deprecated("value", "numerator", "denominator")
|
|
125
|
+
|
|
126
|
+
if denominator == 1
|
|
127
|
+
IntegerNode.new(source, -1, location.chop, flags, numerator)
|
|
128
|
+
else
|
|
129
|
+
FloatNode.new(source, -1, location.chop, 0, numerator.to_f / denominator)
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
class ConstantReadNode < Node
|
|
135
|
+
# Returns the list of parts for the full name of this constant.
|
|
136
|
+
# For example: [:Foo]
|
|
137
|
+
def full_name_parts
|
|
138
|
+
[name]
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
# Returns the full name of this constant. For example: "Foo"
|
|
142
|
+
def full_name
|
|
143
|
+
name.to_s
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
class ConstantWriteNode < Node
|
|
148
|
+
# Returns the list of parts for the full name of this constant.
|
|
149
|
+
# For example: [:Foo]
|
|
150
|
+
def full_name_parts
|
|
151
|
+
[name]
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
# Returns the full name of this constant. For example: "Foo"
|
|
155
|
+
def full_name
|
|
156
|
+
name.to_s
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
class ConstantPathNode < Node
|
|
161
|
+
# An error class raised when dynamic parts are found while computing a
|
|
162
|
+
# constant path's full name. For example:
|
|
163
|
+
# Foo::Bar::Baz -> does not raise because all parts of the constant path are
|
|
164
|
+
# simple constants
|
|
165
|
+
# var::Bar::Baz -> raises because the first part of the constant path is a
|
|
166
|
+
# local variable
|
|
167
|
+
class DynamicPartsInConstantPathError < StandardError; end
|
|
168
|
+
|
|
169
|
+
# An error class raised when missing nodes are found while computing a
|
|
170
|
+
# constant path's full name. For example:
|
|
171
|
+
# Foo:: -> raises because the constant path is missing the last part
|
|
172
|
+
class MissingNodesInConstantPathError < StandardError; end
|
|
173
|
+
|
|
174
|
+
# Returns the list of parts for the full name of this constant path.
|
|
175
|
+
# For example: [:Foo, :Bar]
|
|
176
|
+
def full_name_parts
|
|
177
|
+
parts = [] #: Array[Symbol]
|
|
178
|
+
current = self #: node?
|
|
179
|
+
|
|
180
|
+
while current.is_a?(ConstantPathNode)
|
|
181
|
+
name = current.name
|
|
182
|
+
if name.nil?
|
|
183
|
+
raise MissingNodesInConstantPathError, "Constant path contains missing nodes. Cannot compute full name"
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
parts.unshift(name)
|
|
187
|
+
current = current.parent
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
if !current.is_a?(ConstantReadNode) && !current.nil?
|
|
191
|
+
raise DynamicPartsInConstantPathError, "Constant path contains dynamic parts. Cannot compute full name"
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
parts.unshift(current&.name || :"")
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
# Returns the full name of this constant path. For example: "Foo::Bar"
|
|
198
|
+
def full_name
|
|
199
|
+
full_name_parts.join("::")
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
# Previously, we had a child node on this class that contained either a
|
|
203
|
+
# constant read or a missing node. To not cause a breaking change, we
|
|
204
|
+
# continue to supply that API.
|
|
205
|
+
def child
|
|
206
|
+
deprecated("name", "name_loc")
|
|
207
|
+
|
|
208
|
+
if name
|
|
209
|
+
ConstantReadNode.new(source, -1, name_loc, 0, name)
|
|
210
|
+
else
|
|
211
|
+
MissingNode.new(source, -1, location, 0)
|
|
212
|
+
end
|
|
213
|
+
end
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
class ConstantPathTargetNode < Node
|
|
217
|
+
# Returns the list of parts for the full name of this constant path.
|
|
218
|
+
# For example: [:Foo, :Bar]
|
|
219
|
+
def full_name_parts
|
|
220
|
+
parts =
|
|
221
|
+
case parent
|
|
222
|
+
when ConstantPathNode, ConstantReadNode
|
|
223
|
+
parent.full_name_parts
|
|
224
|
+
when nil
|
|
225
|
+
[:""]
|
|
226
|
+
else
|
|
227
|
+
# e.g. self::Foo, (var)::Bar = baz
|
|
228
|
+
raise ConstantPathNode::DynamicPartsInConstantPathError, "Constant target path contains dynamic parts. Cannot compute full name"
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
if name.nil?
|
|
232
|
+
raise ConstantPathNode::MissingNodesInConstantPathError, "Constant target path contains missing nodes. Cannot compute full name"
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
parts.push(name)
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
# Returns the full name of this constant path. For example: "Foo::Bar"
|
|
239
|
+
def full_name
|
|
240
|
+
full_name_parts.join("::")
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
# Previously, we had a child node on this class that contained either a
|
|
244
|
+
# constant read or a missing node. To not cause a breaking change, we
|
|
245
|
+
# continue to supply that API.
|
|
246
|
+
def child
|
|
247
|
+
deprecated("name", "name_loc")
|
|
248
|
+
|
|
249
|
+
if name
|
|
250
|
+
ConstantReadNode.new(source, -1, name_loc, 0, name)
|
|
251
|
+
else
|
|
252
|
+
MissingNode.new(source, -1, location, 0)
|
|
253
|
+
end
|
|
254
|
+
end
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
class ConstantTargetNode < Node
|
|
258
|
+
# Returns the list of parts for the full name of this constant.
|
|
259
|
+
# For example: [:Foo]
|
|
260
|
+
def full_name_parts
|
|
261
|
+
[name]
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
# Returns the full name of this constant. For example: "Foo"
|
|
265
|
+
def full_name
|
|
266
|
+
name.to_s
|
|
267
|
+
end
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
class ParametersNode < Node
|
|
271
|
+
# Mirrors the Method#parameters method.
|
|
272
|
+
def signature
|
|
273
|
+
names = [] #: Array[[Symbol, Symbol] | [Symbol]]
|
|
274
|
+
|
|
275
|
+
requireds.each do |param|
|
|
276
|
+
names << (param.is_a?(MultiTargetNode) ? [:req] : [:req, param.name])
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
optionals.each { |param| names << [:opt, param.name] }
|
|
280
|
+
|
|
281
|
+
if rest && rest.is_a?(RestParameterNode)
|
|
282
|
+
names << [:rest, rest.name || :*]
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
posts.each do |param|
|
|
286
|
+
case param
|
|
287
|
+
when MultiTargetNode
|
|
288
|
+
names << [:req]
|
|
289
|
+
when NoKeywordsParameterNode, KeywordRestParameterNode, ForwardingParameterNode
|
|
290
|
+
# Invalid syntax, e.g. "def f(**nil, ...)" moves the NoKeywordsParameterNode to posts
|
|
291
|
+
raise "Invalid syntax"
|
|
292
|
+
else
|
|
293
|
+
names << [:req, param.name]
|
|
294
|
+
end
|
|
295
|
+
end
|
|
296
|
+
|
|
297
|
+
# Regardless of the order in which the keywords were defined, the required
|
|
298
|
+
# keywords always come first followed by the optional keywords.
|
|
299
|
+
keyopt = [] #: Array[OptionalKeywordParameterNode]
|
|
300
|
+
keywords.each do |param|
|
|
301
|
+
if param.is_a?(OptionalKeywordParameterNode)
|
|
302
|
+
keyopt << param
|
|
303
|
+
else
|
|
304
|
+
names << [:keyreq, param.name]
|
|
305
|
+
end
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
keyopt.each { |param| names << [:key, param.name] }
|
|
309
|
+
|
|
310
|
+
case keyword_rest
|
|
311
|
+
when ForwardingParameterNode
|
|
312
|
+
names.concat([[:rest, :*], [:keyrest, :**], [:block, :&]])
|
|
313
|
+
when KeywordRestParameterNode
|
|
314
|
+
names << [:keyrest, keyword_rest.name || :**]
|
|
315
|
+
when NoKeywordsParameterNode
|
|
316
|
+
names << [:nokey]
|
|
317
|
+
end
|
|
318
|
+
|
|
319
|
+
names << [:block, block.name || :&] if block
|
|
320
|
+
names
|
|
321
|
+
end
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
class CallNode < Node
|
|
325
|
+
# When a call node has the attribute_write flag set, it means that the call
|
|
326
|
+
# is using the attribute write syntax. This is either a method call to []=
|
|
327
|
+
# or a method call to a method that ends with =. Either way, the = sign is
|
|
328
|
+
# present in the source.
|
|
329
|
+
#
|
|
330
|
+
# Prism returns the message_loc _without_ the = sign attached, because there
|
|
331
|
+
# can be any amount of space between the message and the = sign. However,
|
|
332
|
+
# sometimes you want the location of the full message including the inner
|
|
333
|
+
# space and the = sign. This method provides that.
|
|
334
|
+
def full_message_loc
|
|
335
|
+
attribute_write? ? message_loc&.adjoin("=") : message_loc
|
|
336
|
+
end
|
|
337
|
+
end
|
|
338
|
+
|
|
339
|
+
class CallOperatorWriteNode < Node
|
|
340
|
+
# Returns the binary operator used to modify the receiver. This method is
|
|
341
|
+
# deprecated in favor of #binary_operator.
|
|
342
|
+
def operator
|
|
343
|
+
deprecated("binary_operator")
|
|
344
|
+
binary_operator
|
|
345
|
+
end
|
|
346
|
+
|
|
347
|
+
# Returns the location of the binary operator used to modify the receiver.
|
|
348
|
+
# This method is deprecated in favor of #binary_operator_loc.
|
|
349
|
+
def operator_loc
|
|
350
|
+
deprecated("binary_operator_loc")
|
|
351
|
+
binary_operator_loc
|
|
352
|
+
end
|
|
353
|
+
end
|
|
354
|
+
|
|
355
|
+
class ClassVariableOperatorWriteNode < Node
|
|
356
|
+
# Returns the binary operator used to modify the receiver. This method is
|
|
357
|
+
# deprecated in favor of #binary_operator.
|
|
358
|
+
def operator
|
|
359
|
+
deprecated("binary_operator")
|
|
360
|
+
binary_operator
|
|
361
|
+
end
|
|
362
|
+
|
|
363
|
+
# Returns the location of the binary operator used to modify the receiver.
|
|
364
|
+
# This method is deprecated in favor of #binary_operator_loc.
|
|
365
|
+
def operator_loc
|
|
366
|
+
deprecated("binary_operator_loc")
|
|
367
|
+
binary_operator_loc
|
|
368
|
+
end
|
|
369
|
+
end
|
|
370
|
+
|
|
371
|
+
class ConstantOperatorWriteNode < Node
|
|
372
|
+
# Returns the binary operator used to modify the receiver. This method is
|
|
373
|
+
# deprecated in favor of #binary_operator.
|
|
374
|
+
def operator
|
|
375
|
+
deprecated("binary_operator")
|
|
376
|
+
binary_operator
|
|
377
|
+
end
|
|
378
|
+
|
|
379
|
+
# Returns the location of the binary operator used to modify the receiver.
|
|
380
|
+
# This method is deprecated in favor of #binary_operator_loc.
|
|
381
|
+
def operator_loc
|
|
382
|
+
deprecated("binary_operator_loc")
|
|
383
|
+
binary_operator_loc
|
|
384
|
+
end
|
|
385
|
+
end
|
|
386
|
+
|
|
387
|
+
class ConstantPathOperatorWriteNode < Node
|
|
388
|
+
# Returns the binary operator used to modify the receiver. This method is
|
|
389
|
+
# deprecated in favor of #binary_operator.
|
|
390
|
+
def operator
|
|
391
|
+
deprecated("binary_operator")
|
|
392
|
+
binary_operator
|
|
393
|
+
end
|
|
394
|
+
|
|
395
|
+
# Returns the location of the binary operator used to modify the receiver.
|
|
396
|
+
# This method is deprecated in favor of #binary_operator_loc.
|
|
397
|
+
def operator_loc
|
|
398
|
+
deprecated("binary_operator_loc")
|
|
399
|
+
binary_operator_loc
|
|
400
|
+
end
|
|
401
|
+
end
|
|
402
|
+
|
|
403
|
+
class GlobalVariableOperatorWriteNode < Node
|
|
404
|
+
# Returns the binary operator used to modify the receiver. This method is
|
|
405
|
+
# deprecated in favor of #binary_operator.
|
|
406
|
+
def operator
|
|
407
|
+
deprecated("binary_operator")
|
|
408
|
+
binary_operator
|
|
409
|
+
end
|
|
410
|
+
|
|
411
|
+
# Returns the location of the binary operator used to modify the receiver.
|
|
412
|
+
# This method is deprecated in favor of #binary_operator_loc.
|
|
413
|
+
def operator_loc
|
|
414
|
+
deprecated("binary_operator_loc")
|
|
415
|
+
binary_operator_loc
|
|
416
|
+
end
|
|
417
|
+
end
|
|
418
|
+
|
|
419
|
+
class IndexOperatorWriteNode < Node
|
|
420
|
+
# Returns the binary operator used to modify the receiver. This method is
|
|
421
|
+
# deprecated in favor of #binary_operator.
|
|
422
|
+
def operator
|
|
423
|
+
deprecated("binary_operator")
|
|
424
|
+
binary_operator
|
|
425
|
+
end
|
|
426
|
+
|
|
427
|
+
# Returns the location of the binary operator used to modify the receiver.
|
|
428
|
+
# This method is deprecated in favor of #binary_operator_loc.
|
|
429
|
+
def operator_loc
|
|
430
|
+
deprecated("binary_operator_loc")
|
|
431
|
+
binary_operator_loc
|
|
432
|
+
end
|
|
433
|
+
end
|
|
434
|
+
|
|
435
|
+
class InstanceVariableOperatorWriteNode < Node
|
|
436
|
+
# Returns the binary operator used to modify the receiver. This method is
|
|
437
|
+
# deprecated in favor of #binary_operator.
|
|
438
|
+
def operator
|
|
439
|
+
deprecated("binary_operator")
|
|
440
|
+
binary_operator
|
|
441
|
+
end
|
|
442
|
+
|
|
443
|
+
# Returns the location of the binary operator used to modify the receiver.
|
|
444
|
+
# This method is deprecated in favor of #binary_operator_loc.
|
|
445
|
+
def operator_loc
|
|
446
|
+
deprecated("binary_operator_loc")
|
|
447
|
+
binary_operator_loc
|
|
448
|
+
end
|
|
449
|
+
end
|
|
450
|
+
|
|
451
|
+
class LocalVariableOperatorWriteNode < Node
|
|
452
|
+
# Returns the binary operator used to modify the receiver. This method is
|
|
453
|
+
# deprecated in favor of #binary_operator.
|
|
454
|
+
def operator
|
|
455
|
+
deprecated("binary_operator")
|
|
456
|
+
binary_operator
|
|
457
|
+
end
|
|
458
|
+
|
|
459
|
+
# Returns the location of the binary operator used to modify the receiver.
|
|
460
|
+
# This method is deprecated in favor of #binary_operator_loc.
|
|
461
|
+
def operator_loc
|
|
462
|
+
deprecated("binary_operator_loc")
|
|
463
|
+
binary_operator_loc
|
|
464
|
+
end
|
|
465
|
+
end
|
|
466
|
+
|
|
467
|
+
class CaseMatchNode < Node
|
|
468
|
+
# Returns the else clause of the case match node. This method is deprecated
|
|
469
|
+
# in favor of #else_clause.
|
|
470
|
+
def consequent
|
|
471
|
+
deprecated("else_clause")
|
|
472
|
+
else_clause
|
|
473
|
+
end
|
|
474
|
+
end
|
|
475
|
+
|
|
476
|
+
class CaseNode < Node
|
|
477
|
+
# Returns the else clause of the case node. This method is deprecated in
|
|
478
|
+
# favor of #else_clause.
|
|
479
|
+
def consequent
|
|
480
|
+
deprecated("else_clause")
|
|
481
|
+
else_clause
|
|
482
|
+
end
|
|
483
|
+
end
|
|
484
|
+
|
|
485
|
+
class IfNode < Node
|
|
486
|
+
# Returns the subsequent if/elsif/else clause of the if node. This method is
|
|
487
|
+
# deprecated in favor of #subsequent.
|
|
488
|
+
def consequent
|
|
489
|
+
deprecated("subsequent")
|
|
490
|
+
subsequent
|
|
491
|
+
end
|
|
492
|
+
end
|
|
493
|
+
|
|
494
|
+
class RescueNode < Node
|
|
495
|
+
# Returns the subsequent rescue clause of the rescue node. This method is
|
|
496
|
+
# deprecated in favor of #subsequent.
|
|
497
|
+
def consequent
|
|
498
|
+
deprecated("subsequent")
|
|
499
|
+
subsequent
|
|
500
|
+
end
|
|
501
|
+
end
|
|
502
|
+
|
|
503
|
+
class UnlessNode < Node
|
|
504
|
+
# Returns the else clause of the unless node. This method is deprecated in
|
|
505
|
+
# favor of #else_clause.
|
|
506
|
+
def consequent
|
|
507
|
+
deprecated("else_clause")
|
|
508
|
+
else_clause
|
|
509
|
+
end
|
|
510
|
+
end
|
|
511
|
+
end
|