ruby-lsp 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +9 -1
- data/.github/workflows/publish_docs.yml +32 -0
- data/.rubocop.yml +25 -0
- data/CHANGELOG.md +23 -0
- data/Gemfile +8 -4
- data/Gemfile.lock +64 -13
- data/README.md +58 -1
- data/Rakefile +5 -0
- data/VERSION +1 -1
- data/bin/tapioca +29 -0
- data/dev.yml +3 -0
- data/exe/ruby-lsp +19 -3
- data/lib/ruby-lsp.rb +2 -0
- data/lib/ruby_lsp/cli.rb +23 -7
- data/lib/ruby_lsp/document.rb +98 -6
- data/lib/ruby_lsp/handler.rb +119 -18
- data/lib/ruby_lsp/internal.rb +7 -0
- data/lib/ruby_lsp/requests/base_request.rb +19 -5
- data/lib/ruby_lsp/requests/code_actions.rb +30 -9
- data/lib/ruby_lsp/requests/diagnostics.rb +29 -77
- data/lib/ruby_lsp/requests/document_highlight.rb +111 -0
- data/lib/ruby_lsp/requests/document_symbol.rb +75 -16
- data/lib/ruby_lsp/requests/folding_ranges.rb +63 -19
- data/lib/ruby_lsp/requests/formatting.rb +19 -2
- data/lib/ruby_lsp/requests/rubocop_request.rb +21 -8
- data/lib/ruby_lsp/requests/selection_ranges.rb +114 -0
- data/lib/ruby_lsp/requests/semantic_highlighting.rb +132 -61
- data/lib/ruby_lsp/requests/support/rubocop_diagnostic.rb +100 -0
- data/lib/ruby_lsp/requests/support/selection_range.rb +20 -0
- data/lib/ruby_lsp/requests/support/semantic_token_encoder.rb +70 -0
- data/lib/ruby_lsp/requests/support/syntax_error_diagnostic.rb +32 -0
- data/lib/ruby_lsp/requests.rb +10 -0
- data/lib/ruby_lsp/store.rb +23 -2
- data/rakelib/check_docs.rake +57 -0
- data/ruby-lsp.gemspec +2 -1
- data/sorbet/config +4 -0
- data/sorbet/rbi/.rubocop.yml +8 -0
- data/sorbet/rbi/gems/ansi@1.5.0.rbi +338 -0
- data/sorbet/rbi/gems/ast@2.4.2.rbi +522 -0
- data/sorbet/rbi/gems/builder@3.2.4.rbi +418 -0
- data/sorbet/rbi/gems/coderay@1.1.3.rbi +8 -0
- data/sorbet/rbi/gems/debug@1.5.0.rbi +1273 -0
- data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +867 -0
- data/sorbet/rbi/gems/io-console@0.5.11.rbi +8 -0
- data/sorbet/rbi/gems/irb@1.4.1.rbi +376 -0
- data/sorbet/rbi/gems/language_server-protocol@3.16.0.3.rbi +7325 -0
- data/sorbet/rbi/gems/method_source@1.0.0.rbi +8 -0
- data/sorbet/rbi/gems/minitest-reporters@1.5.0.rbi +612 -0
- data/sorbet/rbi/gems/minitest@5.15.0.rbi +994 -0
- data/sorbet/rbi/gems/parallel@1.22.1.rbi +163 -0
- data/sorbet/rbi/gems/parser@3.1.2.0.rbi +3968 -0
- data/sorbet/rbi/gems/prettier_print@0.1.0.rbi +734 -0
- data/sorbet/rbi/gems/pry@0.14.1.rbi +8 -0
- data/sorbet/rbi/gems/rainbow@3.1.1.rbi +227 -0
- data/sorbet/rbi/gems/rake@13.0.6.rbi +1853 -0
- data/sorbet/rbi/gems/rbi@0.0.14.rbi +2337 -0
- data/sorbet/rbi/gems/regexp_parser@2.5.0.rbi +1854 -0
- data/sorbet/rbi/gems/reline@0.3.1.rbi +1274 -0
- data/sorbet/rbi/gems/rexml@3.2.5.rbi +3852 -0
- data/sorbet/rbi/gems/rubocop-ast@1.18.0.rbi +4180 -0
- data/sorbet/rbi/gems/rubocop-minitest@0.20.0.rbi +1369 -0
- data/sorbet/rbi/gems/rubocop-rake@0.6.0.rbi +246 -0
- data/sorbet/rbi/gems/rubocop-shopify@2.6.0.rbi +8 -0
- data/sorbet/rbi/gems/rubocop-sorbet@0.6.8.rbi +652 -0
- data/sorbet/rbi/gems/rubocop@1.30.0.rbi +36729 -0
- data/sorbet/rbi/gems/ruby-progressbar@1.11.0.rbi +732 -0
- data/sorbet/rbi/gems/spoom@1.1.11.rbi +1600 -0
- data/sorbet/rbi/gems/syntax_tree@2.7.1.rbi +6777 -0
- data/sorbet/rbi/gems/tapioca@0.8.1.rbi +1972 -0
- data/sorbet/rbi/gems/thor@1.2.1.rbi +2921 -0
- data/sorbet/rbi/gems/unicode-display_width@2.1.0.rbi +27 -0
- data/sorbet/rbi/gems/unparser@0.6.5.rbi +2789 -0
- data/sorbet/rbi/gems/webrick@1.7.0.rbi +1779 -0
- data/sorbet/rbi/gems/yard-sorbet@0.6.1.rbi +289 -0
- data/sorbet/rbi/gems/yard@0.9.27.rbi +13048 -0
- data/sorbet/rbi/shims/fiddle.rbi +4 -0
- data/sorbet/rbi/shims/hash.rbi +6 -0
- data/sorbet/rbi/shims/rdoc.rbi +4 -0
- data/sorbet/tapioca/config.yml +13 -0
- data/sorbet/tapioca/require.rb +7 -0
- metadata +74 -6
- data/shipit.production.yml +0 -1
@@ -0,0 +1,4180 @@
|
|
1
|
+
# typed: true
|
2
|
+
|
3
|
+
# DO NOT EDIT MANUALLY
|
4
|
+
# This is an autogenerated file for types exported from the `rubocop-ast` gem.
|
5
|
+
# Please instead update this file by running `bin/tapioca gem rubocop-ast`.
|
6
|
+
|
7
|
+
module RuboCop; end
|
8
|
+
|
9
|
+
# ...
|
10
|
+
module RuboCop::AST
|
11
|
+
extend ::RuboCop::AST::RuboCopCompatibility
|
12
|
+
end
|
13
|
+
|
14
|
+
# A node extension for `alias` nodes. This will be used in place of a plain
|
15
|
+
# node when the builder constructs the AST, making its methods available
|
16
|
+
# to all `alias` nodes within RuboCop.
|
17
|
+
class RuboCop::AST::AliasNode < ::RuboCop::AST::Node
|
18
|
+
# Returns the new identifier as specified by the `alias`.
|
19
|
+
#
|
20
|
+
# @return [SymbolNode] the new identifier
|
21
|
+
def new_identifier; end
|
22
|
+
|
23
|
+
# Returns the old identifier as specified by the `alias`.
|
24
|
+
#
|
25
|
+
# @return [SymbolNode] the old identifier
|
26
|
+
def old_identifier; end
|
27
|
+
end
|
28
|
+
|
29
|
+
# A node extension for `op_asgn` nodes.
|
30
|
+
# This will be used in place of a plain node when the builder constructs
|
31
|
+
# the AST, making its methods available to all assignment nodes within RuboCop.
|
32
|
+
class RuboCop::AST::AndAsgnNode < ::RuboCop::AST::OpAsgnNode
|
33
|
+
# The operator being used for assignment as a symbol.
|
34
|
+
#
|
35
|
+
# @return [Symbol] the assignment operator
|
36
|
+
def operator; end
|
37
|
+
end
|
38
|
+
|
39
|
+
# A node extension for `until` nodes. This will be used in place of a plain
|
40
|
+
# node when the builder constructs the AST, making its methods available
|
41
|
+
# to all `until` nodes within RuboCop.
|
42
|
+
class RuboCop::AST::AndNode < ::RuboCop::AST::Node
|
43
|
+
include ::RuboCop::AST::BinaryOperatorNode
|
44
|
+
include ::RuboCop::AST::PredicateOperatorNode
|
45
|
+
|
46
|
+
# Returns the alternate operator of the `and` as a string.
|
47
|
+
# Returns `and` for `&&` and vice versa.
|
48
|
+
#
|
49
|
+
# @return [String] the alternate of the `and` operator
|
50
|
+
def alternate_operator; end
|
51
|
+
|
52
|
+
# Returns the inverse keyword of the `and` node as a string.
|
53
|
+
# Returns `||` for `&&` and `or` for `and`.
|
54
|
+
#
|
55
|
+
# @return [String] the inverse of the `and` operator
|
56
|
+
def inverse_operator; end
|
57
|
+
end
|
58
|
+
|
59
|
+
# A node extension for `arg`, `optarg`, `restarg`, `kwarg`, `kwoptarg`,
|
60
|
+
# `kwrestarg`, `blockarg`, `shadowarg` and `forward_arg` nodes.
|
61
|
+
# This will be used in place of a plain node when the builder constructs
|
62
|
+
# the AST, making its methods available to all `arg` nodes within RuboCop.
|
63
|
+
class RuboCop::AST::ArgNode < ::RuboCop::AST::Node
|
64
|
+
# Checks whether the argument has a default value
|
65
|
+
#
|
66
|
+
# @return [Boolean] whether the argument has a default value
|
67
|
+
def default?; end
|
68
|
+
|
69
|
+
# Returns the default value of the argument, if any.
|
70
|
+
#
|
71
|
+
# @return [Node, nil] the default value of the argument
|
72
|
+
def default_value; end
|
73
|
+
|
74
|
+
# Returns the name of an argument.
|
75
|
+
#
|
76
|
+
# @return [Symbol, nil] the name of the argument
|
77
|
+
def name; end
|
78
|
+
end
|
79
|
+
|
80
|
+
# A node extension for `args` nodes. This will be used in place of a plain
|
81
|
+
# node when the builder constructs the AST, making its methods available
|
82
|
+
# to all `args` nodes within RuboCop.
|
83
|
+
class RuboCop::AST::ArgsNode < ::RuboCop::AST::Node
|
84
|
+
include ::RuboCop::AST::CollectionNode
|
85
|
+
|
86
|
+
# Yield each argument from the collection.
|
87
|
+
# Arguments can be inside `mlhs` nodes in the case of destructuring, so this
|
88
|
+
# flattens the collection to just `arg`, `optarg`, `restarg`, `kwarg`,
|
89
|
+
# `kwoptarg`, `kwrestarg`, `blockarg`, `forward_arg` and `shadowarg`.
|
90
|
+
#
|
91
|
+
# @return [Array<Node>] array of argument nodes.
|
92
|
+
def argument_list; end
|
93
|
+
|
94
|
+
# It returns true if arguments are empty and delimiters do not exist.
|
95
|
+
# @example:
|
96
|
+
# # true
|
97
|
+
# def x; end
|
98
|
+
# x { }
|
99
|
+
# -> {}
|
100
|
+
#
|
101
|
+
# # false
|
102
|
+
# def x(); end
|
103
|
+
# def x a; end
|
104
|
+
# x { || }
|
105
|
+
# -> () {}
|
106
|
+
# -> a {}
|
107
|
+
#
|
108
|
+
# @return [Boolean]
|
109
|
+
def empty_and_without_delimiters?; end
|
110
|
+
end
|
111
|
+
|
112
|
+
# A node extension for `array` nodes. This will be used in place of a plain
|
113
|
+
# node when the builder constructs the AST, making its methods available
|
114
|
+
# to all `array` nodes within RuboCop.
|
115
|
+
class RuboCop::AST::ArrayNode < ::RuboCop::AST::Node
|
116
|
+
# Checks whether the `array` literal is delimited by either percent or
|
117
|
+
# square brackets
|
118
|
+
#
|
119
|
+
# brackets
|
120
|
+
#
|
121
|
+
# @return [Boolean] whether the array is enclosed in percent or square
|
122
|
+
def bracketed?; end
|
123
|
+
|
124
|
+
# @deprecated Use `values.each` (a.k.a. `children.each`)
|
125
|
+
def each_value(&block); end
|
126
|
+
|
127
|
+
# Checks whether the `array` literal is delimited by percent brackets.
|
128
|
+
#
|
129
|
+
# @overload percent_literal?
|
130
|
+
# @overload percent_literal?
|
131
|
+
# @return [Boolean] whether the array is enclosed in percent brackets
|
132
|
+
def percent_literal?(type = T.unsafe(nil)); end
|
133
|
+
|
134
|
+
# Checks whether the `array` literal is delimited by square brackets.
|
135
|
+
#
|
136
|
+
# @return [Boolean] whether the array is enclosed in square brackets
|
137
|
+
def square_brackets?; end
|
138
|
+
|
139
|
+
# Returns an array of all value nodes in the `array` literal.
|
140
|
+
#
|
141
|
+
# @return [Array<Node>] an array of value nodes
|
142
|
+
def values; end
|
143
|
+
end
|
144
|
+
|
145
|
+
RuboCop::AST::ArrayNode::PERCENT_LITERAL_TYPES = T.let(T.unsafe(nil), Hash)
|
146
|
+
|
147
|
+
# A node extension for `lvasgn`, `ivasgn`, `cvasgn`, and `gvasgn` nodes.
|
148
|
+
# This will be used in place of a plain node when the builder constructs
|
149
|
+
# the AST, making its methods available to all assignment nodes within RuboCop.
|
150
|
+
class RuboCop::AST::AsgnNode < ::RuboCop::AST::Node
|
151
|
+
# The expression being assigned to the variable.
|
152
|
+
#
|
153
|
+
# @return [Node] the expression being assigned.
|
154
|
+
def expression; end
|
155
|
+
|
156
|
+
# The name of the variable being assigned as a symbol.
|
157
|
+
#
|
158
|
+
# @return [Symbol] the name of the variable being assigned
|
159
|
+
def name; end
|
160
|
+
end
|
161
|
+
|
162
|
+
# Common functionality for primitive literal nodes: `sym`, `str`,
|
163
|
+
# `int`, `float`, ...
|
164
|
+
module RuboCop::AST::BasicLiteralNode
|
165
|
+
# Returns the value of the literal.
|
166
|
+
#
|
167
|
+
# @return [mixed] the value of the literal
|
168
|
+
def value; end
|
169
|
+
end
|
170
|
+
|
171
|
+
# Common functionality for nodes that are binary operations:
|
172
|
+
# `or`, `and` ...
|
173
|
+
module RuboCop::AST::BinaryOperatorNode
|
174
|
+
# Returns all of the conditions, including nested conditions,
|
175
|
+
# of the binary operation.
|
176
|
+
#
|
177
|
+
# operation and the let and right hand side of any nested binary
|
178
|
+
# operators
|
179
|
+
#
|
180
|
+
# @return [Array<Node>] the left and right hand side of the binary
|
181
|
+
def conditions; end
|
182
|
+
|
183
|
+
# Returns the left hand side node of the binary operation.
|
184
|
+
#
|
185
|
+
# @return [Node] the left hand side of the binary operation
|
186
|
+
def lhs; end
|
187
|
+
|
188
|
+
# Returns the right hand side node of the binary operation.
|
189
|
+
#
|
190
|
+
# @return [Node] the right hand side of the binary operation
|
191
|
+
def rhs; end
|
192
|
+
end
|
193
|
+
|
194
|
+
# A node extension for `block` nodes. This will be used in place of a plain
|
195
|
+
# node when the builder constructs the AST, making its methods available
|
196
|
+
# to all `send` nodes within RuboCop.
|
197
|
+
#
|
198
|
+
# A `block` node is essentially a method send with a block. Parser nests
|
199
|
+
# the `send` node inside the `block` node.
|
200
|
+
class RuboCop::AST::BlockNode < ::RuboCop::AST::Node
|
201
|
+
include ::RuboCop::AST::MethodIdentifierPredicates
|
202
|
+
|
203
|
+
# Returns a collection of all descendants of this node that are
|
204
|
+
# argument type nodes. See `ArgsNode#argument_list` for details.
|
205
|
+
#
|
206
|
+
# @return [Array<Node>]
|
207
|
+
def argument_list; end
|
208
|
+
|
209
|
+
# The arguments of this block.
|
210
|
+
# Note that if the block has destructured arguments, `arguments` will
|
211
|
+
# return a `mlhs` node, whereas `argument_list` will return only
|
212
|
+
# actual argument nodes.
|
213
|
+
#
|
214
|
+
# @return [Array<Node>]
|
215
|
+
def arguments; end
|
216
|
+
|
217
|
+
# Checks whether this block takes any arguments.
|
218
|
+
#
|
219
|
+
# @return [Boolean] whether this `block` node takes any arguments
|
220
|
+
def arguments?; end
|
221
|
+
|
222
|
+
# The body of this block.
|
223
|
+
#
|
224
|
+
# @return [Node, nil] the body of the `block` node or `nil`
|
225
|
+
def body; end
|
226
|
+
|
227
|
+
# Checks whether the `block` literal is delimited by curly braces.
|
228
|
+
#
|
229
|
+
# @return [Boolean] whether the `block` literal is enclosed in braces
|
230
|
+
def braces?; end
|
231
|
+
|
232
|
+
# The closing delimiter for this `block` literal.
|
233
|
+
#
|
234
|
+
# @return [String] the closing delimiter for the `block` literal
|
235
|
+
def closing_delimiter; end
|
236
|
+
|
237
|
+
# The delimiters for this `block` literal.
|
238
|
+
#
|
239
|
+
# @return [Array<String>] the delimiters for the `block` literal
|
240
|
+
def delimiters; end
|
241
|
+
|
242
|
+
# Checks whether the `block` literal is delimited by `do`-`end` keywords.
|
243
|
+
#
|
244
|
+
# @return [Boolean] whether the `block` literal is enclosed in `do`-`end`
|
245
|
+
def keywords?; end
|
246
|
+
|
247
|
+
# Checks whether this `block` literal belongs to a lambda.
|
248
|
+
#
|
249
|
+
# @return [Boolean] whether the `block` literal belongs to a lambda
|
250
|
+
def lambda?; end
|
251
|
+
|
252
|
+
# The name of the dispatched method as a symbol.
|
253
|
+
#
|
254
|
+
# @return [Symbol] the name of the dispatched method
|
255
|
+
def method_name; end
|
256
|
+
|
257
|
+
# Checks whether this is a multiline block. This is overridden here
|
258
|
+
# because the general version in `Node` does not work for `block` nodes.
|
259
|
+
#
|
260
|
+
# @return [Boolean] whether the `block` literal is on a several lines
|
261
|
+
def multiline?; end
|
262
|
+
|
263
|
+
# The opening delimiter for this `block` literal.
|
264
|
+
#
|
265
|
+
# @return [String] the opening delimiter for the `block` literal
|
266
|
+
def opening_delimiter; end
|
267
|
+
|
268
|
+
# The `send` node associated with this block.
|
269
|
+
#
|
270
|
+
# @return [SendNode] the `send` node associated with the `block` node
|
271
|
+
def send_node; end
|
272
|
+
|
273
|
+
# Checks whether this is a single line block. This is overridden here
|
274
|
+
# because the general version in `Node` does not work for `block` nodes.
|
275
|
+
#
|
276
|
+
# @return [Boolean] whether the `block` literal is on a single line
|
277
|
+
def single_line?; end
|
278
|
+
|
279
|
+
# Checks whether this node body is a void context.
|
280
|
+
#
|
281
|
+
# @return [Boolean] whether the `block` node body is a void context
|
282
|
+
def void_context?; end
|
283
|
+
|
284
|
+
private
|
285
|
+
|
286
|
+
# Numbered arguments of this `numblock`.
|
287
|
+
def numbered_arguments; end
|
288
|
+
end
|
289
|
+
|
290
|
+
RuboCop::AST::BlockNode::VOID_CONTEXT_METHODS = T.let(T.unsafe(nil), Array)
|
291
|
+
|
292
|
+
# A node extension for `break` nodes. This will be used in place of a
|
293
|
+
# plain node when the builder constructs the AST, making its methods
|
294
|
+
# available to all `break` nodes within RuboCop.
|
295
|
+
class RuboCop::AST::BreakNode < ::RuboCop::AST::Node
|
296
|
+
include ::RuboCop::AST::ParameterizedNode
|
297
|
+
include ::RuboCop::AST::ParameterizedNode::WrappedArguments
|
298
|
+
end
|
299
|
+
|
300
|
+
# `RuboCop::AST::Builder` is an AST builder that is utilized to let `Parser`
|
301
|
+
# generate ASTs with {RuboCop::AST::Node}.
|
302
|
+
#
|
303
|
+
# @example
|
304
|
+
# buffer = Parser::Source::Buffer.new('(string)')
|
305
|
+
# buffer.source = 'puts :foo'
|
306
|
+
#
|
307
|
+
# builder = RuboCop::AST::Builder.new
|
308
|
+
# require 'parser/ruby25'
|
309
|
+
# parser = Parser::Ruby25.new(builder)
|
310
|
+
# root_node = parser.parse(buffer)
|
311
|
+
class RuboCop::AST::Builder < ::Parser::Builders::Default
|
312
|
+
# Generates {Node} from the given information.
|
313
|
+
#
|
314
|
+
# @return [Node] the generated node
|
315
|
+
def n(type, children, source_map); end
|
316
|
+
|
317
|
+
# TODO: Figure out what to do about literal encoding handling...
|
318
|
+
# More details here https://github.com/whitequark/parser/issues/283
|
319
|
+
def string_value(token); end
|
320
|
+
|
321
|
+
private
|
322
|
+
|
323
|
+
def node_klass(type); end
|
324
|
+
end
|
325
|
+
|
326
|
+
# @api private
|
327
|
+
RuboCop::AST::Builder::NODE_MAP = T.let(T.unsafe(nil), Hash)
|
328
|
+
|
329
|
+
# A node extension for `case_match` nodes. This will be used in place of
|
330
|
+
# a plain node when the builder constructs the AST, making its methods
|
331
|
+
# available to all `case_match` nodes within RuboCop.
|
332
|
+
class RuboCop::AST::CaseMatchNode < ::RuboCop::AST::Node
|
333
|
+
include ::RuboCop::AST::ConditionalNode
|
334
|
+
|
335
|
+
# Returns an array of all the when branches in the `case` statement.
|
336
|
+
#
|
337
|
+
# and the `else` (if any). Note that these bodies could be nil.
|
338
|
+
#
|
339
|
+
# @return [Array<Node, nil>] an array of the bodies of the `in` branches
|
340
|
+
def branches; end
|
341
|
+
|
342
|
+
# @deprecated Use `in_pattern_branches.each`
|
343
|
+
def each_in_pattern(&block); end
|
344
|
+
|
345
|
+
# Checks whether this case statement has an `else` branch.
|
346
|
+
#
|
347
|
+
# @return [Boolean] whether the `case` statement has an `else` branch
|
348
|
+
def else?; end
|
349
|
+
|
350
|
+
# Returns the else branch of the `case` statement, if any.
|
351
|
+
#
|
352
|
+
# @return [Node] the else branch node of the `case` statement
|
353
|
+
# @return [EmptyElse] the empty else branch node of the `case` statement
|
354
|
+
# @return [nil] if the case statement does not have an else branch.
|
355
|
+
def else_branch; end
|
356
|
+
|
357
|
+
# Returns an array of all the `in` pattern branches in the `case` statement.
|
358
|
+
#
|
359
|
+
# @return [Array<InPatternNode>] an array of `in_pattern` nodes
|
360
|
+
def in_pattern_branches; end
|
361
|
+
|
362
|
+
# Returns the keyword of the `case` statement as a string.
|
363
|
+
#
|
364
|
+
# @return [String] the keyword of the `case` statement
|
365
|
+
def keyword; end
|
366
|
+
end
|
367
|
+
|
368
|
+
# A node extension for `case` nodes. This will be used in place of a plain
|
369
|
+
# node when the builder constructs the AST, making its methods available
|
370
|
+
# to all `case` nodes within RuboCop.
|
371
|
+
class RuboCop::AST::CaseNode < ::RuboCop::AST::Node
|
372
|
+
include ::RuboCop::AST::ConditionalNode
|
373
|
+
|
374
|
+
# Returns an array of all the when branches in the `case` statement.
|
375
|
+
#
|
376
|
+
# and the else (if any). Note that these bodies could be nil.
|
377
|
+
#
|
378
|
+
# @return [Array<Node, nil>] an array of the bodies of the when branches
|
379
|
+
def branches; end
|
380
|
+
|
381
|
+
# @deprecated Use `when_branches.each`
|
382
|
+
def each_when(&block); end
|
383
|
+
|
384
|
+
# Checks whether this case statement has an `else` branch.
|
385
|
+
#
|
386
|
+
# @return [Boolean] whether the `case` statement has an `else` branch
|
387
|
+
def else?; end
|
388
|
+
|
389
|
+
# Returns the else branch of the `case` statement, if any.
|
390
|
+
#
|
391
|
+
# @return [Node] the else branch node of the `case` statement
|
392
|
+
# @return [nil] if the case statement does not have an else branch.
|
393
|
+
def else_branch; end
|
394
|
+
|
395
|
+
# Returns the keyword of the `case` statement as a string.
|
396
|
+
#
|
397
|
+
# @return [String] the keyword of the `case` statement
|
398
|
+
def keyword; end
|
399
|
+
|
400
|
+
# Returns an array of all the when branches in the `case` statement.
|
401
|
+
#
|
402
|
+
# @return [Array<WhenNode>] an array of `when` nodes
|
403
|
+
def when_branches; end
|
404
|
+
end
|
405
|
+
|
406
|
+
# A node extension for `casgn` nodes.
|
407
|
+
# This will be used in place of a plain node when the builder constructs
|
408
|
+
# the AST, making its methods available to all assignment nodes within RuboCop.
|
409
|
+
class RuboCop::AST::CasgnNode < ::RuboCop::AST::Node
|
410
|
+
# The expression being assigned to the variable.
|
411
|
+
#
|
412
|
+
# @return [Node] the expression being assigned.
|
413
|
+
def expression; end
|
414
|
+
|
415
|
+
# The name of the variable being assigned as a symbol.
|
416
|
+
#
|
417
|
+
# @return [Symbol] the name of the variable being assigned
|
418
|
+
def name; end
|
419
|
+
|
420
|
+
# The namespace of the constant being assigned.
|
421
|
+
#
|
422
|
+
# @return [Node, nil] the node associated with the scope (e.g. cbase, const, ...)
|
423
|
+
def namespace; end
|
424
|
+
end
|
425
|
+
|
426
|
+
# A node extension for `class` nodes. This will be used in place of a plain
|
427
|
+
# node when the builder constructs the AST, making its methods available
|
428
|
+
# to all `class` nodes within RuboCop.
|
429
|
+
class RuboCop::AST::ClassNode < ::RuboCop::AST::Node
|
430
|
+
# The body of this `class` node.
|
431
|
+
#
|
432
|
+
# @return [Node, nil] the body of the class
|
433
|
+
def body; end
|
434
|
+
|
435
|
+
# The identifier for this `class` node.
|
436
|
+
#
|
437
|
+
# @return [Node] the identifier of the class
|
438
|
+
def identifier; end
|
439
|
+
|
440
|
+
# The parent class for this `class` node.
|
441
|
+
#
|
442
|
+
# @return [Node, nil] the parent class of the class
|
443
|
+
def parent_class; end
|
444
|
+
end
|
445
|
+
|
446
|
+
# A mixin that helps give collection nodes array polymorphism.
|
447
|
+
module RuboCop::AST::CollectionNode
|
448
|
+
extend ::Forwardable
|
449
|
+
|
450
|
+
def &(*args, **_arg1, &block); end
|
451
|
+
def *(*args, **_arg1, &block); end
|
452
|
+
def +(*args, **_arg1, &block); end
|
453
|
+
def -(*args, **_arg1, &block); end
|
454
|
+
def <<(*args, **_arg1, &block); end
|
455
|
+
def [](*args, **_arg1, &block); end
|
456
|
+
def []=(*args, **_arg1, &block); end
|
457
|
+
def all?(*args, **_arg1, &block); end
|
458
|
+
def any?(*args, **_arg1, &block); end
|
459
|
+
def append(*args, **_arg1, &block); end
|
460
|
+
def assoc(*args, **_arg1, &block); end
|
461
|
+
def at(*args, **_arg1, &block); end
|
462
|
+
def bsearch(*args, **_arg1, &block); end
|
463
|
+
def bsearch_index(*args, **_arg1, &block); end
|
464
|
+
def chain(*args, **_arg1, &block); end
|
465
|
+
def chunk(*args, **_arg1, &block); end
|
466
|
+
def chunk_while(*args, **_arg1, &block); end
|
467
|
+
def clear(*args, **_arg1, &block); end
|
468
|
+
def collect(*args, **_arg1, &block); end
|
469
|
+
def collect!(*args, **_arg1, &block); end
|
470
|
+
def collect_concat(*args, **_arg1, &block); end
|
471
|
+
def combination(*args, **_arg1, &block); end
|
472
|
+
def compact(*args, **_arg1, &block); end
|
473
|
+
def compact!(*args, **_arg1, &block); end
|
474
|
+
def concat(*args, **_arg1, &block); end
|
475
|
+
def count(*args, **_arg1, &block); end
|
476
|
+
def cycle(*args, **_arg1, &block); end
|
477
|
+
def deconstruct(*args, **_arg1, &block); end
|
478
|
+
def delete(*args, **_arg1, &block); end
|
479
|
+
def delete_at(*args, **_arg1, &block); end
|
480
|
+
def delete_if(*args, **_arg1, &block); end
|
481
|
+
def detect(*args, **_arg1, &block); end
|
482
|
+
def difference(*args, **_arg1, &block); end
|
483
|
+
def dig(*args, **_arg1, &block); end
|
484
|
+
def drop(*args, **_arg1, &block); end
|
485
|
+
def drop_while(*args, **_arg1, &block); end
|
486
|
+
def each(*args, **_arg1, &block); end
|
487
|
+
def each_cons(*args, **_arg1, &block); end
|
488
|
+
def each_entry(*args, **_arg1, &block); end
|
489
|
+
def each_index(*args, **_arg1, &block); end
|
490
|
+
def each_slice(*args, **_arg1, &block); end
|
491
|
+
def each_with_index(*args, **_arg1, &block); end
|
492
|
+
def each_with_object(*args, **_arg1, &block); end
|
493
|
+
def empty?(*args, **_arg1, &block); end
|
494
|
+
def entries(*args, **_arg1, &block); end
|
495
|
+
def fetch(*args, **_arg1, &block); end
|
496
|
+
def fill(*args, **_arg1, &block); end
|
497
|
+
def filter(*args, **_arg1, &block); end
|
498
|
+
def filter!(*args, **_arg1, &block); end
|
499
|
+
def filter_map(*args, **_arg1, &block); end
|
500
|
+
def find(*args, **_arg1, &block); end
|
501
|
+
def find_all(*args, **_arg1, &block); end
|
502
|
+
def find_index(*args, **_arg1, &block); end
|
503
|
+
def first(*args, **_arg1, &block); end
|
504
|
+
def flat_map(*args, **_arg1, &block); end
|
505
|
+
def flatten(*args, **_arg1, &block); end
|
506
|
+
def flatten!(*args, **_arg1, &block); end
|
507
|
+
def grep(*args, **_arg1, &block); end
|
508
|
+
def grep_v(*args, **_arg1, &block); end
|
509
|
+
def group_by(*args, **_arg1, &block); end
|
510
|
+
def include?(*args, **_arg1, &block); end
|
511
|
+
def index(*args, **_arg1, &block); end
|
512
|
+
def inject(*args, **_arg1, &block); end
|
513
|
+
def insert(*args, **_arg1, &block); end
|
514
|
+
def intersect?(*args, **_arg1, &block); end
|
515
|
+
def intersection(*args, **_arg1, &block); end
|
516
|
+
def join(*args, **_arg1, &block); end
|
517
|
+
def keep_if(*args, **_arg1, &block); end
|
518
|
+
def last(*args, **_arg1, &block); end
|
519
|
+
def lazy(*args, **_arg1, &block); end
|
520
|
+
def length(*args, **_arg1, &block); end
|
521
|
+
def map(*args, **_arg1, &block); end
|
522
|
+
def map!(*args, **_arg1, &block); end
|
523
|
+
def max(*args, **_arg1, &block); end
|
524
|
+
def max_by(*args, **_arg1, &block); end
|
525
|
+
def member?(*args, **_arg1, &block); end
|
526
|
+
def min(*args, **_arg1, &block); end
|
527
|
+
def min_by(*args, **_arg1, &block); end
|
528
|
+
def minmax(*args, **_arg1, &block); end
|
529
|
+
def minmax_by(*args, **_arg1, &block); end
|
530
|
+
def none?(*args, **_arg1, &block); end
|
531
|
+
def one?(*args, **_arg1, &block); end
|
532
|
+
def pack(*args, **_arg1, &block); end
|
533
|
+
def partition(*args, **_arg1, &block); end
|
534
|
+
def permutation(*args, **_arg1, &block); end
|
535
|
+
def place(*args, **_arg1, &block); end
|
536
|
+
def pop(*args, **_arg1, &block); end
|
537
|
+
def prepend(*args, **_arg1, &block); end
|
538
|
+
def product(*args, **_arg1, &block); end
|
539
|
+
def push(*args, **_arg1, &block); end
|
540
|
+
def rassoc(*args, **_arg1, &block); end
|
541
|
+
def reduce(*args, **_arg1, &block); end
|
542
|
+
def reject(*args, **_arg1, &block); end
|
543
|
+
def reject!(*args, **_arg1, &block); end
|
544
|
+
def repeated_combination(*args, **_arg1, &block); end
|
545
|
+
def repeated_permutation(*args, **_arg1, &block); end
|
546
|
+
def replace(*args, **_arg1, &block); end
|
547
|
+
def reverse(*args, **_arg1, &block); end
|
548
|
+
def reverse!(*args, **_arg1, &block); end
|
549
|
+
def reverse_each(*args, **_arg1, &block); end
|
550
|
+
def rindex(*args, **_arg1, &block); end
|
551
|
+
def rotate(*args, **_arg1, &block); end
|
552
|
+
def rotate!(*args, **_arg1, &block); end
|
553
|
+
def sample(*args, **_arg1, &block); end
|
554
|
+
def select(*args, **_arg1, &block); end
|
555
|
+
def select!(*args, **_arg1, &block); end
|
556
|
+
def shelljoin(*args, **_arg1, &block); end
|
557
|
+
def shift(*args, **_arg1, &block); end
|
558
|
+
def shuffle(*args, **_arg1, &block); end
|
559
|
+
def shuffle!(*args, **_arg1, &block); end
|
560
|
+
def size(*args, **_arg1, &block); end
|
561
|
+
def slice(*args, **_arg1, &block); end
|
562
|
+
def slice!(*args, **_arg1, &block); end
|
563
|
+
def slice_after(*args, **_arg1, &block); end
|
564
|
+
def slice_before(*args, **_arg1, &block); end
|
565
|
+
def slice_when(*args, **_arg1, &block); end
|
566
|
+
def sort(*args, **_arg1, &block); end
|
567
|
+
def sort!(*args, **_arg1, &block); end
|
568
|
+
def sort_by(*args, **_arg1, &block); end
|
569
|
+
def sort_by!(*args, **_arg1, &block); end
|
570
|
+
def sum(*args, **_arg1, &block); end
|
571
|
+
def take(*args, **_arg1, &block); end
|
572
|
+
def take_while(*args, **_arg1, &block); end
|
573
|
+
def tally(*args, **_arg1, &block); end
|
574
|
+
def to_ary(*args, **_arg1, &block); end
|
575
|
+
def to_h(*args, **_arg1, &block); end
|
576
|
+
def to_set(*args, **_arg1, &block); end
|
577
|
+
def transpose(*args, **_arg1, &block); end
|
578
|
+
def union(*args, **_arg1, &block); end
|
579
|
+
def uniq(*args, **_arg1, &block); end
|
580
|
+
def uniq!(*args, **_arg1, &block); end
|
581
|
+
def unshift(*args, **_arg1, &block); end
|
582
|
+
def values_at(*args, **_arg1, &block); end
|
583
|
+
def zip(*args, **_arg1, &block); end
|
584
|
+
def |(*args, **_arg1, &block); end
|
585
|
+
end
|
586
|
+
|
587
|
+
RuboCop::AST::CollectionNode::ARRAY_METHODS = T.let(T.unsafe(nil), Array)
|
588
|
+
|
589
|
+
# Common functionality for nodes that have conditions:
|
590
|
+
# `if`, `while`, `until`, `case`.
|
591
|
+
# This currently doesn't include `when` nodes, because they have multiple
|
592
|
+
# conditions, and need to be checked for that.
|
593
|
+
module RuboCop::AST::ConditionalNode
|
594
|
+
# Returns the body associated with the condition. This works together with
|
595
|
+
# each node's custom destructuring method to select the correct part of
|
596
|
+
# the node.
|
597
|
+
#
|
598
|
+
# @note For `if` nodes, this is the truthy branch.
|
599
|
+
# @return [Node, nil] the body of the node
|
600
|
+
def body; end
|
601
|
+
|
602
|
+
# Returns the condition of the node. This works together with each node's
|
603
|
+
# custom destructuring method to select the correct part of the node.
|
604
|
+
#
|
605
|
+
# @return [Node, nil] the condition of the node
|
606
|
+
def condition; end
|
607
|
+
|
608
|
+
# Checks whether the condition of the node is written on more than
|
609
|
+
# one line.
|
610
|
+
#
|
611
|
+
# @return [Boolean] whether the condition is on more than one line
|
612
|
+
def multiline_condition?; end
|
613
|
+
|
614
|
+
# Checks whether the condition of the node is written on a single line.
|
615
|
+
#
|
616
|
+
# @return [Boolean] whether the condition is on a single line
|
617
|
+
def single_line_condition?; end
|
618
|
+
end
|
619
|
+
|
620
|
+
# A node extension for `const` nodes.
|
621
|
+
class RuboCop::AST::ConstNode < ::RuboCop::AST::Node
|
622
|
+
# @return [Boolean] if the constant starts with `::` (aka s(:cbase))
|
623
|
+
def absolute?; end
|
624
|
+
|
625
|
+
# @return [Boolean] if the constant is a Module / Class, according to the standard convention.
|
626
|
+
# Note: some classes might have uppercase in which case this method
|
627
|
+
# returns false
|
628
|
+
def class_name?; end
|
629
|
+
|
630
|
+
# Yield nodes for the namespace
|
631
|
+
#
|
632
|
+
# For `::Foo::Bar::BAZ` => yields:
|
633
|
+
# s(:cbase), then
|
634
|
+
# s(:const, :Foo), then
|
635
|
+
# s(:const, s(:const, :Foo), :Bar)
|
636
|
+
def each_path(&block); end
|
637
|
+
|
638
|
+
# @return [Boolean] if the constant is a Module / Class, according to the standard convention.
|
639
|
+
# Note: some classes might have uppercase in which case this method
|
640
|
+
# returns false
|
641
|
+
def module_name?; end
|
642
|
+
|
643
|
+
# @return [Node, nil] the node associated with the scope (e.g. cbase, const, ...)
|
644
|
+
def namespace; end
|
645
|
+
|
646
|
+
# @return [Boolean] if the constant does not start with `::` (aka s(:cbase))
|
647
|
+
def relative?; end
|
648
|
+
|
649
|
+
# @return [Symbol] the demodulized name of the constant: "::Foo::Bar" => :Bar
|
650
|
+
def short_name; end
|
651
|
+
end
|
652
|
+
|
653
|
+
# A node extension for `def` nodes. This will be used in place of a plain
|
654
|
+
# node when the builder constructs the AST, making its methods available
|
655
|
+
# to all `def` nodes within RuboCop.
|
656
|
+
class RuboCop::AST::DefNode < ::RuboCop::AST::Node
|
657
|
+
include ::RuboCop::AST::ParameterizedNode
|
658
|
+
include ::RuboCop::AST::MethodIdentifierPredicates
|
659
|
+
|
660
|
+
# Checks whether this method definition node forwards its arguments
|
661
|
+
# as per the feature added in Ruby 2.7.
|
662
|
+
#
|
663
|
+
# @note This is written in a way that may support lead arguments
|
664
|
+
# which are rumored to be added in a later version of Ruby.
|
665
|
+
# @return [Boolean] whether the `def` node uses argument forwarding
|
666
|
+
def argument_forwarding?; end
|
667
|
+
|
668
|
+
# An array containing the arguments of the method definition.
|
669
|
+
#
|
670
|
+
# @return [Array<Node>] the arguments of the method definition
|
671
|
+
def arguments; end
|
672
|
+
|
673
|
+
# The body of the method definition.
|
674
|
+
#
|
675
|
+
# @note this can be either a `begin` node, if the method body contains
|
676
|
+
# multiple expressions, or any other node, if it contains a single
|
677
|
+
# expression.
|
678
|
+
# @return [Node] the body of the method definition
|
679
|
+
def body; end
|
680
|
+
|
681
|
+
# @return [Boolean] if the definition is without an `end` or not.
|
682
|
+
def endless?; end
|
683
|
+
|
684
|
+
# The name of the defined method as a symbol.
|
685
|
+
#
|
686
|
+
# @return [Symbol] the name of the defined method
|
687
|
+
def method_name; end
|
688
|
+
|
689
|
+
# The receiver of the method definition, if any.
|
690
|
+
#
|
691
|
+
# @return [Node, nil] the receiver of the method definition, or `nil`.
|
692
|
+
def receiver; end
|
693
|
+
|
694
|
+
# Checks whether this node body is a void context.
|
695
|
+
#
|
696
|
+
# @return [Boolean] whether the `def` node body is a void context
|
697
|
+
def void_context?; end
|
698
|
+
end
|
699
|
+
|
700
|
+
# A node extension for `defined?` nodes. This will be used in place of a
|
701
|
+
# plain node when the builder constructs the AST, making its methods
|
702
|
+
# available to all `send` nodes within RuboCop.
|
703
|
+
class RuboCop::AST::DefinedNode < ::RuboCop::AST::Node
|
704
|
+
include ::RuboCop::AST::ParameterizedNode
|
705
|
+
include ::RuboCop::AST::MethodIdentifierPredicates
|
706
|
+
include ::RuboCop::AST::MethodDispatchNode
|
707
|
+
|
708
|
+
def arguments; end
|
709
|
+
def node_parts; end
|
710
|
+
end
|
711
|
+
|
712
|
+
# Common functionality for primitive literal nodes: `sym`, `str`,
|
713
|
+
# `int`, `float`, ...
|
714
|
+
module RuboCop::AST::Descendence
|
715
|
+
# Returns an array of child nodes.
|
716
|
+
# This is a shorthand for `node.each_child_node.to_a`.
|
717
|
+
#
|
718
|
+
# @return [Array<Node>] an array of child nodes
|
719
|
+
def child_nodes; end
|
720
|
+
|
721
|
+
# Returns an array of descendant nodes.
|
722
|
+
# This is a shorthand for `node.each_descendant.to_a`.
|
723
|
+
#
|
724
|
+
# @return [Array<Node>] an array of descendant nodes
|
725
|
+
def descendants; end
|
726
|
+
|
727
|
+
# Calls the given block for each child node.
|
728
|
+
# If no block is given, an `Enumerator` is returned.
|
729
|
+
#
|
730
|
+
# Note that this is different from `node.children.each { |child| ... }`
|
731
|
+
# which yields all children including non-node elements.
|
732
|
+
#
|
733
|
+
# @overload each_child_node
|
734
|
+
# @overload each_child_node
|
735
|
+
# @return [self] if a block is given
|
736
|
+
# @return [Enumerator] if no block is given
|
737
|
+
# @yieldparam node [Node] each child node
|
738
|
+
def each_child_node(*types); end
|
739
|
+
|
740
|
+
# Calls the given block for each descendant node with depth first order.
|
741
|
+
# If no block is given, an `Enumerator` is returned.
|
742
|
+
#
|
743
|
+
# @overload each_descendant
|
744
|
+
# @overload each_descendant
|
745
|
+
# @overload each_descendant
|
746
|
+
# @return [self] if a block is given
|
747
|
+
# @return [Enumerator] if no block is given
|
748
|
+
# @yieldparam node [Node] each descendant node
|
749
|
+
def each_descendant(*types, &block); end
|
750
|
+
|
751
|
+
# Calls the given block for the receiver and each descendant node in
|
752
|
+
# depth-first order.
|
753
|
+
# If no block is given, an `Enumerator` is returned.
|
754
|
+
#
|
755
|
+
# This method would be useful when you treat the receiver node as the root
|
756
|
+
# of a tree and want to iterate over all nodes in the tree.
|
757
|
+
#
|
758
|
+
# @overload each_node
|
759
|
+
# @overload each_node
|
760
|
+
# @overload each_node
|
761
|
+
# @return [self] if a block is given
|
762
|
+
# @return [Enumerator] if no block is given
|
763
|
+
# @yieldparam node [Node] each node
|
764
|
+
def each_node(*types, &block); end
|
765
|
+
|
766
|
+
protected
|
767
|
+
|
768
|
+
def visit_descendants(types, &block); end
|
769
|
+
end
|
770
|
+
|
771
|
+
# A node extension for `dstr` nodes. This will be used
|
772
|
+
# in place of a plain node when the builder constructs the AST, making
|
773
|
+
# its methods available to all `dstr` nodes within RuboCop.
|
774
|
+
class RuboCop::AST::DstrNode < ::RuboCop::AST::StrNode
|
775
|
+
def value; end
|
776
|
+
end
|
777
|
+
|
778
|
+
# A node extension for `ensure` nodes. This will be used in place of a plain
|
779
|
+
# node when the builder constructs the AST, making its methods available
|
780
|
+
# to all `ensure` nodes within RuboCop.
|
781
|
+
class RuboCop::AST::EnsureNode < ::RuboCop::AST::Node
|
782
|
+
# Returns the body of the `ensure` clause.
|
783
|
+
#
|
784
|
+
# @return [Node, nil] The body of the `ensure`.
|
785
|
+
def body; end
|
786
|
+
end
|
787
|
+
|
788
|
+
module RuboCop::AST::Ext; end
|
789
|
+
|
790
|
+
# Extensions to Parser::AST::Range
|
791
|
+
module RuboCop::AST::Ext::Range
|
792
|
+
# If `exclude_end` is `true`, then the range will be exclusive.
|
793
|
+
#
|
794
|
+
# Assume that `node` corresponds to the following array literal:
|
795
|
+
#
|
796
|
+
# [
|
797
|
+
# :foo,
|
798
|
+
# :bar
|
799
|
+
# ]
|
800
|
+
#
|
801
|
+
# node.loc.begin.line_span # => 1..1
|
802
|
+
# node.loc.expression.line_span(exclude_end: true) # => 1...4
|
803
|
+
#
|
804
|
+
# @return [Range] the range of line numbers for the node
|
805
|
+
def line_span(exclude_end: T.unsafe(nil)); end
|
806
|
+
end
|
807
|
+
|
808
|
+
# Refinement to circumvent broken `Range#minmax` for infinity ranges in 2.6-
|
809
|
+
module RuboCop::AST::Ext::RangeMinMax; end
|
810
|
+
|
811
|
+
# A node extension for `float` nodes. This will be used in place of a plain
|
812
|
+
# node when the builder constructs the AST, making its methods available to
|
813
|
+
# all `float` nodes within RuboCop.
|
814
|
+
class RuboCop::AST::FloatNode < ::RuboCop::AST::Node
|
815
|
+
include ::RuboCop::AST::BasicLiteralNode
|
816
|
+
include ::RuboCop::AST::NumericNode
|
817
|
+
end
|
818
|
+
|
819
|
+
# A node extension for `for` nodes. This will be used in place of a plain
|
820
|
+
# node when the builder constructs the AST, making its methods available
|
821
|
+
# to all `for` nodes within RuboCop.
|
822
|
+
class RuboCop::AST::ForNode < ::RuboCop::AST::Node
|
823
|
+
# Returns the body of the `for` loop.
|
824
|
+
#
|
825
|
+
# @return [Node, nil] The body of the `for` loop.
|
826
|
+
def body; end
|
827
|
+
|
828
|
+
# Returns the collection the `for` loop is iterating over.
|
829
|
+
#
|
830
|
+
# @return [Node] The collection the `for` loop is iterating over
|
831
|
+
def collection; end
|
832
|
+
|
833
|
+
# Checks whether the `for` node has a `do` keyword.
|
834
|
+
#
|
835
|
+
# @return [Boolean] whether the `for` node has a `do` keyword
|
836
|
+
def do?; end
|
837
|
+
|
838
|
+
# Returns the keyword of the `for` statement as a string.
|
839
|
+
#
|
840
|
+
# @return [String] the keyword of the `until` statement
|
841
|
+
def keyword; end
|
842
|
+
|
843
|
+
# Returns the iteration variable of the `for` loop.
|
844
|
+
#
|
845
|
+
# @return [Node] The iteration variable of the `for` loop
|
846
|
+
def variable; end
|
847
|
+
|
848
|
+
# Checks whether this node body is a void context.
|
849
|
+
# Always `true` for `for`.
|
850
|
+
#
|
851
|
+
# @return [true] whether the `for` node body is a void context
|
852
|
+
def void_context?; end
|
853
|
+
end
|
854
|
+
|
855
|
+
# A node extension for `forward-args` nodes. This will be used in place
|
856
|
+
# of a plain node when the builder constructs the AST, making its methods
|
857
|
+
# available to all `forward-args` nodes within RuboCop.
|
858
|
+
#
|
859
|
+
# Not used with modern emitters:
|
860
|
+
#
|
861
|
+
# $ ruby-parse -e "def foo(...); end"
|
862
|
+
# (def :foo
|
863
|
+
# (args
|
864
|
+
# (forward-arg)) nil)
|
865
|
+
# $ ruby-parse --legacy -e "->(foo) { bar }"
|
866
|
+
# (def :foo
|
867
|
+
# (forward-args) nil)
|
868
|
+
#
|
869
|
+
# Note the extra 's' with legacy form.
|
870
|
+
#
|
871
|
+
# The main RuboCop runs in legacy mode; this node is only used
|
872
|
+
# if user `AST::Builder.modernize` or `AST::Builder.emit_lambda=true`
|
873
|
+
class RuboCop::AST::ForwardArgsNode < ::RuboCop::AST::Node
|
874
|
+
include ::RuboCop::AST::CollectionNode
|
875
|
+
|
876
|
+
# Node wraps itself in an array to be compatible with other
|
877
|
+
# enumerable argument types.
|
878
|
+
def to_a; end
|
879
|
+
end
|
880
|
+
|
881
|
+
# Common functionality for nodes that can be used as hash elements:
|
882
|
+
# `pair`, `kwsplat`
|
883
|
+
module RuboCop::AST::HashElementNode
|
884
|
+
# Returns the delta between this element's delimiter and the argument's.
|
885
|
+
#
|
886
|
+
# @note Pairs with different delimiter styles return a delta of 0
|
887
|
+
# @return [Integer] the delta between the two delimiters
|
888
|
+
def delimiter_delta(other); end
|
889
|
+
|
890
|
+
# Returns the key of this `hash` element.
|
891
|
+
#
|
892
|
+
# @note For keyword splats, this returns the whole node
|
893
|
+
# @return [Node] the key of the hash element
|
894
|
+
def key; end
|
895
|
+
|
896
|
+
# Returns the delta between this pair's key and the argument pair's.
|
897
|
+
#
|
898
|
+
# @note Keys on the same line always return a delta of 0
|
899
|
+
# @note Keyword splats always return a delta of 0 for right alignment
|
900
|
+
# @param alignment [Symbol] whether to check the left or right side
|
901
|
+
# @return [Integer] the delta between the two keys
|
902
|
+
def key_delta(other, alignment = T.unsafe(nil)); end
|
903
|
+
|
904
|
+
# Checks whether this `hash` element is on the same line as `other`.
|
905
|
+
#
|
906
|
+
# @note A multiline element is considered to be on the same line if it
|
907
|
+
# shares any of its lines with `other`
|
908
|
+
# @return [Boolean] whether this element is on the same line as `other`
|
909
|
+
def same_line?(other); end
|
910
|
+
|
911
|
+
# Returns the value of this `hash` element.
|
912
|
+
#
|
913
|
+
# @note For keyword splats, this returns the whole node
|
914
|
+
# @return [Node] the value of the hash element
|
915
|
+
def value; end
|
916
|
+
|
917
|
+
# Returns the delta between this element's value and the argument's.
|
918
|
+
#
|
919
|
+
# @note Keyword splats always return a delta of 0
|
920
|
+
# @return [Integer] the delta between the two values
|
921
|
+
def value_delta(other); end
|
922
|
+
end
|
923
|
+
|
924
|
+
# A helper class for comparing the positions of different parts of a
|
925
|
+
# `pair` node.
|
926
|
+
class RuboCop::AST::HashElementNode::HashElementDelta
|
927
|
+
# @raise [ArgumentError]
|
928
|
+
# @return [HashElementDelta] a new instance of HashElementDelta
|
929
|
+
def initialize(first, second); end
|
930
|
+
|
931
|
+
def delimiter_delta; end
|
932
|
+
def key_delta(alignment = T.unsafe(nil)); end
|
933
|
+
def value_delta; end
|
934
|
+
|
935
|
+
private
|
936
|
+
|
937
|
+
def delta(first, second, alignment = T.unsafe(nil)); end
|
938
|
+
|
939
|
+
# Returns the value of attribute first.
|
940
|
+
def first; end
|
941
|
+
|
942
|
+
# @return [Boolean]
|
943
|
+
def keyword_splat?; end
|
944
|
+
|
945
|
+
# Returns the value of attribute second.
|
946
|
+
def second; end
|
947
|
+
|
948
|
+
# @return [Boolean]
|
949
|
+
def valid_argument_types?; end
|
950
|
+
end
|
951
|
+
|
952
|
+
# A node extension for `hash` nodes. This will be used in place of a plain
|
953
|
+
# node when the builder constructs the AST, making its methods available
|
954
|
+
# to all `hash` nodes within RuboCop.
|
955
|
+
class RuboCop::AST::HashNode < ::RuboCop::AST::Node
|
956
|
+
# Checks whether the `hash` literal is delimited by curly braces.
|
957
|
+
#
|
958
|
+
# @return [Boolean] whether the `hash` literal is enclosed in braces
|
959
|
+
def braces?; end
|
960
|
+
|
961
|
+
# Calls the given block for each `key` node in the `hash` literal.
|
962
|
+
# If no block is given, an `Enumerator` is returned.
|
963
|
+
#
|
964
|
+
# @note `kwsplat` nodes are ignored.
|
965
|
+
# @return [self] if a block is given
|
966
|
+
# @return [Enumerator] if no block is given
|
967
|
+
def each_key(&block); end
|
968
|
+
|
969
|
+
# Calls the given block for each `pair` node in the `hash` literal.
|
970
|
+
# If no block is given, an `Enumerator` is returned.
|
971
|
+
#
|
972
|
+
# @note `kwsplat` nodes are ignored.
|
973
|
+
# @return [self] if a block is given
|
974
|
+
# @return [Enumerator] if no block is given
|
975
|
+
def each_pair; end
|
976
|
+
|
977
|
+
# Calls the given block for each `value` node in the `hash` literal.
|
978
|
+
# If no block is given, an `Enumerator` is returned.
|
979
|
+
#
|
980
|
+
# @note `kwsplat` nodes are ignored.
|
981
|
+
# @return [self] if a block is given
|
982
|
+
# @return [Enumerator] if no block is given
|
983
|
+
def each_value(&block); end
|
984
|
+
|
985
|
+
# Checks whether the `hash` node contains any `pair`- or `kwsplat` nodes.
|
986
|
+
#
|
987
|
+
# @return[Boolean] whether the `hash` is empty
|
988
|
+
#
|
989
|
+
# @return [Boolean]
|
990
|
+
def empty?; end
|
991
|
+
|
992
|
+
# Returns an array of all the keys in the `hash` literal.
|
993
|
+
#
|
994
|
+
# @note `kwsplat` nodes are ignored.
|
995
|
+
# @return [Array<Node>] an array of keys in the `hash` literal
|
996
|
+
def keys; end
|
997
|
+
|
998
|
+
# Checks whether this `hash` uses a mix of hash rocket and colon
|
999
|
+
# delimiters for its pairs.
|
1000
|
+
#
|
1001
|
+
# @note `kwsplat` nodes are ignored.
|
1002
|
+
# @return [Boolean] whether the `hash` uses mixed delimiters
|
1003
|
+
def mixed_delimiters?; end
|
1004
|
+
|
1005
|
+
# Returns an array of all the key value pairs in the `hash` literal.
|
1006
|
+
#
|
1007
|
+
# ignored.
|
1008
|
+
#
|
1009
|
+
# @note this may be different from children as `kwsplat` nodes are
|
1010
|
+
# @return [Array<PairNode>] an array of `pair` nodes
|
1011
|
+
def pairs; end
|
1012
|
+
|
1013
|
+
# Checks whether any of the key value pairs in the `hash` literal are on
|
1014
|
+
# the same line.
|
1015
|
+
#
|
1016
|
+
# @note A multiline `pair` is considered to be on the same line if it
|
1017
|
+
# shares any of its lines with another `pair`
|
1018
|
+
# @note `kwsplat` nodes are ignored.
|
1019
|
+
# @return [Boolean] whether any `pair` nodes are on the same line
|
1020
|
+
def pairs_on_same_line?; end
|
1021
|
+
|
1022
|
+
# Returns an array of all the values in the `hash` literal.
|
1023
|
+
#
|
1024
|
+
# @note `kwsplat` nodes are ignored.
|
1025
|
+
# @return [Array<Node>] an array of values in the `hash` literal
|
1026
|
+
def values; end
|
1027
|
+
end
|
1028
|
+
|
1029
|
+
# A node extension for `if` nodes. This will be used in place of a plain
|
1030
|
+
# node when the builder constructs the AST, making its methods available
|
1031
|
+
# to all `if` nodes within RuboCop.
|
1032
|
+
class RuboCop::AST::IfNode < ::RuboCop::AST::Node
|
1033
|
+
include ::RuboCop::AST::ConditionalNode
|
1034
|
+
include ::RuboCop::AST::ModifierNode
|
1035
|
+
|
1036
|
+
# Returns an array of all the branches in the conditional statement.
|
1037
|
+
#
|
1038
|
+
# @return [Array<Node>] an array of branch nodes
|
1039
|
+
def branches; end
|
1040
|
+
|
1041
|
+
# @deprecated Use `branches.each`
|
1042
|
+
def each_branch(&block); end
|
1043
|
+
|
1044
|
+
# Checks whether the `if` node has an `else` clause.
|
1045
|
+
#
|
1046
|
+
# @note This returns `true` for nodes containing an `elsif` clause.
|
1047
|
+
# This is legacy behavior, and many cops rely on it.
|
1048
|
+
# @return [Boolean] whether the node has an `else` clause
|
1049
|
+
def else?; end
|
1050
|
+
|
1051
|
+
# Returns the branch of the `if` node that gets evaluated when its
|
1052
|
+
# condition is falsey.
|
1053
|
+
#
|
1054
|
+
# @note This is normalized for `unless` nodes.
|
1055
|
+
# @return [Node] the falsey branch node of the `if` node
|
1056
|
+
# @return [nil] when there is no else branch
|
1057
|
+
def else_branch; end
|
1058
|
+
|
1059
|
+
# Checks whether the `if` is an `elsif`. Parser handles these by nesting
|
1060
|
+
# `if` nodes in the `else` branch.
|
1061
|
+
#
|
1062
|
+
# @return [Boolean] whether the node is an `elsif`
|
1063
|
+
def elsif?; end
|
1064
|
+
|
1065
|
+
# Checks whether the `if` node has at least one `elsif` branch. Returns
|
1066
|
+
# true if this `if` node itself is an `elsif`.
|
1067
|
+
#
|
1068
|
+
# @return [Boolean] whether the `if` node has at least one `elsif` branch
|
1069
|
+
def elsif_conditional?; end
|
1070
|
+
|
1071
|
+
# Checks whether this node is an `if` statement. (This is not true of
|
1072
|
+
# ternary operators and `unless` statements.)
|
1073
|
+
#
|
1074
|
+
# @return [Boolean] whether the node is an `if` statement
|
1075
|
+
def if?; end
|
1076
|
+
|
1077
|
+
# Returns the branch of the `if` node that gets evaluated when its
|
1078
|
+
# condition is truthy.
|
1079
|
+
#
|
1080
|
+
# @note This is normalized for `unless` nodes.
|
1081
|
+
# @return [Node] the truthy branch node of the `if` node
|
1082
|
+
# @return [nil] if the truthy branch is empty
|
1083
|
+
def if_branch; end
|
1084
|
+
|
1085
|
+
# Returns the inverse keyword of the `if` node as a string. Returns `if`
|
1086
|
+
# for `unless` nodes and vice versa. Returns an empty string for ternary
|
1087
|
+
# operators.
|
1088
|
+
#
|
1089
|
+
# @return [String] the inverse keyword of the `if` statement
|
1090
|
+
def inverse_keyword; end
|
1091
|
+
|
1092
|
+
# Returns the keyword of the `if` statement as a string. Returns an empty
|
1093
|
+
# string for ternary operators.
|
1094
|
+
#
|
1095
|
+
# @return [String] the keyword of the `if` statement
|
1096
|
+
def keyword; end
|
1097
|
+
|
1098
|
+
# Checks whether the `if` node is in a modifier form, i.e. a condition
|
1099
|
+
# trailing behind an expression. Only `if` and `unless` nodes without
|
1100
|
+
# other branches can be modifiers.
|
1101
|
+
#
|
1102
|
+
# @return [Boolean] whether the `if` node is a modifier
|
1103
|
+
def modifier_form?; end
|
1104
|
+
|
1105
|
+
# Chacks whether the `if` node has nested `if` nodes in any of its
|
1106
|
+
# branches.
|
1107
|
+
#
|
1108
|
+
# @note This performs a shallow search.
|
1109
|
+
# @return [Boolean] whether the `if` node contains nested conditionals
|
1110
|
+
def nested_conditional?; end
|
1111
|
+
|
1112
|
+
# Custom destructuring method. This is used to normalize the branches
|
1113
|
+
# for `if` and `unless` nodes, to aid comparisons and conversions.
|
1114
|
+
#
|
1115
|
+
# @return [Array<Node>] the different parts of the `if` statement
|
1116
|
+
def node_parts; end
|
1117
|
+
|
1118
|
+
# Checks whether the `if` node is a ternary operator.
|
1119
|
+
#
|
1120
|
+
# @return [Boolean] whether the `if` node is a ternary operator
|
1121
|
+
def ternary?; end
|
1122
|
+
|
1123
|
+
# Checks whether this node is an `unless` statement. (This is not true
|
1124
|
+
# of ternary operators and `if` statements.)
|
1125
|
+
#
|
1126
|
+
# @return [Boolean] whether the node is an `unless` statement
|
1127
|
+
def unless?; end
|
1128
|
+
end
|
1129
|
+
|
1130
|
+
# A node extension for `in` nodes. This will be used in place of a plain
|
1131
|
+
# node when the builder constructs the AST, making its methods available
|
1132
|
+
# to all `in` nodes within RuboCop.
|
1133
|
+
class RuboCop::AST::InPatternNode < ::RuboCop::AST::Node
|
1134
|
+
# Returns the body of the `in` node.
|
1135
|
+
#
|
1136
|
+
# @return [Node, nil] the body of the `in` node
|
1137
|
+
def body; end
|
1138
|
+
|
1139
|
+
# Returns the index of the `in` branch within the `case` statement.
|
1140
|
+
#
|
1141
|
+
# @return [Integer] the index of the `in` branch
|
1142
|
+
def branch_index; end
|
1143
|
+
|
1144
|
+
# Returns a node of the pattern in the `in` branch.
|
1145
|
+
#
|
1146
|
+
# @return [Node] a pattern node
|
1147
|
+
def pattern; end
|
1148
|
+
|
1149
|
+
# Checks whether the `in` node has a `then` keyword.
|
1150
|
+
#
|
1151
|
+
# @return [Boolean] whether the `in` node has a `then` keyword
|
1152
|
+
def then?; end
|
1153
|
+
end
|
1154
|
+
|
1155
|
+
# Used for modern support only!
|
1156
|
+
# Not as thoroughly tested as legacy equivalent
|
1157
|
+
#
|
1158
|
+
# $ ruby-parse -e "foo[:bar]"
|
1159
|
+
# (index
|
1160
|
+
# (send nil :foo)
|
1161
|
+
# (sym :bar))
|
1162
|
+
# $ ruby-parse --legacy -e "foo[:bar]"
|
1163
|
+
# (send
|
1164
|
+
# (send nil :foo) :[]
|
1165
|
+
# (sym :bar))
|
1166
|
+
#
|
1167
|
+
# The main RuboCop runs in legacy mode; this node is only used
|
1168
|
+
# if user `AST::Builder.modernize` or `AST::Builder.emit_index=true`
|
1169
|
+
class RuboCop::AST::IndexNode < ::RuboCop::AST::Node
|
1170
|
+
include ::RuboCop::AST::ParameterizedNode
|
1171
|
+
include ::RuboCop::AST::ParameterizedNode::RestArguments
|
1172
|
+
include ::RuboCop::AST::MethodIdentifierPredicates
|
1173
|
+
include ::RuboCop::AST::MethodDispatchNode
|
1174
|
+
|
1175
|
+
# For similarity with legacy mode
|
1176
|
+
#
|
1177
|
+
# @return [Boolean]
|
1178
|
+
def assignment_method?; end
|
1179
|
+
|
1180
|
+
# For similarity with legacy mode
|
1181
|
+
#
|
1182
|
+
# @return [Boolean]
|
1183
|
+
def attribute_accessor?; end
|
1184
|
+
|
1185
|
+
# For similarity with legacy mode
|
1186
|
+
def method_name; end
|
1187
|
+
|
1188
|
+
private
|
1189
|
+
|
1190
|
+
# An array containing the arguments of the dispatched method.
|
1191
|
+
#
|
1192
|
+
# @return [Array<Node>] the arguments of the dispatched method
|
1193
|
+
def first_argument_index; end
|
1194
|
+
end
|
1195
|
+
|
1196
|
+
# Used for modern support only!
|
1197
|
+
# Not as thoroughly tested as legacy equivalent
|
1198
|
+
#
|
1199
|
+
# $ ruby-parse -e "foo[:bar] = :baz"
|
1200
|
+
# (indexasgn
|
1201
|
+
# (send nil :foo)
|
1202
|
+
# (sym :bar)
|
1203
|
+
# (sym :baz))
|
1204
|
+
# $ ruby-parse --legacy -e "foo[:bar] = :baz"
|
1205
|
+
# (send
|
1206
|
+
# (send nil :foo) :[]=
|
1207
|
+
# (sym :bar)
|
1208
|
+
# (sym :baz))
|
1209
|
+
#
|
1210
|
+
# The main RuboCop runs in legacy mode; this node is only used
|
1211
|
+
# if user `AST::Builder.modernize` or `AST::Builder.emit_index=true`
|
1212
|
+
class RuboCop::AST::IndexasgnNode < ::RuboCop::AST::Node
|
1213
|
+
include ::RuboCop::AST::ParameterizedNode
|
1214
|
+
include ::RuboCop::AST::ParameterizedNode::RestArguments
|
1215
|
+
include ::RuboCop::AST::MethodIdentifierPredicates
|
1216
|
+
include ::RuboCop::AST::MethodDispatchNode
|
1217
|
+
|
1218
|
+
# For similarity with legacy mode
|
1219
|
+
#
|
1220
|
+
# @return [Boolean]
|
1221
|
+
def assignment_method?; end
|
1222
|
+
|
1223
|
+
# For similarity with legacy mode
|
1224
|
+
#
|
1225
|
+
# @return [Boolean]
|
1226
|
+
def attribute_accessor?; end
|
1227
|
+
|
1228
|
+
# For similarity with legacy mode
|
1229
|
+
def method_name; end
|
1230
|
+
|
1231
|
+
private
|
1232
|
+
|
1233
|
+
# An array containing the arguments of the dispatched method.
|
1234
|
+
#
|
1235
|
+
# @return [Array<Node>] the arguments of the dispatched method
|
1236
|
+
def first_argument_index; end
|
1237
|
+
end
|
1238
|
+
|
1239
|
+
# A node extension for `int` nodes. This will be used in place of a plain
|
1240
|
+
# node when the builder constructs the AST, making its methods available to
|
1241
|
+
# all `int` nodes within RuboCop.
|
1242
|
+
class RuboCop::AST::IntNode < ::RuboCop::AST::Node
|
1243
|
+
include ::RuboCop::AST::BasicLiteralNode
|
1244
|
+
include ::RuboCop::AST::NumericNode
|
1245
|
+
end
|
1246
|
+
|
1247
|
+
# A node extension for `kwsplat` nodes. This will be used in place of a
|
1248
|
+
# plain node when the builder constructs the AST, making its methods
|
1249
|
+
# available to all `kwsplat` nodes within RuboCop.
|
1250
|
+
class RuboCop::AST::KeywordSplatNode < ::RuboCop::AST::Node
|
1251
|
+
include ::RuboCop::AST::HashElementNode
|
1252
|
+
|
1253
|
+
# This is used for duck typing with `pair` nodes which also appear as
|
1254
|
+
# `hash` elements.
|
1255
|
+
#
|
1256
|
+
# @return [false]
|
1257
|
+
def colon?; end
|
1258
|
+
|
1259
|
+
# This is used for duck typing with `pair` nodes which also appear as
|
1260
|
+
# `hash` elements.
|
1261
|
+
#
|
1262
|
+
# @return [false]
|
1263
|
+
def hash_rocket?; end
|
1264
|
+
|
1265
|
+
# Custom destructuring method. This is used to normalize the branches
|
1266
|
+
# for `pair` and `kwsplat` nodes, to add duck typing to `hash` elements.
|
1267
|
+
#
|
1268
|
+
# @return [Array<KeywordSplatNode>] the different parts of the `kwsplat`
|
1269
|
+
def node_parts; end
|
1270
|
+
|
1271
|
+
# Returns the operator for the `kwsplat` as a string.
|
1272
|
+
#
|
1273
|
+
# @return [String] the double splat operator
|
1274
|
+
def operator; end
|
1275
|
+
end
|
1276
|
+
|
1277
|
+
RuboCop::AST::KeywordSplatNode::DOUBLE_SPLAT = T.let(T.unsafe(nil), String)
|
1278
|
+
|
1279
|
+
# Used for modern support only:
|
1280
|
+
# Not as thoroughly tested as legacy equivalent
|
1281
|
+
#
|
1282
|
+
# $ ruby-parse -e "->(foo) { bar }"
|
1283
|
+
# (block
|
1284
|
+
# (lambda)
|
1285
|
+
# (args
|
1286
|
+
# (arg :foo))
|
1287
|
+
# (send nil :bar))
|
1288
|
+
# $ ruby-parse --legacy -e "->(foo) { bar }"
|
1289
|
+
# (block
|
1290
|
+
# (send nil :lambda)
|
1291
|
+
# (args
|
1292
|
+
# (arg :foo))
|
1293
|
+
# (send nil :bar))
|
1294
|
+
#
|
1295
|
+
# The main RuboCop runs in legacy mode; this node is only used
|
1296
|
+
# if user `AST::Builder.modernize` or `AST::Builder.emit_lambda=true`
|
1297
|
+
class RuboCop::AST::LambdaNode < ::RuboCop::AST::Node
|
1298
|
+
include ::RuboCop::AST::ParameterizedNode
|
1299
|
+
include ::RuboCop::AST::ParameterizedNode::RestArguments
|
1300
|
+
include ::RuboCop::AST::MethodIdentifierPredicates
|
1301
|
+
include ::RuboCop::AST::MethodDispatchNode
|
1302
|
+
|
1303
|
+
# For similarity with legacy mode
|
1304
|
+
#
|
1305
|
+
# @return [Boolean]
|
1306
|
+
def assignment_method?; end
|
1307
|
+
|
1308
|
+
# For similarity with legacy mode
|
1309
|
+
#
|
1310
|
+
# @return [Boolean]
|
1311
|
+
def attribute_accessor?; end
|
1312
|
+
|
1313
|
+
# For similarity with legacy mode
|
1314
|
+
#
|
1315
|
+
# @return [Boolean]
|
1316
|
+
def lambda?; end
|
1317
|
+
|
1318
|
+
# For similarity with legacy mode
|
1319
|
+
#
|
1320
|
+
# @return [Boolean]
|
1321
|
+
def lambda_literal?; end
|
1322
|
+
|
1323
|
+
# For similarity with legacy mode
|
1324
|
+
def method_name; end
|
1325
|
+
|
1326
|
+
# For similarity with legacy mode
|
1327
|
+
def receiver; end
|
1328
|
+
|
1329
|
+
private
|
1330
|
+
|
1331
|
+
# For similarity with legacy mode
|
1332
|
+
def first_argument_index; end
|
1333
|
+
end
|
1334
|
+
|
1335
|
+
# Common functionality for nodes that are a kind of method dispatch:
|
1336
|
+
# `send`, `csend`, `super`, `zsuper`, `yield`, `defined?`,
|
1337
|
+
# and (modern only): `index`, `indexasgn`, `lambda`
|
1338
|
+
module RuboCop::AST::MethodDispatchNode
|
1339
|
+
include ::RuboCop::AST::MethodIdentifierPredicates
|
1340
|
+
extend ::RuboCop::AST::NodePattern::Macros
|
1341
|
+
|
1342
|
+
# Checks whether the dispatched method is an access modifier.
|
1343
|
+
#
|
1344
|
+
# @return [Boolean] whether the dispatched method is an access modifier
|
1345
|
+
def access_modifier?; end
|
1346
|
+
|
1347
|
+
def adjacent_def_modifier?(param0 = T.unsafe(nil)); end
|
1348
|
+
|
1349
|
+
# Checks whether this node is an arithmetic operation
|
1350
|
+
#
|
1351
|
+
# @return [Boolean] whether the dispatched method is an arithmetic
|
1352
|
+
# operation
|
1353
|
+
def arithmetic_operation?; end
|
1354
|
+
|
1355
|
+
# Checks whether the dispatched method is a setter method.
|
1356
|
+
#
|
1357
|
+
# @return [Boolean] whether the dispatched method is a setter
|
1358
|
+
def assignment?; end
|
1359
|
+
|
1360
|
+
# Checks whether the dispatched method is a bare access modifier that
|
1361
|
+
# affects all methods defined after the macro.
|
1362
|
+
#
|
1363
|
+
# @return [Boolean] whether the dispatched method is a bare
|
1364
|
+
# access modifier
|
1365
|
+
def bare_access_modifier?; end
|
1366
|
+
|
1367
|
+
def bare_access_modifier_declaration?(param0 = T.unsafe(nil)); end
|
1368
|
+
|
1369
|
+
# Checks whether this is a binary operation.
|
1370
|
+
#
|
1371
|
+
# @example
|
1372
|
+
#
|
1373
|
+
# foo + bar
|
1374
|
+
# @return [Bookean] whether this method is a binary operation
|
1375
|
+
def binary_operation?; end
|
1376
|
+
|
1377
|
+
# Whether this method dispatch has an explicit block.
|
1378
|
+
#
|
1379
|
+
# @return [Boolean] whether the dispatched method has a block
|
1380
|
+
def block_literal?; end
|
1381
|
+
|
1382
|
+
# The `block` or `numblock` node associated with this method dispatch, if any.
|
1383
|
+
#
|
1384
|
+
# @return [BlockNode, nil] the `block` or `numblock` node associated with this method
|
1385
|
+
# call or `nil`
|
1386
|
+
def block_node; end
|
1387
|
+
|
1388
|
+
# Checks whether the name of the dispatched method matches the argument
|
1389
|
+
# and has an implicit receiver.
|
1390
|
+
#
|
1391
|
+
# @param name [Symbol, String] the method name to check for
|
1392
|
+
# @return [Boolean] whether the method name matches the argument
|
1393
|
+
def command?(name); end
|
1394
|
+
|
1395
|
+
# Checks whether the *explicit* receiver of this method dispatch is a
|
1396
|
+
# `const` node.
|
1397
|
+
#
|
1398
|
+
# @return [Boolean] whether the receiver of this method dispatch
|
1399
|
+
# is a `const` node
|
1400
|
+
def const_receiver?; end
|
1401
|
+
|
1402
|
+
# Checks if this node is part of a chain of `def` or `defs` modifiers.
|
1403
|
+
#
|
1404
|
+
# or `nil` if it isn't a def modifier
|
1405
|
+
#
|
1406
|
+
# @example
|
1407
|
+
#
|
1408
|
+
# private def foo; end
|
1409
|
+
# @return [Node | nil] returns the `def|defs` node this is a modifier for,
|
1410
|
+
def def_modifier(node = T.unsafe(nil)); end
|
1411
|
+
|
1412
|
+
# Checks if this node is part of a chain of `def` or `defs` modifiers.
|
1413
|
+
#
|
1414
|
+
# See also `def_modifier` that returns the node or `nil`
|
1415
|
+
#
|
1416
|
+
# @example
|
1417
|
+
#
|
1418
|
+
# private def foo; end
|
1419
|
+
# @return [Boolean] whether the `def|defs` node is a modifier or not.
|
1420
|
+
def def_modifier?(node = T.unsafe(nil)); end
|
1421
|
+
|
1422
|
+
# Checks whether the dispatched method uses a dot to connect the
|
1423
|
+
# receiver and the method name.
|
1424
|
+
#
|
1425
|
+
# This is useful for comparison operators, which can be called either
|
1426
|
+
# with or without a dot, i.e. `foo == bar` or `foo.== bar`.
|
1427
|
+
#
|
1428
|
+
# @return [Boolean] whether the method was called with a connecting dot
|
1429
|
+
def dot?; end
|
1430
|
+
|
1431
|
+
# Checks whether the dispatched method uses a double colon to connect the
|
1432
|
+
# receiver and the method name.
|
1433
|
+
#
|
1434
|
+
# @return [Boolean] whether the method was called with a connecting dot
|
1435
|
+
def double_colon?; end
|
1436
|
+
|
1437
|
+
# Checks whether the method dispatch is the implicit form of `#call`,
|
1438
|
+
# e.g. `foo.(bar)`.
|
1439
|
+
#
|
1440
|
+
# @return [Boolean] whether the method is the implicit form of `#call`
|
1441
|
+
def implicit_call?; end
|
1442
|
+
|
1443
|
+
def in_macro_scope?(param0 = T.unsafe(nil)); end
|
1444
|
+
|
1445
|
+
# Checks whether this is a lambda. Some versions of parser parses
|
1446
|
+
# non-literal lambdas as a method send.
|
1447
|
+
#
|
1448
|
+
# @return [Boolean] whether this method is a lambda
|
1449
|
+
def lambda?; end
|
1450
|
+
|
1451
|
+
# Checks whether this is a lambda literal (stabby lambda.)
|
1452
|
+
#
|
1453
|
+
# @example
|
1454
|
+
#
|
1455
|
+
# -> (foo) { bar }
|
1456
|
+
# @return [Boolean] whether this method is a lambda literal
|
1457
|
+
def lambda_literal?; end
|
1458
|
+
|
1459
|
+
# Checks whether the dispatched method is a macro method. A macro method
|
1460
|
+
# is defined as a method that sits in a class, module, or block body and
|
1461
|
+
# has an implicit receiver.
|
1462
|
+
#
|
1463
|
+
# @note This does not include DSLs that use nested blocks, like RSpec
|
1464
|
+
# @return [Boolean] whether the dispatched method is a macro method
|
1465
|
+
def macro?; end
|
1466
|
+
|
1467
|
+
# The name of the dispatched method as a symbol.
|
1468
|
+
#
|
1469
|
+
# @return [Symbol] the name of the dispatched method
|
1470
|
+
def method_name; end
|
1471
|
+
|
1472
|
+
# Checks whether the dispatched method is a non-bare access modifier that
|
1473
|
+
# affects only the method it receives.
|
1474
|
+
#
|
1475
|
+
# @return [Boolean] whether the dispatched method is a non-bare
|
1476
|
+
# access modifier
|
1477
|
+
def non_bare_access_modifier?; end
|
1478
|
+
|
1479
|
+
def non_bare_access_modifier_declaration?(param0 = T.unsafe(nil)); end
|
1480
|
+
|
1481
|
+
# The receiving node of the method dispatch.
|
1482
|
+
#
|
1483
|
+
# @return [Node, nil] the receiver of the dispatched method or `nil`
|
1484
|
+
def receiver; end
|
1485
|
+
|
1486
|
+
# Checks whether the dispatched method uses a safe navigation operator to
|
1487
|
+
# connect the receiver and the method name.
|
1488
|
+
#
|
1489
|
+
# @return [Boolean] whether the method was called with a connecting dot
|
1490
|
+
def safe_navigation?; end
|
1491
|
+
|
1492
|
+
# Checks whether the *explicit* receiver of this method dispatch is
|
1493
|
+
# `self`.
|
1494
|
+
#
|
1495
|
+
# @return [Boolean] whether the receiver of this method dispatch is `self`
|
1496
|
+
def self_receiver?; end
|
1497
|
+
|
1498
|
+
# Checks whether the dispatched method is a setter method.
|
1499
|
+
#
|
1500
|
+
# @return [Boolean] whether the dispatched method is a setter
|
1501
|
+
def setter_method?; end
|
1502
|
+
|
1503
|
+
# Checks whether the dispatched method is a bare `private` or `protected`
|
1504
|
+
# access modifier that affects all methods defined after the macro.
|
1505
|
+
#
|
1506
|
+
# @return [Boolean] whether the dispatched method is a bare
|
1507
|
+
# `private` or `protected` access modifier
|
1508
|
+
def special_modifier?; end
|
1509
|
+
|
1510
|
+
# Checks whether this is a unary operation.
|
1511
|
+
#
|
1512
|
+
# @example
|
1513
|
+
#
|
1514
|
+
# -foo
|
1515
|
+
# @return [Boolean] whether this method is a unary operation
|
1516
|
+
def unary_operation?; end
|
1517
|
+
end
|
1518
|
+
|
1519
|
+
RuboCop::AST::MethodDispatchNode::ARITHMETIC_OPERATORS = T.let(T.unsafe(nil), Array)
|
1520
|
+
RuboCop::AST::MethodDispatchNode::SPECIAL_MODIFIERS = T.let(T.unsafe(nil), Array)
|
1521
|
+
|
1522
|
+
# Common predicates for nodes that reference method identifiers:
|
1523
|
+
# `send`, `csend`, `def`, `defs`, `super`, `zsuper`
|
1524
|
+
#
|
1525
|
+
# @note this mixin expects `#method_name` and `#receiver` to be implemented
|
1526
|
+
module RuboCop::AST::MethodIdentifierPredicates
|
1527
|
+
# Checks whether the method is an assignment method.
|
1528
|
+
#
|
1529
|
+
# @return [Boolean] whether the method is an assignment
|
1530
|
+
def assignment_method?; end
|
1531
|
+
|
1532
|
+
# Checks whether the method is a bang method.
|
1533
|
+
#
|
1534
|
+
# @return [Boolean] whether the method is a bang method
|
1535
|
+
def bang_method?; end
|
1536
|
+
|
1537
|
+
# Checks whether the method is a camel case method,
|
1538
|
+
# e.g. `Integer()`.
|
1539
|
+
#
|
1540
|
+
# @return [Boolean] whether the method is a camel case method
|
1541
|
+
def camel_case_method?; end
|
1542
|
+
|
1543
|
+
# Checks whether the method is a comparison method.
|
1544
|
+
#
|
1545
|
+
# @return [Boolean] whether the method is a comparison
|
1546
|
+
def comparison_method?; end
|
1547
|
+
|
1548
|
+
# Checks whether the *explicit* receiver of node is a `const` node.
|
1549
|
+
#
|
1550
|
+
# @return [Boolean] whether the receiver of this node is a `const` node
|
1551
|
+
def const_receiver?; end
|
1552
|
+
|
1553
|
+
# Checks whether the method is an Enumerable method.
|
1554
|
+
#
|
1555
|
+
# @return [Boolean] whether the method is an Enumerable method
|
1556
|
+
def enumerable_method?; end
|
1557
|
+
|
1558
|
+
# Checks whether the method is an enumerator method.
|
1559
|
+
#
|
1560
|
+
# @return [Boolean] whether the method is an enumerator
|
1561
|
+
def enumerator_method?; end
|
1562
|
+
|
1563
|
+
# Checks whether the method name matches the argument.
|
1564
|
+
#
|
1565
|
+
# @param name [Symbol, String] the method name to check for
|
1566
|
+
# @return [Boolean] whether the method name matches the argument
|
1567
|
+
def method?(name); end
|
1568
|
+
|
1569
|
+
# Checks whether this is a negation method, i.e. `!` or keyword `not`.
|
1570
|
+
#
|
1571
|
+
# @return [Boolean] whether this method is a negation method
|
1572
|
+
def negation_method?; end
|
1573
|
+
|
1574
|
+
# Checks whether the method is a nonmutating Array method.
|
1575
|
+
#
|
1576
|
+
# @return [Boolean] whether the method is a nonmutating Array method
|
1577
|
+
def nonmutating_array_method?; end
|
1578
|
+
|
1579
|
+
# Checks whether the method is a nonmutating binary operator method.
|
1580
|
+
#
|
1581
|
+
# @return [Boolean] whether the method is a nonmutating binary operator method
|
1582
|
+
def nonmutating_binary_operator_method?; end
|
1583
|
+
|
1584
|
+
# Checks whether the method is a nonmutating Hash method.
|
1585
|
+
#
|
1586
|
+
# @return [Boolean] whether the method is a nonmutating Hash method
|
1587
|
+
def nonmutating_hash_method?; end
|
1588
|
+
|
1589
|
+
# Checks whether the method is a nonmutating operator method.
|
1590
|
+
#
|
1591
|
+
# @return [Boolean] whether the method is a nonmutating operator method
|
1592
|
+
def nonmutating_operator_method?; end
|
1593
|
+
|
1594
|
+
# Checks whether the method is a nonmutating String method.
|
1595
|
+
#
|
1596
|
+
# @return [Boolean] whether the method is a nonmutating String method
|
1597
|
+
def nonmutating_string_method?; end
|
1598
|
+
|
1599
|
+
# Checks whether the method is a nonmutating unary operator method.
|
1600
|
+
#
|
1601
|
+
# @return [Boolean] whether the method is a nonmutating unary operator method
|
1602
|
+
def nonmutating_unary_operator_method?; end
|
1603
|
+
|
1604
|
+
# Checks whether the method is an operator method.
|
1605
|
+
#
|
1606
|
+
# @return [Boolean] whether the method is an operator
|
1607
|
+
def operator_method?; end
|
1608
|
+
|
1609
|
+
# Checks whether the method is a predicate method.
|
1610
|
+
#
|
1611
|
+
# @return [Boolean] whether the method is a predicate method
|
1612
|
+
def predicate_method?; end
|
1613
|
+
|
1614
|
+
# Checks whether this is a prefix bang method, e.g. `!foo`.
|
1615
|
+
#
|
1616
|
+
# @return [Boolean] whether this method is a prefix bang
|
1617
|
+
def prefix_bang?; end
|
1618
|
+
|
1619
|
+
# Checks whether this is a prefix not method, e.g. `not foo`.
|
1620
|
+
#
|
1621
|
+
# @return [Boolean] whether this method is a prefix not
|
1622
|
+
def prefix_not?; end
|
1623
|
+
|
1624
|
+
# Checks whether the *explicit* receiver of this node is `self`.
|
1625
|
+
#
|
1626
|
+
# @return [Boolean] whether the receiver of this node is `self`
|
1627
|
+
def self_receiver?; end
|
1628
|
+
end
|
1629
|
+
|
1630
|
+
RuboCop::AST::MethodIdentifierPredicates::ENUMERABLE_METHODS = T.let(T.unsafe(nil), Set)
|
1631
|
+
RuboCop::AST::MethodIdentifierPredicates::ENUMERATOR_METHODS = T.let(T.unsafe(nil), Set)
|
1632
|
+
RuboCop::AST::MethodIdentifierPredicates::NONMUTATING_ARRAY_METHODS = T.let(T.unsafe(nil), Set)
|
1633
|
+
RuboCop::AST::MethodIdentifierPredicates::NONMUTATING_BINARY_OPERATOR_METHODS = T.let(T.unsafe(nil), Set)
|
1634
|
+
RuboCop::AST::MethodIdentifierPredicates::NONMUTATING_HASH_METHODS = T.let(T.unsafe(nil), Set)
|
1635
|
+
RuboCop::AST::MethodIdentifierPredicates::NONMUTATING_OPERATOR_METHODS = T.let(T.unsafe(nil), Set)
|
1636
|
+
RuboCop::AST::MethodIdentifierPredicates::NONMUTATING_STRING_METHODS = T.let(T.unsafe(nil), Set)
|
1637
|
+
RuboCop::AST::MethodIdentifierPredicates::NONMUTATING_UNARY_OPERATOR_METHODS = T.let(T.unsafe(nil), Set)
|
1638
|
+
|
1639
|
+
# http://phrogz.net/programmingruby/language.html#table_18.4
|
1640
|
+
RuboCop::AST::MethodIdentifierPredicates::OPERATOR_METHODS = T.let(T.unsafe(nil), Set)
|
1641
|
+
|
1642
|
+
# Common functionality for nodes that can be used as modifiers:
|
1643
|
+
# `if`, `while`, `until`
|
1644
|
+
module RuboCop::AST::ModifierNode
|
1645
|
+
# Checks whether the node is in a modifier form, i.e. a condition
|
1646
|
+
# trailing behind an expression.
|
1647
|
+
#
|
1648
|
+
# @return [Boolean] whether the node is a modifier
|
1649
|
+
def modifier_form?; end
|
1650
|
+
end
|
1651
|
+
|
1652
|
+
# A node extension for `module` nodes. This will be used in place of a
|
1653
|
+
# plain node when the builder constructs the AST, making its methods
|
1654
|
+
# available to all `module` nodes within RuboCop.
|
1655
|
+
class RuboCop::AST::ModuleNode < ::RuboCop::AST::Node
|
1656
|
+
# The body of this `module` node.
|
1657
|
+
#
|
1658
|
+
# @return [Node, nil] the body of the module
|
1659
|
+
def body; end
|
1660
|
+
|
1661
|
+
# The identifier for this `module` node.
|
1662
|
+
#
|
1663
|
+
# @return [Node] the identifier of the module
|
1664
|
+
def identifier; end
|
1665
|
+
end
|
1666
|
+
|
1667
|
+
# A node extension for `next` nodes. This will be used in place of a
|
1668
|
+
# plain node when the builder constructs the AST, making its methods
|
1669
|
+
# available to all `next` nodes within RuboCop.
|
1670
|
+
class RuboCop::AST::NextNode < ::RuboCop::AST::Node
|
1671
|
+
include ::RuboCop::AST::ParameterizedNode
|
1672
|
+
include ::RuboCop::AST::ParameterizedNode::WrappedArguments
|
1673
|
+
end
|
1674
|
+
|
1675
|
+
# `RuboCop::AST::Node` is a subclass of `Parser::AST::Node`. It provides
|
1676
|
+
# access to parent nodes and an object-oriented way to traverse an AST with
|
1677
|
+
# the power of `Enumerable`.
|
1678
|
+
#
|
1679
|
+
# It has predicate methods for every node type, like this:
|
1680
|
+
#
|
1681
|
+
# @example
|
1682
|
+
# node.send_type? # Equivalent to: `node.type == :send`
|
1683
|
+
# node.op_asgn_type? # Equivalent to: `node.type == :op_asgn`
|
1684
|
+
#
|
1685
|
+
# # Non-word characters (other than a-zA-Z0-9_) in type names are omitted.
|
1686
|
+
# node.defined_type? # Equivalent to: `node.type == :defined?`
|
1687
|
+
#
|
1688
|
+
# # Find the first lvar node under the receiver node.
|
1689
|
+
# lvar_node = node.each_descendant.find(&:lvar_type?)
|
1690
|
+
class RuboCop::AST::Node < ::Parser::AST::Node
|
1691
|
+
include ::RuboCop::AST::Sexp
|
1692
|
+
include ::RuboCop::AST::Descendence
|
1693
|
+
extend ::RuboCop::AST::NodePattern::Macros
|
1694
|
+
|
1695
|
+
# @return [Node] a new instance of Node
|
1696
|
+
# @see https://www.rubydoc.info/gems/ast/AST/Node:initialize
|
1697
|
+
def initialize(type, children = T.unsafe(nil), properties = T.unsafe(nil)); end
|
1698
|
+
|
1699
|
+
def __ENCODING___type?; end
|
1700
|
+
def __FILE___type?; end
|
1701
|
+
def __LINE___type?; end
|
1702
|
+
def alias_type?; end
|
1703
|
+
|
1704
|
+
# Returns an array of ancestor nodes.
|
1705
|
+
# This is a shorthand for `node.each_ancestor.to_a`.
|
1706
|
+
#
|
1707
|
+
# @return [Array<Node>] an array of ancestor nodes
|
1708
|
+
def ancestors; end
|
1709
|
+
|
1710
|
+
def and_asgn_type?; end
|
1711
|
+
def and_type?; end
|
1712
|
+
def arg_expr_type?; end
|
1713
|
+
def arg_type?; end
|
1714
|
+
def args_type?; end
|
1715
|
+
|
1716
|
+
# @return [Boolean]
|
1717
|
+
def argument?; end
|
1718
|
+
|
1719
|
+
# @return [Boolean]
|
1720
|
+
def argument_type?; end
|
1721
|
+
|
1722
|
+
def array_pattern_type?; end
|
1723
|
+
def array_pattern_with_tail_type?; end
|
1724
|
+
def array_type?; end
|
1725
|
+
|
1726
|
+
# @return [Boolean]
|
1727
|
+
def assignment?; end
|
1728
|
+
|
1729
|
+
# Some cops treat the shovel operator as a kind of assignment.
|
1730
|
+
def assignment_or_similar?(param0 = T.unsafe(nil)); end
|
1731
|
+
|
1732
|
+
def back_ref_type?; end
|
1733
|
+
|
1734
|
+
# @return [Boolean]
|
1735
|
+
def basic_conditional?; end
|
1736
|
+
|
1737
|
+
# @return [Boolean]
|
1738
|
+
def basic_literal?; end
|
1739
|
+
|
1740
|
+
def begin_type?; end
|
1741
|
+
def block_pass_type?; end
|
1742
|
+
def block_type?; end
|
1743
|
+
def blockarg_expr_type?; end
|
1744
|
+
def blockarg_type?; end
|
1745
|
+
|
1746
|
+
# @return [Boolean]
|
1747
|
+
def boolean_type?; end
|
1748
|
+
|
1749
|
+
def break_type?; end
|
1750
|
+
|
1751
|
+
# @return [Boolean]
|
1752
|
+
def call_type?; end
|
1753
|
+
|
1754
|
+
def case_match_type?; end
|
1755
|
+
def case_type?; end
|
1756
|
+
def casgn_type?; end
|
1757
|
+
def cbase_type?; end
|
1758
|
+
|
1759
|
+
# @return [Boolean]
|
1760
|
+
def chained?; end
|
1761
|
+
|
1762
|
+
def class_constructor?(param0 = T.unsafe(nil)); end
|
1763
|
+
def class_definition?(param0 = T.unsafe(nil)); end
|
1764
|
+
def class_type?; end
|
1765
|
+
def complete!; end
|
1766
|
+
|
1767
|
+
# @return [Boolean]
|
1768
|
+
def complete?; end
|
1769
|
+
|
1770
|
+
def complex_type?; end
|
1771
|
+
|
1772
|
+
# @return [Boolean]
|
1773
|
+
def conditional?; end
|
1774
|
+
|
1775
|
+
def const_name; end
|
1776
|
+
def const_pattern_type?; end
|
1777
|
+
def const_type?; end
|
1778
|
+
def csend_type?; end
|
1779
|
+
def cvar_type?; end
|
1780
|
+
def cvasgn_type?; end
|
1781
|
+
def def_type?; end
|
1782
|
+
def defined_module; end
|
1783
|
+
def defined_module_name; end
|
1784
|
+
def defined_type?; end
|
1785
|
+
def defs_type?; end
|
1786
|
+
def dstr_type?; end
|
1787
|
+
def dsym_type?; end
|
1788
|
+
|
1789
|
+
# Calls the given block for each ancestor node from parent to root.
|
1790
|
+
# If no block is given, an `Enumerator` is returned.
|
1791
|
+
#
|
1792
|
+
# @overload each_ancestor
|
1793
|
+
# @overload each_ancestor
|
1794
|
+
# @overload each_ancestor
|
1795
|
+
# @return [self] if a block is given
|
1796
|
+
# @return [Enumerator] if no block is given
|
1797
|
+
# @yieldparam node [Node] each ancestor node
|
1798
|
+
def each_ancestor(*types, &block); end
|
1799
|
+
|
1800
|
+
def eflipflop_type?; end
|
1801
|
+
def empty_else_type?; end
|
1802
|
+
|
1803
|
+
# @return [Boolean]
|
1804
|
+
def empty_source?; end
|
1805
|
+
|
1806
|
+
def ensure_type?; end
|
1807
|
+
|
1808
|
+
# @return [Boolean]
|
1809
|
+
def equals_asgn?; end
|
1810
|
+
|
1811
|
+
def erange_type?; end
|
1812
|
+
def false_type?; end
|
1813
|
+
|
1814
|
+
# @return [Boolean]
|
1815
|
+
def falsey_literal?; end
|
1816
|
+
|
1817
|
+
def find_pattern_type?; end
|
1818
|
+
def first_line; end
|
1819
|
+
def float_type?; end
|
1820
|
+
def for_type?; end
|
1821
|
+
def forward_arg_type?; end
|
1822
|
+
def forward_args_type?; end
|
1823
|
+
def forwarded_args_type?; end
|
1824
|
+
def global_const?(param0 = T.unsafe(nil), param1); end
|
1825
|
+
|
1826
|
+
# @return [Boolean]
|
1827
|
+
def guard_clause?; end
|
1828
|
+
|
1829
|
+
def gvar_type?; end
|
1830
|
+
def gvasgn_type?; end
|
1831
|
+
def hash_pattern_type?; end
|
1832
|
+
def hash_type?; end
|
1833
|
+
def ident_type?; end
|
1834
|
+
def if_guard_type?; end
|
1835
|
+
def if_type?; end
|
1836
|
+
def iflipflop_type?; end
|
1837
|
+
|
1838
|
+
# @return [Boolean]
|
1839
|
+
def immutable_literal?; end
|
1840
|
+
|
1841
|
+
def in_match_type?; end
|
1842
|
+
def in_pattern_type?; end
|
1843
|
+
def index_type?; end
|
1844
|
+
def indexasgn_type?; end
|
1845
|
+
def int_type?; end
|
1846
|
+
def irange_type?; end
|
1847
|
+
def ivar_type?; end
|
1848
|
+
def ivasgn_type?; end
|
1849
|
+
|
1850
|
+
# @return [Boolean]
|
1851
|
+
def keyword?; end
|
1852
|
+
|
1853
|
+
def kwarg_type?; end
|
1854
|
+
def kwargs_type?; end
|
1855
|
+
def kwbegin_type?; end
|
1856
|
+
def kwnilarg_type?; end
|
1857
|
+
def kwoptarg_type?; end
|
1858
|
+
def kwrestarg_type?; end
|
1859
|
+
def kwsplat_type?; end
|
1860
|
+
def lambda?(param0 = T.unsafe(nil)); end
|
1861
|
+
def lambda_or_proc?(param0 = T.unsafe(nil)); end
|
1862
|
+
def lambda_type?; end
|
1863
|
+
def last_line; end
|
1864
|
+
|
1865
|
+
# Use is discouraged, this is a potentially slow method and can lead
|
1866
|
+
# to even slower algorithms
|
1867
|
+
#
|
1868
|
+
# @return [Node, nil] the left (aka previous) sibling
|
1869
|
+
def left_sibling; end
|
1870
|
+
|
1871
|
+
# Use is discouraged, this is a potentially slow method and can lead
|
1872
|
+
# to even slower algorithms
|
1873
|
+
#
|
1874
|
+
# @return [Array<Node>] the left (aka previous) siblings
|
1875
|
+
def left_siblings; end
|
1876
|
+
|
1877
|
+
def line_count; end
|
1878
|
+
|
1879
|
+
# @return [Boolean]
|
1880
|
+
def literal?; end
|
1881
|
+
|
1882
|
+
# NOTE: `loop { }` is a normal method call and thus not a loop keyword.
|
1883
|
+
#
|
1884
|
+
# @return [Boolean]
|
1885
|
+
def loop_keyword?; end
|
1886
|
+
|
1887
|
+
def lvar_type?; end
|
1888
|
+
def lvasgn_type?; end
|
1889
|
+
def masgn_type?; end
|
1890
|
+
def match_alt_type?; end
|
1891
|
+
def match_as_type?; end
|
1892
|
+
def match_current_line_type?; end
|
1893
|
+
def match_guard_clause?(param0 = T.unsafe(nil)); end
|
1894
|
+
def match_nil_pattern_type?; end
|
1895
|
+
def match_pattern_p_type?; end
|
1896
|
+
def match_pattern_type?; end
|
1897
|
+
def match_rest_type?; end
|
1898
|
+
def match_var_type?; end
|
1899
|
+
def match_with_lvasgn_type?; end
|
1900
|
+
def match_with_trailing_comma_type?; end
|
1901
|
+
def mlhs_type?; end
|
1902
|
+
def module_definition?(param0 = T.unsafe(nil)); end
|
1903
|
+
def module_type?; end
|
1904
|
+
|
1905
|
+
# Predicates
|
1906
|
+
#
|
1907
|
+
# @return [Boolean]
|
1908
|
+
def multiline?; end
|
1909
|
+
|
1910
|
+
# @return [Boolean]
|
1911
|
+
def mutable_literal?; end
|
1912
|
+
|
1913
|
+
def new_class_or_module_block?(param0 = T.unsafe(nil)); end
|
1914
|
+
def next_type?; end
|
1915
|
+
def nil_type?; end
|
1916
|
+
|
1917
|
+
# Common destructuring method. This can be used to normalize
|
1918
|
+
# destructuring for different variations of the node.
|
1919
|
+
# Some node types override this with their own custom
|
1920
|
+
# destructuring method.
|
1921
|
+
#
|
1922
|
+
# @return [Array<Node>] the different parts of the ndde
|
1923
|
+
def node_parts; end
|
1924
|
+
|
1925
|
+
def nonempty_line_count; end
|
1926
|
+
def not_type?; end
|
1927
|
+
def nth_ref_type?; end
|
1928
|
+
def numargs_type?; end
|
1929
|
+
def numblock_type?; end
|
1930
|
+
|
1931
|
+
# @return [Boolean]
|
1932
|
+
def numeric_type?; end
|
1933
|
+
|
1934
|
+
def objc_kwarg_type?; end
|
1935
|
+
def objc_restarg_type?; end
|
1936
|
+
def objc_varargs_type?; end
|
1937
|
+
def op_asgn_type?; end
|
1938
|
+
|
1939
|
+
# @return [Boolean]
|
1940
|
+
def operator_keyword?; end
|
1941
|
+
|
1942
|
+
def optarg_type?; end
|
1943
|
+
def or_asgn_type?; end
|
1944
|
+
def or_type?; end
|
1945
|
+
def pair_type?; end
|
1946
|
+
|
1947
|
+
# Returns the parent node, or `nil` if the receiver is a root node.
|
1948
|
+
#
|
1949
|
+
# @return [Node, nil] the parent node or `nil`
|
1950
|
+
def parent; end
|
1951
|
+
|
1952
|
+
# @return [Boolean]
|
1953
|
+
def parent?; end
|
1954
|
+
|
1955
|
+
# Searching the AST
|
1956
|
+
def parent_module_name; end
|
1957
|
+
|
1958
|
+
# @return [Boolean]
|
1959
|
+
def parenthesized_call?; end
|
1960
|
+
|
1961
|
+
def pin_type?; end
|
1962
|
+
|
1963
|
+
# @return [Boolean]
|
1964
|
+
def post_condition_loop?; end
|
1965
|
+
|
1966
|
+
def postexe_type?; end
|
1967
|
+
def preexe_type?; end
|
1968
|
+
def proc?(param0 = T.unsafe(nil)); end
|
1969
|
+
def procarg0_type?; end
|
1970
|
+
|
1971
|
+
# Some expressions are evaluated for their value, some for their side
|
1972
|
+
# effects, and some for both.
|
1973
|
+
# If we know that expressions are useful only for their return values,
|
1974
|
+
# and have no side effects, that means we can reorder them, change the
|
1975
|
+
# number of times they are evaluated, or replace them with other
|
1976
|
+
# expressions which are equivalent in value.
|
1977
|
+
# So, is evaluation of this node free of side effects?
|
1978
|
+
#
|
1979
|
+
# @return [Boolean]
|
1980
|
+
def pure?; end
|
1981
|
+
|
1982
|
+
# @return [Boolean]
|
1983
|
+
def range_type?; end
|
1984
|
+
|
1985
|
+
def rational_type?; end
|
1986
|
+
def receiver(param0 = T.unsafe(nil)); end
|
1987
|
+
def recursive_basic_literal?; end
|
1988
|
+
def recursive_literal?; end
|
1989
|
+
def redo_type?; end
|
1990
|
+
|
1991
|
+
# @return [Boolean]
|
1992
|
+
def reference?; end
|
1993
|
+
|
1994
|
+
def regexp_type?; end
|
1995
|
+
def regopt_type?; end
|
1996
|
+
def resbody_type?; end
|
1997
|
+
def rescue_type?; end
|
1998
|
+
def restarg_expr_type?; end
|
1999
|
+
def restarg_type?; end
|
2000
|
+
def retry_type?; end
|
2001
|
+
def return_type?; end
|
2002
|
+
|
2003
|
+
# Use is discouraged, this is a potentially slow method and can lead
|
2004
|
+
# to even slower algorithms
|
2005
|
+
#
|
2006
|
+
# @return [Node, nil] the right (aka next) sibling
|
2007
|
+
def right_sibling; end
|
2008
|
+
|
2009
|
+
# Use is discouraged, this is a potentially slow method and can lead
|
2010
|
+
# to even slower algorithms
|
2011
|
+
#
|
2012
|
+
# @return [Array<Node>] the right (aka next) siblings
|
2013
|
+
def right_siblings; end
|
2014
|
+
|
2015
|
+
# @return [Boolean]
|
2016
|
+
def root?; end
|
2017
|
+
|
2018
|
+
def sclass_type?; end
|
2019
|
+
def self_type?; end
|
2020
|
+
def send_type?; end
|
2021
|
+
def shadowarg_type?; end
|
2022
|
+
|
2023
|
+
# @return [Boolean]
|
2024
|
+
def shorthand_asgn?; end
|
2025
|
+
|
2026
|
+
# Returns the index of the receiver node in its siblings. (Sibling index
|
2027
|
+
# uses zero based numbering.)
|
2028
|
+
# Use is discouraged, this is a potentially slow method.
|
2029
|
+
#
|
2030
|
+
# @return [Integer, nil] the index of the receiver node in its siblings
|
2031
|
+
def sibling_index; end
|
2032
|
+
|
2033
|
+
# @return [Boolean]
|
2034
|
+
def single_line?; end
|
2035
|
+
|
2036
|
+
# NOTE: Some rare nodes may have no source, like `s(:args)` in `foo {}`
|
2037
|
+
#
|
2038
|
+
# @return [String, nil]
|
2039
|
+
def source; end
|
2040
|
+
|
2041
|
+
def source_length; end
|
2042
|
+
def source_range; end
|
2043
|
+
|
2044
|
+
# @return [Boolean]
|
2045
|
+
def special_keyword?; end
|
2046
|
+
|
2047
|
+
def splat_type?; end
|
2048
|
+
def str_content(param0 = T.unsafe(nil)); end
|
2049
|
+
def str_type?; end
|
2050
|
+
|
2051
|
+
# @deprecated Use `:class_constructor?`
|
2052
|
+
def struct_constructor?(param0 = T.unsafe(nil)); end
|
2053
|
+
|
2054
|
+
def super_type?; end
|
2055
|
+
def sym_type?; end
|
2056
|
+
def true_type?; end
|
2057
|
+
|
2058
|
+
# @return [Boolean]
|
2059
|
+
def truthy_literal?; end
|
2060
|
+
|
2061
|
+
def undef_type?; end
|
2062
|
+
def unless_guard_type?; end
|
2063
|
+
def until_post_type?; end
|
2064
|
+
def until_type?; end
|
2065
|
+
|
2066
|
+
# Override `AST::Node#updated` so that `AST::Processor` does not try to
|
2067
|
+
# mutate our ASTs. Since we keep references from children to parents and
|
2068
|
+
# not just the other way around, we cannot update an AST and share
|
2069
|
+
# identical subtrees. Rather, the entire AST must be copied any time any
|
2070
|
+
# part of it is changed.
|
2071
|
+
def updated(type = T.unsafe(nil), children = T.unsafe(nil), properties = T.unsafe(nil)); end
|
2072
|
+
|
2073
|
+
# Some expressions are evaluated for their value, some for their side
|
2074
|
+
# effects, and some for both
|
2075
|
+
# If we know that an expression is useful only for its side effects, that
|
2076
|
+
# means we can transform it in ways which preserve the side effects, but
|
2077
|
+
# change the return value
|
2078
|
+
# So, does the return value of this node matter? If we changed it to
|
2079
|
+
# `(...; nil)`, might that affect anything?
|
2080
|
+
#
|
2081
|
+
#
|
2082
|
+
# @return [Boolean]
|
2083
|
+
def value_used?; end
|
2084
|
+
|
2085
|
+
# @return [Boolean]
|
2086
|
+
def variable?; end
|
2087
|
+
|
2088
|
+
def when_type?; end
|
2089
|
+
def while_post_type?; end
|
2090
|
+
def while_type?; end
|
2091
|
+
def xstr_type?; end
|
2092
|
+
def yield_type?; end
|
2093
|
+
def zsuper_type?; end
|
2094
|
+
|
2095
|
+
protected
|
2096
|
+
|
2097
|
+
def parent=(node); end
|
2098
|
+
|
2099
|
+
private
|
2100
|
+
|
2101
|
+
# @return [Boolean]
|
2102
|
+
def begin_value_used?; end
|
2103
|
+
|
2104
|
+
# @return [Boolean]
|
2105
|
+
def case_if_value_used?; end
|
2106
|
+
|
2107
|
+
def defined_module0(param0 = T.unsafe(nil)); end
|
2108
|
+
|
2109
|
+
# @return [Boolean]
|
2110
|
+
def for_value_used?; end
|
2111
|
+
|
2112
|
+
def parent_module_name_for_block(ancestor); end
|
2113
|
+
def parent_module_name_for_sclass(sclass_node); end
|
2114
|
+
def parent_module_name_part(node); end
|
2115
|
+
def visit_ancestors(types); end
|
2116
|
+
|
2117
|
+
# @return [Boolean]
|
2118
|
+
def while_until_value_used?; end
|
2119
|
+
end
|
2120
|
+
|
2121
|
+
# @api private
|
2122
|
+
RuboCop::AST::Node::ARGUMENT_TYPES = T.let(T.unsafe(nil), Set)
|
2123
|
+
|
2124
|
+
# @api private
|
2125
|
+
RuboCop::AST::Node::ASSIGNMENTS = T.let(T.unsafe(nil), Set)
|
2126
|
+
|
2127
|
+
# @api private
|
2128
|
+
RuboCop::AST::Node::BASIC_CONDITIONALS = T.let(T.unsafe(nil), Set)
|
2129
|
+
|
2130
|
+
# @api private
|
2131
|
+
RuboCop::AST::Node::BASIC_LITERALS = T.let(T.unsafe(nil), Set)
|
2132
|
+
|
2133
|
+
# <=> isn't included here, because it doesn't return a boolean.
|
2134
|
+
#
|
2135
|
+
# @api private
|
2136
|
+
RuboCop::AST::Node::COMPARISON_OPERATORS = T.let(T.unsafe(nil), Set)
|
2137
|
+
|
2138
|
+
# @api private
|
2139
|
+
RuboCop::AST::Node::COMPOSITE_LITERALS = T.let(T.unsafe(nil), Set)
|
2140
|
+
|
2141
|
+
# @api private
|
2142
|
+
RuboCop::AST::Node::CONDITIONALS = T.let(T.unsafe(nil), Set)
|
2143
|
+
|
2144
|
+
# @api private
|
2145
|
+
RuboCop::AST::Node::EQUALS_ASSIGNMENTS = T.let(T.unsafe(nil), Set)
|
2146
|
+
|
2147
|
+
# @api private
|
2148
|
+
RuboCop::AST::Node::FALSEY_LITERALS = T.let(T.unsafe(nil), Set)
|
2149
|
+
|
2150
|
+
# @api private
|
2151
|
+
RuboCop::AST::Node::IMMUTABLE_LITERALS = T.let(T.unsafe(nil), Set)
|
2152
|
+
|
2153
|
+
# @api private
|
2154
|
+
RuboCop::AST::Node::KEYWORDS = T.let(T.unsafe(nil), Set)
|
2155
|
+
|
2156
|
+
# @api private
|
2157
|
+
RuboCop::AST::Node::LITERALS = T.let(T.unsafe(nil), Set)
|
2158
|
+
|
2159
|
+
RuboCop::AST::Node::LITERAL_RECURSIVE_METHODS = T.let(T.unsafe(nil), Set)
|
2160
|
+
RuboCop::AST::Node::LITERAL_RECURSIVE_TYPES = T.let(T.unsafe(nil), Set)
|
2161
|
+
|
2162
|
+
# @api private
|
2163
|
+
RuboCop::AST::Node::LOOP_TYPES = T.let(T.unsafe(nil), Set)
|
2164
|
+
|
2165
|
+
# @api private
|
2166
|
+
RuboCop::AST::Node::MUTABLE_LITERALS = T.let(T.unsafe(nil), Set)
|
2167
|
+
|
2168
|
+
# @api private
|
2169
|
+
RuboCop::AST::Node::OPERATOR_KEYWORDS = T.let(T.unsafe(nil), Set)
|
2170
|
+
|
2171
|
+
# @api private
|
2172
|
+
RuboCop::AST::Node::POST_CONDITION_LOOP_TYPES = T.let(T.unsafe(nil), Set)
|
2173
|
+
|
2174
|
+
# @api private
|
2175
|
+
RuboCop::AST::Node::REFERENCES = T.let(T.unsafe(nil), Set)
|
2176
|
+
|
2177
|
+
# @api private
|
2178
|
+
RuboCop::AST::Node::SHORTHAND_ASSIGNMENTS = T.let(T.unsafe(nil), Set)
|
2179
|
+
|
2180
|
+
# @api private
|
2181
|
+
RuboCop::AST::Node::SPECIAL_KEYWORDS = T.let(T.unsafe(nil), Set)
|
2182
|
+
|
2183
|
+
# @api private
|
2184
|
+
RuboCop::AST::Node::TRUTHY_LITERALS = T.let(T.unsafe(nil), Set)
|
2185
|
+
|
2186
|
+
# @api private
|
2187
|
+
RuboCop::AST::Node::VARIABLES = T.let(T.unsafe(nil), Set)
|
2188
|
+
|
2189
|
+
# This class performs a pattern-matching operation on an AST node.
|
2190
|
+
#
|
2191
|
+
# Detailed syntax: /docs/modules/ROOT/pages/node_pattern.adoc
|
2192
|
+
#
|
2193
|
+
# Initialize a new `NodePattern` with `NodePattern.new(pattern_string)`, then
|
2194
|
+
# pass an AST node to `NodePattern#match`. Alternatively, use one of the class
|
2195
|
+
# macros in `NodePattern::Macros` to define your own pattern-matching method.
|
2196
|
+
#
|
2197
|
+
# If the match fails, `nil` will be returned. If the match succeeds, the
|
2198
|
+
# return value depends on whether a block was provided to `#match`, and
|
2199
|
+
# whether the pattern contained any "captures" (values which are extracted
|
2200
|
+
# from a matching AST.)
|
2201
|
+
#
|
2202
|
+
# - With block: #match yields the captures (if any) and passes the return
|
2203
|
+
# value of the block through.
|
2204
|
+
# - With no block, but one capture: the capture is returned.
|
2205
|
+
# - With no block, but multiple captures: captures are returned as an array.
|
2206
|
+
# - With no block and no captures: #match returns `true`.
|
2207
|
+
class RuboCop::AST::NodePattern
|
2208
|
+
include ::RuboCop::AST::NodePattern::MethodDefiner
|
2209
|
+
extend ::Forwardable
|
2210
|
+
|
2211
|
+
# @return [NodePattern] a new instance of NodePattern
|
2212
|
+
def initialize(str, compiler: T.unsafe(nil)); end
|
2213
|
+
|
2214
|
+
def ==(other); end
|
2215
|
+
def as_json(_options = T.unsafe(nil)); end
|
2216
|
+
|
2217
|
+
# Returns the value of attribute ast.
|
2218
|
+
def ast; end
|
2219
|
+
|
2220
|
+
def captures(*args, **_arg1, &block); end
|
2221
|
+
def encode_with(coder); end
|
2222
|
+
def eql?(other); end
|
2223
|
+
def freeze; end
|
2224
|
+
def init_with(coder); end
|
2225
|
+
def marshal_dump; end
|
2226
|
+
def marshal_load(pattern); end
|
2227
|
+
def match(*args, **rest, &block); end
|
2228
|
+
|
2229
|
+
# Returns the value of attribute match_code.
|
2230
|
+
def match_code; end
|
2231
|
+
|
2232
|
+
def named_parameters(*args, **_arg1, &block); end
|
2233
|
+
|
2234
|
+
# Returns the value of attribute pattern.
|
2235
|
+
def pattern; end
|
2236
|
+
|
2237
|
+
def positional_parameters(*args, **_arg1, &block); end
|
2238
|
+
def to_s; end
|
2239
|
+
|
2240
|
+
class << self
|
2241
|
+
# Yields its argument and any descendants, depth-first.
|
2242
|
+
#
|
2243
|
+
# @yield [element]
|
2244
|
+
def descend(element, &block); end
|
2245
|
+
end
|
2246
|
+
end
|
2247
|
+
|
2248
|
+
# Responsible to build the AST nodes for `NodePattern`
|
2249
|
+
#
|
2250
|
+
# Doc on how this fits in the compiling process:
|
2251
|
+
# /docs/modules/ROOT/pages/node_pattern.adoc
|
2252
|
+
class RuboCop::AST::NodePattern::Builder
|
2253
|
+
def emit_atom(type, value); end
|
2254
|
+
def emit_call(type, selector, args = T.unsafe(nil)); end
|
2255
|
+
def emit_capture(capture_token, node); end
|
2256
|
+
def emit_list(type, _begin, children, _end); end
|
2257
|
+
def emit_subsequence(node_list); end
|
2258
|
+
def emit_unary_op(type, _operator = T.unsafe(nil), *children); end
|
2259
|
+
def emit_union(begin_t, pattern_lists, end_t); end
|
2260
|
+
|
2261
|
+
private
|
2262
|
+
|
2263
|
+
def n(type, *args); end
|
2264
|
+
|
2265
|
+
# @return [Boolean]
|
2266
|
+
def optimizable_as_set?(children); end
|
2267
|
+
|
2268
|
+
def union_children(pattern_lists); end
|
2269
|
+
end
|
2270
|
+
|
2271
|
+
# A NodePattern comment, simplified version of ::Parser::Source::Comment
|
2272
|
+
class RuboCop::AST::NodePattern::Comment
|
2273
|
+
# @param range [Parser::Source::Range]
|
2274
|
+
# @return [Comment] a new instance of Comment
|
2275
|
+
def initialize(range); end
|
2276
|
+
|
2277
|
+
# Compares comments. Two comments are equal if they
|
2278
|
+
# correspond to the same source range.
|
2279
|
+
#
|
2280
|
+
# @param other [Object]
|
2281
|
+
# @return [Boolean]
|
2282
|
+
def ==(other); end
|
2283
|
+
|
2284
|
+
# @return [String] a human-readable representation of this comment
|
2285
|
+
def inspect; end
|
2286
|
+
|
2287
|
+
# Returns the value of attribute location.
|
2288
|
+
def loc; end
|
2289
|
+
|
2290
|
+
# Returns the value of attribute location.
|
2291
|
+
def location; end
|
2292
|
+
|
2293
|
+
# @return [String]
|
2294
|
+
def text; end
|
2295
|
+
end
|
2296
|
+
|
2297
|
+
# The top-level compiler holding the global state
|
2298
|
+
# Defers work to its subcompilers
|
2299
|
+
#
|
2300
|
+
# Doc on how this fits in the compiling process:
|
2301
|
+
# /docs/modules/ROOT/pages/node_pattern.adoc
|
2302
|
+
class RuboCop::AST::NodePattern::Compiler
|
2303
|
+
extend ::Forwardable
|
2304
|
+
|
2305
|
+
# @return [Compiler] a new instance of Compiler
|
2306
|
+
def initialize; end
|
2307
|
+
|
2308
|
+
def bind(*args, **_arg1, &block); end
|
2309
|
+
|
2310
|
+
# Returns the value of attribute binding.
|
2311
|
+
def binding; end
|
2312
|
+
|
2313
|
+
# Returns the value of attribute captures.
|
2314
|
+
def captures; end
|
2315
|
+
|
2316
|
+
def compile_as_atom(node); end
|
2317
|
+
def compile_as_node_pattern(node, **options); end
|
2318
|
+
def compile_sequence(sequence, var:); end
|
2319
|
+
|
2320
|
+
# Enumerates `enum` while keeping track of state across
|
2321
|
+
# union branches (captures and unification).
|
2322
|
+
def each_union(enum, &block); end
|
2323
|
+
|
2324
|
+
def freeze; end
|
2325
|
+
def named_parameter(name); end
|
2326
|
+
|
2327
|
+
# Returns the value of attribute named_parameters.
|
2328
|
+
def named_parameters; end
|
2329
|
+
|
2330
|
+
def next_capture; end
|
2331
|
+
def parser; end
|
2332
|
+
def positional_parameter(number); end
|
2333
|
+
|
2334
|
+
# Returns the value of attribute positional_parameters.
|
2335
|
+
def positional_parameters; end
|
2336
|
+
|
2337
|
+
# Utilities
|
2338
|
+
def with_temp_variables(*names, &block); end
|
2339
|
+
|
2340
|
+
private
|
2341
|
+
|
2342
|
+
def enforce_same_captures(enum); end
|
2343
|
+
def new_capture; end
|
2344
|
+
end
|
2345
|
+
|
2346
|
+
# Generates code that evaluates to a value (Ruby object)
|
2347
|
+
# This value responds to `===`.
|
2348
|
+
#
|
2349
|
+
# Doc on how this fits in the compiling process:
|
2350
|
+
# /docs/modules/ROOT/pages/node_pattern.adoc
|
2351
|
+
class RuboCop::AST::NodePattern::Compiler::AtomSubcompiler < ::RuboCop::AST::NodePattern::Compiler::Subcompiler
|
2352
|
+
private
|
2353
|
+
|
2354
|
+
def visit_const; end
|
2355
|
+
def visit_named_parameter; end
|
2356
|
+
def visit_number; end
|
2357
|
+
|
2358
|
+
# Assumes other types are node patterns.
|
2359
|
+
def visit_other_type; end
|
2360
|
+
|
2361
|
+
def visit_positional_parameter; end
|
2362
|
+
def visit_regexp; end
|
2363
|
+
def visit_set; end
|
2364
|
+
def visit_string; end
|
2365
|
+
def visit_symbol; end
|
2366
|
+
def visit_unify; end
|
2367
|
+
end
|
2368
|
+
|
2369
|
+
# Holds the list of bound variable names
|
2370
|
+
class RuboCop::AST::NodePattern::Compiler::Binding
|
2371
|
+
# @return [Binding] a new instance of Binding
|
2372
|
+
def initialize; end
|
2373
|
+
|
2374
|
+
# Yields the first time a given name is bound
|
2375
|
+
#
|
2376
|
+
# @return [String] bound variable name
|
2377
|
+
def bind(name); end
|
2378
|
+
|
2379
|
+
def union_bind(enum); end
|
2380
|
+
|
2381
|
+
private
|
2382
|
+
|
2383
|
+
def forbid(names); end
|
2384
|
+
end
|
2385
|
+
|
2386
|
+
# Variant of the Compiler with tracing information for nodes
|
2387
|
+
class RuboCop::AST::NodePattern::Compiler::Debug < ::RuboCop::AST::NodePattern::Compiler
|
2388
|
+
# @return [Debug] a new instance of Debug
|
2389
|
+
def initialize; end
|
2390
|
+
|
2391
|
+
def comments(*args, **_arg1, &block); end
|
2392
|
+
def named_parameters; end
|
2393
|
+
|
2394
|
+
# Returns the value of attribute node_ids.
|
2395
|
+
def node_ids; end
|
2396
|
+
|
2397
|
+
def parser; end
|
2398
|
+
def tokens(*args, **_arg1, &block); end
|
2399
|
+
end
|
2400
|
+
|
2401
|
+
# @api private
|
2402
|
+
class RuboCop::AST::NodePattern::Compiler::Debug::Colorizer
|
2403
|
+
# @api private
|
2404
|
+
# @return [Colorizer] a new instance of Colorizer
|
2405
|
+
def initialize(pattern, compiler: T.unsafe(nil)); end
|
2406
|
+
|
2407
|
+
# @api private
|
2408
|
+
def compiler; end
|
2409
|
+
|
2410
|
+
# @api private
|
2411
|
+
def node_pattern; end
|
2412
|
+
|
2413
|
+
# @api private
|
2414
|
+
def pattern; end
|
2415
|
+
|
2416
|
+
# @api private
|
2417
|
+
# @return [Node] the Ruby AST
|
2418
|
+
def test(ruby, trace: T.unsafe(nil)); end
|
2419
|
+
|
2420
|
+
private
|
2421
|
+
|
2422
|
+
# @api private
|
2423
|
+
def ruby_ast(ruby); end
|
2424
|
+
|
2425
|
+
# @api private
|
2426
|
+
def ruby_parser; end
|
2427
|
+
end
|
2428
|
+
|
2429
|
+
# @api private
|
2430
|
+
RuboCop::AST::NodePattern::Compiler::Debug::Colorizer::COLOR_SCHEME = T.let(T.unsafe(nil), Hash)
|
2431
|
+
|
2432
|
+
# @api private
|
2433
|
+
RuboCop::AST::NodePattern::Compiler::Debug::Colorizer::Compiler = RuboCop::AST::NodePattern::Compiler::Debug
|
2434
|
+
|
2435
|
+
# Result of a NodePattern run against a particular AST
|
2436
|
+
# Consider constructor is private
|
2437
|
+
#
|
2438
|
+
# @api private
|
2439
|
+
class RuboCop::AST::NodePattern::Compiler::Debug::Colorizer::Result < ::Struct
|
2440
|
+
# @api private
|
2441
|
+
# @return [Hash] a map for {character_position => color}
|
2442
|
+
def color_map(color_scheme = T.unsafe(nil)); end
|
2443
|
+
|
2444
|
+
# @api private
|
2445
|
+
# @return [String] a Rainbow colorized version of ruby
|
2446
|
+
def colorize(color_scheme = T.unsafe(nil)); end
|
2447
|
+
|
2448
|
+
# Returns the value of attribute colorizer
|
2449
|
+
#
|
2450
|
+
# @return [Object] the current value of colorizer
|
2451
|
+
def colorizer; end
|
2452
|
+
|
2453
|
+
# Sets the attribute colorizer
|
2454
|
+
#
|
2455
|
+
# @param value [Object] the value to set the attribute colorizer to.
|
2456
|
+
# @return [Object] the newly set value
|
2457
|
+
def colorizer=(_); end
|
2458
|
+
|
2459
|
+
# @api private
|
2460
|
+
# @return [Hash] a map for {node => matched?}, depth-first
|
2461
|
+
def match_map; end
|
2462
|
+
|
2463
|
+
# @api private
|
2464
|
+
# @return [Boolean] a value of `Trace#matched?` or `:not_visitable`
|
2465
|
+
def matched?(node); end
|
2466
|
+
|
2467
|
+
# Returns the value of attribute returned
|
2468
|
+
#
|
2469
|
+
# @return [Object] the current value of returned
|
2470
|
+
def returned; end
|
2471
|
+
|
2472
|
+
# Sets the attribute returned
|
2473
|
+
#
|
2474
|
+
# @param value [Object] the value to set the attribute returned to.
|
2475
|
+
# @return [Object] the newly set value
|
2476
|
+
def returned=(_); end
|
2477
|
+
|
2478
|
+
# Returns the value of attribute ruby_ast
|
2479
|
+
#
|
2480
|
+
# @return [Object] the current value of ruby_ast
|
2481
|
+
def ruby_ast; end
|
2482
|
+
|
2483
|
+
# Sets the attribute ruby_ast
|
2484
|
+
#
|
2485
|
+
# @param value [Object] the value to set the attribute ruby_ast to.
|
2486
|
+
# @return [Object] the newly set value
|
2487
|
+
def ruby_ast=(_); end
|
2488
|
+
|
2489
|
+
# Returns the value of attribute trace
|
2490
|
+
#
|
2491
|
+
# @return [Object] the current value of trace
|
2492
|
+
def trace; end
|
2493
|
+
|
2494
|
+
# Sets the attribute trace
|
2495
|
+
#
|
2496
|
+
# @param value [Object] the value to set the attribute trace to.
|
2497
|
+
# @return [Object] the newly set value
|
2498
|
+
def trace=(_); end
|
2499
|
+
|
2500
|
+
private
|
2501
|
+
|
2502
|
+
# @api private
|
2503
|
+
def ast; end
|
2504
|
+
|
2505
|
+
# @api private
|
2506
|
+
def color_map_for(node, color); end
|
2507
|
+
|
2508
|
+
class << self
|
2509
|
+
def [](*_arg0); end
|
2510
|
+
def inspect; end
|
2511
|
+
def keyword_init?; end
|
2512
|
+
def members; end
|
2513
|
+
def new(*_arg0); end
|
2514
|
+
end
|
2515
|
+
end
|
2516
|
+
|
2517
|
+
# @api private
|
2518
|
+
module RuboCop::AST::NodePattern::Compiler::Debug::InstrumentationSubcompiler
|
2519
|
+
# @api private
|
2520
|
+
def do_compile; end
|
2521
|
+
|
2522
|
+
private
|
2523
|
+
|
2524
|
+
# @api private
|
2525
|
+
def node_id; end
|
2526
|
+
|
2527
|
+
# @api private
|
2528
|
+
def tracer(kind); end
|
2529
|
+
end
|
2530
|
+
|
2531
|
+
# @api private
|
2532
|
+
class RuboCop::AST::NodePattern::Compiler::Debug::NodePatternSubcompiler < ::RuboCop::AST::NodePattern::Compiler::NodePatternSubcompiler
|
2533
|
+
include ::RuboCop::AST::NodePattern::Compiler::Debug::InstrumentationSubcompiler
|
2534
|
+
end
|
2535
|
+
|
2536
|
+
# @api private
|
2537
|
+
class RuboCop::AST::NodePattern::Compiler::Debug::SequenceSubcompiler < ::RuboCop::AST::NodePattern::Compiler::SequenceSubcompiler
|
2538
|
+
include ::RuboCop::AST::NodePattern::Compiler::Debug::InstrumentationSubcompiler
|
2539
|
+
end
|
2540
|
+
|
2541
|
+
# Compiled node pattern requires a named parameter `trace`,
|
2542
|
+
# which should be an instance of this class
|
2543
|
+
class RuboCop::AST::NodePattern::Compiler::Debug::Trace
|
2544
|
+
# @return [Trace] a new instance of Trace
|
2545
|
+
def initialize; end
|
2546
|
+
|
2547
|
+
def enter(node_id); end
|
2548
|
+
|
2549
|
+
# return nil (not visited), false (not matched) or true (matched)
|
2550
|
+
#
|
2551
|
+
# @return [Boolean]
|
2552
|
+
def matched?(node_id); end
|
2553
|
+
|
2554
|
+
def success(node_id); end
|
2555
|
+
end
|
2556
|
+
|
2557
|
+
# Compiles code that evalues to true or false
|
2558
|
+
# for a given value `var` (typically a RuboCop::AST::Node)
|
2559
|
+
# or it's `node.type` if `seq_head` is true
|
2560
|
+
#
|
2561
|
+
# Doc on how this fits in the compiling process:
|
2562
|
+
# /docs/modules/ROOT/pages/node_pattern.adoc
|
2563
|
+
class RuboCop::AST::NodePattern::Compiler::NodePatternSubcompiler < ::RuboCop::AST::NodePattern::Compiler::Subcompiler
|
2564
|
+
# @return [NodePatternSubcompiler] a new instance of NodePatternSubcompiler
|
2565
|
+
def initialize(compiler, var: T.unsafe(nil), access: T.unsafe(nil), seq_head: T.unsafe(nil)); end
|
2566
|
+
|
2567
|
+
# Returns the value of attribute access.
|
2568
|
+
def access; end
|
2569
|
+
|
2570
|
+
# Returns the value of attribute seq_head.
|
2571
|
+
def seq_head; end
|
2572
|
+
|
2573
|
+
private
|
2574
|
+
|
2575
|
+
def access_element; end
|
2576
|
+
def access_node; end
|
2577
|
+
|
2578
|
+
# @param [Array<Node>, nil]
|
2579
|
+
# @return [String, nil]
|
2580
|
+
def compile_args(arg_list, first: T.unsafe(nil)); end
|
2581
|
+
|
2582
|
+
def compile_guard_clause; end
|
2583
|
+
|
2584
|
+
# Compiling helpers
|
2585
|
+
def compile_value_match(value); end
|
2586
|
+
|
2587
|
+
def multiple_access(kind); end
|
2588
|
+
def visit_ascend; end
|
2589
|
+
def visit_capture; end
|
2590
|
+
def visit_descend; end
|
2591
|
+
def visit_function_call; end
|
2592
|
+
def visit_intersection; end
|
2593
|
+
def visit_negation; end
|
2594
|
+
def visit_node_type; end
|
2595
|
+
|
2596
|
+
# Assumes other types are atoms.
|
2597
|
+
def visit_other_type; end
|
2598
|
+
|
2599
|
+
def visit_predicate; end
|
2600
|
+
def visit_sequence; end
|
2601
|
+
def visit_unify; end
|
2602
|
+
|
2603
|
+
# Lists
|
2604
|
+
def visit_union; end
|
2605
|
+
|
2606
|
+
def visit_wildcard; end
|
2607
|
+
end
|
2608
|
+
|
2609
|
+
# Compiles terms within a sequence to code that evalues to true or false.
|
2610
|
+
# Compilation of the nodes that can match only a single term is deferred to
|
2611
|
+
# `NodePatternSubcompiler`; only nodes that can match multiple terms are
|
2612
|
+
# compiled here.
|
2613
|
+
# Assumes the given `var` is a `::RuboCop::AST::Node`
|
2614
|
+
#
|
2615
|
+
# Doc on how this fits in the compiling process:
|
2616
|
+
# /docs/modules/ROOT/pages/node_pattern.adoc
|
2617
|
+
#
|
2618
|
+
class RuboCop::AST::NodePattern::Compiler::SequenceSubcompiler < ::RuboCop::AST::NodePattern::Compiler::Subcompiler
|
2619
|
+
# Calls `compile_sequence`; the actual `compile` method
|
2620
|
+
# will be used for the different terms of the sequence.
|
2621
|
+
# The only case of re-entrant call to `compile` is `visit_capture`
|
2622
|
+
#
|
2623
|
+
# @return [SequenceSubcompiler] a new instance of SequenceSubcompiler
|
2624
|
+
def initialize(compiler, sequence:, var:); end
|
2625
|
+
|
2626
|
+
def compile_sequence; end
|
2627
|
+
|
2628
|
+
# @api private
|
2629
|
+
def in_sync; end
|
2630
|
+
|
2631
|
+
protected
|
2632
|
+
|
2633
|
+
def compile_terms(children = T.unsafe(nil), last_arity = T.unsafe(nil)); end
|
2634
|
+
|
2635
|
+
# @api private
|
2636
|
+
def cur_index; end
|
2637
|
+
|
2638
|
+
# yield `sync_code` iff not already in sync
|
2639
|
+
#
|
2640
|
+
# @yield [code]
|
2641
|
+
def sync; end
|
2642
|
+
|
2643
|
+
private
|
2644
|
+
|
2645
|
+
# Compilation helpers
|
2646
|
+
def compile_and_advance(term); end
|
2647
|
+
|
2648
|
+
def compile_any_order_branches(matched_var); end
|
2649
|
+
|
2650
|
+
# @return [Array<String>] Else code, and init code (if any)
|
2651
|
+
def compile_any_order_else; end
|
2652
|
+
|
2653
|
+
def compile_captured_repetition(child_code, child_captures); end
|
2654
|
+
def compile_case(when_branches, else_code); end
|
2655
|
+
def compile_child_nb_guard(arity_range); end
|
2656
|
+
def compile_cur_index; end
|
2657
|
+
def compile_index(cur = T.unsafe(nil)); end
|
2658
|
+
def compile_loop(term); end
|
2659
|
+
def compile_loop_advance(to = T.unsafe(nil)); end
|
2660
|
+
|
2661
|
+
# Assumes `@cur_index` is already updated
|
2662
|
+
def compile_matched(kind); end
|
2663
|
+
|
2664
|
+
def compile_max_matched; end
|
2665
|
+
|
2666
|
+
# @return [String] code that evaluates to `false` if the matched arity is too small
|
2667
|
+
def compile_min_check; end
|
2668
|
+
|
2669
|
+
def compile_remaining; end
|
2670
|
+
|
2671
|
+
# @return [Hash] of {subcompiler => code}
|
2672
|
+
def compile_union_forks; end
|
2673
|
+
|
2674
|
+
def empty_loop; end
|
2675
|
+
def handle_prev; end
|
2676
|
+
|
2677
|
+
# Modifies in place `forks`
|
2678
|
+
# Syncs our state
|
2679
|
+
def merge_forks!(forks); end
|
2680
|
+
|
2681
|
+
# Modifies in place `forks` to insure that `cur_{child|index}_var` are ok
|
2682
|
+
def preserve_union_start(forks); end
|
2683
|
+
|
2684
|
+
# E.g. For sequence `(_ _? <_ _>)`, arities are: 1, 0..1, 2
|
2685
|
+
# and remaining arities are: 3..4, 2..3, 2..2, 0..0
|
2686
|
+
#
|
2687
|
+
# @return [Array<Range>] total arities (as Ranges) of remaining children nodes
|
2688
|
+
def remaining_arities(children, last_arity); end
|
2689
|
+
|
2690
|
+
# returns truthy iff `@cur_index` switched to relative from end mode (i.e. < 0)
|
2691
|
+
def use_index_from_end; end
|
2692
|
+
|
2693
|
+
def visit_any_order; end
|
2694
|
+
def visit_capture; end
|
2695
|
+
|
2696
|
+
# Single node patterns are all handled here
|
2697
|
+
def visit_other_type; end
|
2698
|
+
|
2699
|
+
def visit_repetition; end
|
2700
|
+
def visit_rest; end
|
2701
|
+
def visit_union; end
|
2702
|
+
|
2703
|
+
# NOTE: assumes `@cur_index != :seq_head`. Node types using `within_loop` must
|
2704
|
+
# have `def in_sequence_head; :raise; end`
|
2705
|
+
def within_loop; end
|
2706
|
+
end
|
2707
|
+
|
2708
|
+
RuboCop::AST::NodePattern::Compiler::SequenceSubcompiler::DELTA = T.let(T.unsafe(nil), Integer)
|
2709
|
+
RuboCop::AST::NodePattern::Compiler::SequenceSubcompiler::POSITIVE = T.let(T.unsafe(nil), Proc)
|
2710
|
+
|
2711
|
+
# Base class for subcompilers
|
2712
|
+
# Implements visitor pattern
|
2713
|
+
#
|
2714
|
+
# Doc on how this fits in the compiling process:
|
2715
|
+
# /docs/modules/ROOT/pages/node_pattern.adoc
|
2716
|
+
class RuboCop::AST::NodePattern::Compiler::Subcompiler
|
2717
|
+
# @return [Subcompiler] a new instance of Subcompiler
|
2718
|
+
def initialize(compiler); end
|
2719
|
+
|
2720
|
+
def compile(node); end
|
2721
|
+
|
2722
|
+
# Returns the value of attribute compiler.
|
2723
|
+
def compiler; end
|
2724
|
+
|
2725
|
+
private
|
2726
|
+
|
2727
|
+
def do_compile; end
|
2728
|
+
|
2729
|
+
# Returns the value of attribute node.
|
2730
|
+
def node; end
|
2731
|
+
|
2732
|
+
class << self
|
2733
|
+
# @private
|
2734
|
+
def inherited(base); end
|
2735
|
+
|
2736
|
+
# @private
|
2737
|
+
def method_added(method); end
|
2738
|
+
|
2739
|
+
# Returns the value of attribute registry.
|
2740
|
+
def registry; end
|
2741
|
+
end
|
2742
|
+
end
|
2743
|
+
|
2744
|
+
class RuboCop::AST::NodePattern::Invalid < ::StandardError; end
|
2745
|
+
|
2746
|
+
# Lexer class for `NodePattern`
|
2747
|
+
#
|
2748
|
+
# Doc on how this fits in the compiling process:
|
2749
|
+
# /docs/modules/ROOT/pages/node_pattern.adoc
|
2750
|
+
class RuboCop::AST::NodePattern::Lexer < ::RuboCop::AST::NodePattern::LexerRex
|
2751
|
+
# @return [Lexer] a new instance of Lexer
|
2752
|
+
def initialize(source); end
|
2753
|
+
|
2754
|
+
# Returns the value of attribute comments.
|
2755
|
+
def comments; end
|
2756
|
+
|
2757
|
+
# Returns the value of attribute source_buffer.
|
2758
|
+
def source_buffer; end
|
2759
|
+
|
2760
|
+
# Returns the value of attribute tokens.
|
2761
|
+
def tokens; end
|
2762
|
+
|
2763
|
+
private
|
2764
|
+
|
2765
|
+
def do_parse; end
|
2766
|
+
|
2767
|
+
# @return [token]
|
2768
|
+
def emit(type); end
|
2769
|
+
|
2770
|
+
def emit_comment; end
|
2771
|
+
def emit_regexp; end
|
2772
|
+
def token(type, value); end
|
2773
|
+
end
|
2774
|
+
|
2775
|
+
RuboCop::AST::NodePattern::Lexer::Error = RuboCop::AST::NodePattern::LexerRex::ScanError
|
2776
|
+
RuboCop::AST::NodePattern::Lexer::REGEXP_OPTIONS = T.let(T.unsafe(nil), Hash)
|
2777
|
+
|
2778
|
+
# The generated lexer RuboCop::AST::NodePattern::LexerRex
|
2779
|
+
class RuboCop::AST::NodePattern::LexerRex
|
2780
|
+
# Yields on the current action.
|
2781
|
+
def action; end
|
2782
|
+
|
2783
|
+
# The file name / path
|
2784
|
+
def filename; end
|
2785
|
+
|
2786
|
+
# The file name / path
|
2787
|
+
def filename=(_arg0); end
|
2788
|
+
|
2789
|
+
# The current location in the parse.
|
2790
|
+
def location; end
|
2791
|
+
|
2792
|
+
# The StringScanner for this lexer.
|
2793
|
+
def match; end
|
2794
|
+
|
2795
|
+
# The match groups for the current scan.
|
2796
|
+
def matches; end
|
2797
|
+
|
2798
|
+
# Lex the next token.
|
2799
|
+
def next_token; end
|
2800
|
+
|
2801
|
+
# Parse the given string.
|
2802
|
+
def parse(str); end
|
2803
|
+
|
2804
|
+
# Read in and parse the file at +path+.
|
2805
|
+
def parse_file(path); end
|
2806
|
+
|
2807
|
+
# The current scanner class. Must be overridden in subclasses.
|
2808
|
+
def scanner_class; end
|
2809
|
+
|
2810
|
+
# The StringScanner for this lexer.
|
2811
|
+
def ss; end
|
2812
|
+
|
2813
|
+
# The StringScanner for this lexer.
|
2814
|
+
def ss=(_arg0); end
|
2815
|
+
|
2816
|
+
# The current lexical state.
|
2817
|
+
def state; end
|
2818
|
+
|
2819
|
+
# The current lexical state.
|
2820
|
+
def state=(_arg0); end
|
2821
|
+
end
|
2822
|
+
|
2823
|
+
RuboCop::AST::NodePattern::LexerRex::CALL = T.let(T.unsafe(nil), Regexp)
|
2824
|
+
|
2825
|
+
# :stopdoc:
|
2826
|
+
RuboCop::AST::NodePattern::LexerRex::CONST_NAME = T.let(T.unsafe(nil), Regexp)
|
2827
|
+
|
2828
|
+
RuboCop::AST::NodePattern::LexerRex::IDENTIFIER = T.let(T.unsafe(nil), Regexp)
|
2829
|
+
|
2830
|
+
# :startdoc:
|
2831
|
+
# :stopdoc:
|
2832
|
+
class RuboCop::AST::NodePattern::LexerRex::LexerError < ::StandardError; end
|
2833
|
+
|
2834
|
+
RuboCop::AST::NodePattern::LexerRex::NODE_TYPE = T.let(T.unsafe(nil), Regexp)
|
2835
|
+
RuboCop::AST::NodePattern::LexerRex::REGEXP = T.let(T.unsafe(nil), Regexp)
|
2836
|
+
RuboCop::AST::NodePattern::LexerRex::REGEXP_BODY = T.let(T.unsafe(nil), Regexp)
|
2837
|
+
RuboCop::AST::NodePattern::LexerRex::SYMBOL_NAME = T.let(T.unsafe(nil), Regexp)
|
2838
|
+
class RuboCop::AST::NodePattern::LexerRex::ScanError < ::RuboCop::AST::NodePattern::LexerRex::LexerError; end
|
2839
|
+
|
2840
|
+
# Helpers for defining methods based on a pattern string
|
2841
|
+
module RuboCop::AST::NodePattern::Macros
|
2842
|
+
# Define a method which applies a pattern to an AST node
|
2843
|
+
#
|
2844
|
+
# The new method will return nil if the node does not match.
|
2845
|
+
# If the node matches, and a block is provided, the new method will
|
2846
|
+
# yield to the block (passing any captures as block arguments).
|
2847
|
+
# If the node matches, and no block is provided, the new method will
|
2848
|
+
# return the captures, or `true` if there were none.
|
2849
|
+
def def_node_matcher(method_name, pattern_str, **keyword_defaults); end
|
2850
|
+
|
2851
|
+
# Define a method which recurses over the descendants of an AST node,
|
2852
|
+
# checking whether any of them match the provided pattern
|
2853
|
+
#
|
2854
|
+
# If the method name ends with '?', the new method will return `true`
|
2855
|
+
# as soon as it finds a descendant which matches. Otherwise, it will
|
2856
|
+
# yield all descendants which match.
|
2857
|
+
def def_node_search(method_name, pattern_str, **keyword_defaults); end
|
2858
|
+
end
|
2859
|
+
|
2860
|
+
# Functionality to turn `match_code` into methods/lambda
|
2861
|
+
module RuboCop::AST::NodePattern::MethodDefiner
|
2862
|
+
def as_lambda; end
|
2863
|
+
def compile_as_lambda; end
|
2864
|
+
def def_node_matcher(base, method_name, **defaults); end
|
2865
|
+
def def_node_search(base, method_name, **defaults); end
|
2866
|
+
|
2867
|
+
private
|
2868
|
+
|
2869
|
+
def compile_init; end
|
2870
|
+
def def_helper(base, method_name, **defaults); end
|
2871
|
+
def emit_keyword_list(forwarding: T.unsafe(nil)); end
|
2872
|
+
def emit_lambda_code; end
|
2873
|
+
def emit_method_code; end
|
2874
|
+
def emit_node_search(method_name); end
|
2875
|
+
def emit_node_search_body(method_name, prelude:, on_match:); end
|
2876
|
+
def emit_param_list; end
|
2877
|
+
def emit_params(*first, forwarding: T.unsafe(nil)); end
|
2878
|
+
def emit_retval; end
|
2879
|
+
def emit_yield_capture(when_no_capture = T.unsafe(nil), yield_with: T.unsafe(nil)); end
|
2880
|
+
|
2881
|
+
# This method minimizes the closure for our method
|
2882
|
+
def wrapping_block(method_name, **defaults); end
|
2883
|
+
end
|
2884
|
+
|
2885
|
+
# Base class for AST Nodes of a `NodePattern`
|
2886
|
+
class RuboCop::AST::NodePattern::Node < ::Parser::AST::Node
|
2887
|
+
include ::RuboCop::AST::Descendence
|
2888
|
+
extend ::Forwardable
|
2889
|
+
|
2890
|
+
# Note: `arity.end` may be `Float::INFINITY`
|
2891
|
+
#
|
2892
|
+
# @return [Integer, Range] An Integer for fixed length terms, otherwise a Range.
|
2893
|
+
def arity; end
|
2894
|
+
|
2895
|
+
# @return [Range] arity as a Range
|
2896
|
+
def arity_range; end
|
2897
|
+
|
2898
|
+
# @return [Boolean]
|
2899
|
+
def capture?; end
|
2900
|
+
|
2901
|
+
# @return [Node] most nodes have only one child
|
2902
|
+
def child; end
|
2903
|
+
|
2904
|
+
# @return [Array<Node>]
|
2905
|
+
def children_nodes; end
|
2906
|
+
|
2907
|
+
# @return [Array<Node>, nil] replace node with result, or `nil` if no change requested.
|
2908
|
+
def in_sequence_head; end
|
2909
|
+
|
2910
|
+
# that matches within a Set (e.g. `42`, `:sym` but not `/regexp/`)
|
2911
|
+
#
|
2912
|
+
# @return [Boolean] returns true for nodes having a Ruby literal equivalent
|
2913
|
+
def matches_within_set?; end
|
2914
|
+
|
2915
|
+
# @return [Integer] nb of captures of that node and its descendants
|
2916
|
+
def nb_captures; end
|
2917
|
+
|
2918
|
+
# To be overridden by subclasses
|
2919
|
+
#
|
2920
|
+
# @return [Boolean]
|
2921
|
+
def rest?; end
|
2922
|
+
|
2923
|
+
# @return [Boolean] returns whether it matches a variable number of elements
|
2924
|
+
def variadic?; end
|
2925
|
+
|
2926
|
+
def with(type: T.unsafe(nil), children: T.unsafe(nil), location: T.unsafe(nil)); end
|
2927
|
+
end
|
2928
|
+
|
2929
|
+
# Node class for `<int str ...>`
|
2930
|
+
class RuboCop::AST::NodePattern::Node::AnyOrder < ::RuboCop::AST::NodePattern::Node
|
2931
|
+
include ::RuboCop::AST::NodePattern::Node::ForbidInSeqHead
|
2932
|
+
|
2933
|
+
def arity; end
|
2934
|
+
|
2935
|
+
# @return [Boolean]
|
2936
|
+
def ends_with_rest?; end
|
2937
|
+
|
2938
|
+
def rest_node; end
|
2939
|
+
def term_nodes; end
|
2940
|
+
end
|
2941
|
+
|
2942
|
+
RuboCop::AST::NodePattern::Node::AnyOrder::ARITIES = T.let(T.unsafe(nil), Hash)
|
2943
|
+
|
2944
|
+
# Node class for `$something`
|
2945
|
+
class RuboCop::AST::NodePattern::Node::Capture < ::RuboCop::AST::NodePattern::Node
|
2946
|
+
def arity(*args, **_arg1, &block); end
|
2947
|
+
|
2948
|
+
# @return [Boolean]
|
2949
|
+
def capture?; end
|
2950
|
+
|
2951
|
+
def in_sequence_head; end
|
2952
|
+
def nb_captures; end
|
2953
|
+
def rest?(*args, **_arg1, &block); end
|
2954
|
+
end
|
2955
|
+
|
2956
|
+
module RuboCop::AST::NodePattern::Node::ForbidInSeqHead
|
2957
|
+
# @raise [NodePattern::Invalid]
|
2958
|
+
def in_sequence_head; end
|
2959
|
+
end
|
2960
|
+
|
2961
|
+
RuboCop::AST::NodePattern::Node::FunctionCall = RuboCop::AST::NodePattern::Node::Predicate
|
2962
|
+
RuboCop::AST::NodePattern::Node::INT_TO_RANGE = T.let(T.unsafe(nil), Hash)
|
2963
|
+
|
2964
|
+
# Registry
|
2965
|
+
RuboCop::AST::NodePattern::Node::MAP = T.let(T.unsafe(nil), Hash)
|
2966
|
+
|
2967
|
+
RuboCop::AST::NodePattern::Node::MATCHES_WITHIN_SET = T.let(T.unsafe(nil), Set)
|
2968
|
+
|
2969
|
+
# Node class for `predicate?(:arg, :list)`
|
2970
|
+
class RuboCop::AST::NodePattern::Node::Predicate < ::RuboCop::AST::NodePattern::Node
|
2971
|
+
def arg_list; end
|
2972
|
+
def method_name; end
|
2973
|
+
end
|
2974
|
+
|
2975
|
+
# Node class for `int+`
|
2976
|
+
class RuboCop::AST::NodePattern::Node::Repetition < ::RuboCop::AST::NodePattern::Node
|
2977
|
+
include ::RuboCop::AST::NodePattern::Node::ForbidInSeqHead
|
2978
|
+
|
2979
|
+
def arity; end
|
2980
|
+
def operator; end
|
2981
|
+
end
|
2982
|
+
|
2983
|
+
RuboCop::AST::NodePattern::Node::Repetition::ARITIES = T.let(T.unsafe(nil), Hash)
|
2984
|
+
|
2985
|
+
# Node class for `...`
|
2986
|
+
class RuboCop::AST::NodePattern::Node::Rest < ::RuboCop::AST::NodePattern::Node
|
2987
|
+
def arity; end
|
2988
|
+
def in_sequence_head; end
|
2989
|
+
|
2990
|
+
# @return [Boolean]
|
2991
|
+
def rest?; end
|
2992
|
+
end
|
2993
|
+
|
2994
|
+
RuboCop::AST::NodePattern::Node::Rest::ARITY = T.let(T.unsafe(nil), Range)
|
2995
|
+
|
2996
|
+
# Node class for `(type first second ...)`
|
2997
|
+
class RuboCop::AST::NodePattern::Node::Sequence < ::RuboCop::AST::NodePattern::Node
|
2998
|
+
include ::RuboCop::AST::NodePattern::Node::ForbidInSeqHead
|
2999
|
+
|
3000
|
+
# @return [Sequence] a new instance of Sequence
|
3001
|
+
def initialize(type, children = T.unsafe(nil), properties = T.unsafe(nil)); end
|
3002
|
+
end
|
3003
|
+
|
3004
|
+
# A list (potentially empty) of nodes; part of a Union
|
3005
|
+
class RuboCop::AST::NodePattern::Node::Subsequence < ::RuboCop::AST::NodePattern::Node
|
3006
|
+
include ::RuboCop::AST::NodePattern::Node::ForbidInSeqHead
|
3007
|
+
|
3008
|
+
def arity; end
|
3009
|
+
def in_sequence_head; end
|
3010
|
+
end
|
3011
|
+
|
3012
|
+
# Node class for `{ ... }`
|
3013
|
+
class RuboCop::AST::NodePattern::Node::Union < ::RuboCop::AST::NodePattern::Node
|
3014
|
+
def arity; end
|
3015
|
+
def in_sequence_head; end
|
3016
|
+
end
|
3017
|
+
|
3018
|
+
# Parser for NodePattern
|
3019
|
+
# Note: class reopened in `parser.racc`
|
3020
|
+
#
|
3021
|
+
# Doc on how this fits in the compiling process:
|
3022
|
+
# /docs/modules/ROOT/pages/node_pattern.adoc
|
3023
|
+
class RuboCop::AST::NodePattern::Parser < ::Racc::Parser
|
3024
|
+
extend ::Forwardable
|
3025
|
+
|
3026
|
+
# @return [Parser] a new instance of Parser
|
3027
|
+
def initialize(builder = T.unsafe(nil)); end
|
3028
|
+
|
3029
|
+
def _reduce_10(val, _values); end
|
3030
|
+
def _reduce_11(val, _values); end
|
3031
|
+
|
3032
|
+
# reduce 12 omitted
|
3033
|
+
def _reduce_13(val, _values); end
|
3034
|
+
|
3035
|
+
def _reduce_14(val, _values); end
|
3036
|
+
def _reduce_15(val, _values); end
|
3037
|
+
def _reduce_16(val, _values); end
|
3038
|
+
def _reduce_17(val, _values); end
|
3039
|
+
def _reduce_18(val, _values); end
|
3040
|
+
def _reduce_19(val, _values); end
|
3041
|
+
|
3042
|
+
# reduce 1 omitted
|
3043
|
+
def _reduce_2(val, _values); end
|
3044
|
+
|
3045
|
+
def _reduce_20(val, _values); end
|
3046
|
+
def _reduce_21(val, _values); end
|
3047
|
+
def _reduce_22(val, _values); end
|
3048
|
+
|
3049
|
+
# reduce 24 omitted
|
3050
|
+
def _reduce_25(val, _values); end
|
3051
|
+
|
3052
|
+
def _reduce_26(val, _values); end
|
3053
|
+
def _reduce_3(val, _values); end
|
3054
|
+
|
3055
|
+
# reduce 32 omitted
|
3056
|
+
def _reduce_33(val, _values); end
|
3057
|
+
|
3058
|
+
# reduce 36 omitted
|
3059
|
+
def _reduce_37(val, _values); end
|
3060
|
+
|
3061
|
+
def _reduce_38(val, _values); end
|
3062
|
+
def _reduce_39(val, _values); end
|
3063
|
+
def _reduce_4(val, _values); end
|
3064
|
+
def _reduce_40(val, _values); end
|
3065
|
+
def _reduce_41(val, _values); end
|
3066
|
+
def _reduce_42(val, _values); end
|
3067
|
+
def _reduce_43(val, _values); end
|
3068
|
+
def _reduce_44(val, _values); end
|
3069
|
+
def _reduce_45(val, _values); end
|
3070
|
+
def _reduce_46(val, _values); end
|
3071
|
+
def _reduce_5(val, _values); end
|
3072
|
+
def _reduce_6(val, _values); end
|
3073
|
+
def _reduce_7(val, _values); end
|
3074
|
+
def _reduce_8(val, _values); end
|
3075
|
+
def _reduce_9(val, _values); end
|
3076
|
+
def _reduce_none(val, _values); end
|
3077
|
+
def emit_atom(*args, **_arg1, &block); end
|
3078
|
+
def emit_call(*args, **_arg1, &block); end
|
3079
|
+
def emit_capture(*args, **_arg1, &block); end
|
3080
|
+
def emit_list(*args, **_arg1, &block); end
|
3081
|
+
def emit_unary_op(*args, **_arg1, &block); end
|
3082
|
+
def emit_union(*args, **_arg1, &block); end
|
3083
|
+
def inspect; end
|
3084
|
+
def next_token(*args, **_arg1, &block); end
|
3085
|
+
|
3086
|
+
# (Similar API to `parser` gem)
|
3087
|
+
# Parses a source and returns the AST.
|
3088
|
+
#
|
3089
|
+
# @param source_buffer [Parser::Source::Buffer, String] The source buffer to parse.
|
3090
|
+
# @return [NodePattern::Node]
|
3091
|
+
def parse(source); end
|
3092
|
+
|
3093
|
+
private
|
3094
|
+
|
3095
|
+
# @raise [NodePattern::Invalid]
|
3096
|
+
def enforce_unary(node); end
|
3097
|
+
|
3098
|
+
# Overrides Racc::Parser's method:
|
3099
|
+
#
|
3100
|
+
# @raise [NodePattern::Invalid]
|
3101
|
+
def on_error(token, val, _vstack); end
|
3102
|
+
end
|
3103
|
+
|
3104
|
+
RuboCop::AST::NodePattern::Parser::Builder = RuboCop::AST::NodePattern::Builder
|
3105
|
+
RuboCop::AST::NodePattern::Parser::Lexer = RuboCop::AST::NodePattern::Lexer
|
3106
|
+
RuboCop::AST::NodePattern::Parser::Racc_arg = T.let(T.unsafe(nil), Array)
|
3107
|
+
RuboCop::AST::NodePattern::Parser::Racc_token_to_s_table = T.let(T.unsafe(nil), Array)
|
3108
|
+
|
3109
|
+
# Overrides Parser to use `WithMeta` variants and provide additional methods
|
3110
|
+
class RuboCop::AST::NodePattern::Parser::WithMeta < ::RuboCop::AST::NodePattern::Parser
|
3111
|
+
# Returns the value of attribute comments.
|
3112
|
+
def comments; end
|
3113
|
+
|
3114
|
+
def do_parse; end
|
3115
|
+
|
3116
|
+
# Returns the value of attribute tokens.
|
3117
|
+
def tokens; end
|
3118
|
+
end
|
3119
|
+
|
3120
|
+
# Overrides Builder to emit nodes with locations
|
3121
|
+
class RuboCop::AST::NodePattern::Parser::WithMeta::Builder < ::RuboCop::AST::NodePattern::Builder
|
3122
|
+
def emit_atom(type, token); end
|
3123
|
+
def emit_call(type, selector_t, args = T.unsafe(nil)); end
|
3124
|
+
def emit_list(type, begin_t, children, end_t); end
|
3125
|
+
def emit_unary_op(type, operator_t = T.unsafe(nil), *children); end
|
3126
|
+
|
3127
|
+
private
|
3128
|
+
|
3129
|
+
def join_exprs(left_expr, right_expr); end
|
3130
|
+
def loc(token_or_range); end
|
3131
|
+
def n(type, children, source_map); end
|
3132
|
+
def source_map(token_or_range, begin_t: T.unsafe(nil), end_t: T.unsafe(nil), operator_t: T.unsafe(nil), selector_t: T.unsafe(nil)); end
|
3133
|
+
end
|
3134
|
+
|
3135
|
+
# Overrides Lexer to token locations and comments
|
3136
|
+
class RuboCop::AST::NodePattern::Parser::WithMeta::Lexer < ::RuboCop::AST::NodePattern::Lexer
|
3137
|
+
# @return [Lexer] a new instance of Lexer
|
3138
|
+
def initialize(str_or_buffer); end
|
3139
|
+
|
3140
|
+
def emit_comment; end
|
3141
|
+
|
3142
|
+
# @return [::Parser::Source::Range] last match's position
|
3143
|
+
def pos; end
|
3144
|
+
|
3145
|
+
# Returns the value of attribute source_buffer.
|
3146
|
+
def source_buffer; end
|
3147
|
+
|
3148
|
+
def token(type, value); end
|
3149
|
+
end
|
3150
|
+
|
3151
|
+
# Utility to assign a set of values to a constant
|
3152
|
+
module RuboCop::AST::NodePattern::Sets
|
3153
|
+
class << self
|
3154
|
+
def [](set); end
|
3155
|
+
def name(set); end
|
3156
|
+
def uniq(name); end
|
3157
|
+
end
|
3158
|
+
end
|
3159
|
+
|
3160
|
+
RuboCop::AST::NodePattern::Sets::MAX = T.let(T.unsafe(nil), Integer)
|
3161
|
+
RuboCop::AST::NodePattern::Sets::REGISTRY = T.let(T.unsafe(nil), Hash)
|
3162
|
+
RuboCop::AST::NodePattern::Sets::SET_0_1 = T.let(T.unsafe(nil), Set)
|
3163
|
+
RuboCop::AST::NodePattern::Sets::SET_10_10 = T.let(T.unsafe(nil), Set)
|
3164
|
+
RuboCop::AST::NodePattern::Sets::SET_1_1 = T.let(T.unsafe(nil), Set)
|
3165
|
+
RuboCop::AST::NodePattern::Sets::SET_ABSTRACT_OVERRIDE_OVERRIDABLE_ETC = T.let(T.unsafe(nil), Set)
|
3166
|
+
RuboCop::AST::NodePattern::Sets::SET_ADD_DEPENDENCY_ADD_RUNTIME_DEPENDENCY_ADD_DEVELOPMENT_DEPENDENCY = T.let(T.unsafe(nil), Set)
|
3167
|
+
RuboCop::AST::NodePattern::Sets::SET_ANY_ALL_NORETURN_ETC = T.let(T.unsafe(nil), Set)
|
3168
|
+
RuboCop::AST::NodePattern::Sets::SET_ATTR_READER_ATTR_WRITER_ATTR_ACCESSOR = T.let(T.unsafe(nil), Set)
|
3169
|
+
RuboCop::AST::NodePattern::Sets::SET_ATTR_READER_ATTR_WRITER_ATTR_ACCESSOR_ATTR = T.let(T.unsafe(nil), Set)
|
3170
|
+
RuboCop::AST::NodePattern::Sets::SET_BRANCH_REF_TAG = T.let(T.unsafe(nil), Set)
|
3171
|
+
RuboCop::AST::NodePattern::Sets::SET_CAPTURE2_CAPTURE2E_CAPTURE3_ETC = T.let(T.unsafe(nil), Set)
|
3172
|
+
RuboCop::AST::NodePattern::Sets::SET_CIPHER_DIGEST = T.let(T.unsafe(nil), Set)
|
3173
|
+
RuboCop::AST::NodePattern::Sets::SET_CLASS_EVAL_INSTANCE_EVAL = T.let(T.unsafe(nil), Set)
|
3174
|
+
RuboCop::AST::NodePattern::Sets::SET_CLASS_EVAL_MODULE_EVAL = T.let(T.unsafe(nil), Set)
|
3175
|
+
RuboCop::AST::NodePattern::Sets::SET_CLASS_MODULE = T.let(T.unsafe(nil), Set)
|
3176
|
+
RuboCop::AST::NodePattern::Sets::SET_CLASS_MODULE_STRUCT = T.let(T.unsafe(nil), Set)
|
3177
|
+
RuboCop::AST::NodePattern::Sets::SET_CONSTANTIZE_CONSTANTS_CONST_GET = T.let(T.unsafe(nil), Set)
|
3178
|
+
RuboCop::AST::NodePattern::Sets::SET_COUNT_LENGTH_SIZE = T.let(T.unsafe(nil), Set)
|
3179
|
+
RuboCop::AST::NodePattern::Sets::SET_DEFINE_METHOD = T.let(T.unsafe(nil), Set)
|
3180
|
+
RuboCop::AST::NodePattern::Sets::SET_DEFINE_METHOD_DEFINE_SINGLETON_METHOD = T.let(T.unsafe(nil), Set)
|
3181
|
+
RuboCop::AST::NodePattern::Sets::SET_EACH_WITH_INDEX_WITH_INDEX = T.let(T.unsafe(nil), Set)
|
3182
|
+
RuboCop::AST::NodePattern::Sets::SET_EACH_WITH_OBJECT_WITH_OBJECT = T.let(T.unsafe(nil), Set)
|
3183
|
+
RuboCop::AST::NodePattern::Sets::SET_ENUMERATOR_RATIONAL_COMPLEX_THREAD = T.let(T.unsafe(nil), Set)
|
3184
|
+
RuboCop::AST::NodePattern::Sets::SET_ESCAPE_ENCODE_UNESCAPE_DECODE = T.let(T.unsafe(nil), Set)
|
3185
|
+
RuboCop::AST::NodePattern::Sets::SET_EXIST_EXISTS = T.let(T.unsafe(nil), Set)
|
3186
|
+
RuboCop::AST::NodePattern::Sets::SET_FIRST_LAST__ETC = T.let(T.unsafe(nil), Set)
|
3187
|
+
RuboCop::AST::NodePattern::Sets::SET_FIXNUM_BIGNUM = T.let(T.unsafe(nil), Set)
|
3188
|
+
RuboCop::AST::NodePattern::Sets::SET_FORMAT_SPRINTF_PRINTF = T.let(T.unsafe(nil), Set)
|
3189
|
+
RuboCop::AST::NodePattern::Sets::SET_GSUB_GSUB = T.let(T.unsafe(nil), Set)
|
3190
|
+
RuboCop::AST::NodePattern::Sets::SET_INCLUDE_EXTEND_PREPEND = T.let(T.unsafe(nil), Set)
|
3191
|
+
RuboCop::AST::NodePattern::Sets::SET_INSTANCE_EVAL_CLASS_EVAL_MODULE_EVAL = T.let(T.unsafe(nil), Set)
|
3192
|
+
RuboCop::AST::NodePattern::Sets::SET_INSTANCE_EXEC_CLASS_EXEC_MODULE_EXEC = T.let(T.unsafe(nil), Set)
|
3193
|
+
RuboCop::AST::NodePattern::Sets::SET_KEYS_VALUES = T.let(T.unsafe(nil), Set)
|
3194
|
+
RuboCop::AST::NodePattern::Sets::SET_KEY_HAS_KEY_FETCH_ETC = T.let(T.unsafe(nil), Set)
|
3195
|
+
RuboCop::AST::NodePattern::Sets::SET_LAST_FIRST = T.let(T.unsafe(nil), Set)
|
3196
|
+
RuboCop::AST::NodePattern::Sets::SET_LENGTH_SIZE = T.let(T.unsafe(nil), Set)
|
3197
|
+
RuboCop::AST::NodePattern::Sets::SET_LOAD_RESTORE = T.let(T.unsafe(nil), Set)
|
3198
|
+
RuboCop::AST::NodePattern::Sets::SET_MAP_COLLECT = T.let(T.unsafe(nil), Set)
|
3199
|
+
RuboCop::AST::NodePattern::Sets::SET_NEW_ = T.let(T.unsafe(nil), Set)
|
3200
|
+
RuboCop::AST::NodePattern::Sets::SET_NEW_OPEN = T.let(T.unsafe(nil), Set)
|
3201
|
+
RuboCop::AST::NodePattern::Sets::SET_NIL_ = T.let(T.unsafe(nil), Set)
|
3202
|
+
RuboCop::AST::NodePattern::Sets::SET_PIPELINE_PIPELINE_R_PIPELINE_RW_ETC = T.let(T.unsafe(nil), Set)
|
3203
|
+
RuboCop::AST::NodePattern::Sets::SET_PRIVATE_PROTECTED = T.let(T.unsafe(nil), Set)
|
3204
|
+
RuboCop::AST::NodePattern::Sets::SET_PRIVATE_PROTECTED_PUBLIC = T.let(T.unsafe(nil), Set)
|
3205
|
+
RuboCop::AST::NodePattern::Sets::SET_PROP_CONST = T.let(T.unsafe(nil), Set)
|
3206
|
+
RuboCop::AST::NodePattern::Sets::SET_PUBLIC_CONSTANT_PRIVATE_CONSTANT = T.let(T.unsafe(nil), Set)
|
3207
|
+
RuboCop::AST::NodePattern::Sets::SET_PUBLIC_PROTECTED_PRIVATE_MODULE_FUNCTION = T.let(T.unsafe(nil), Set)
|
3208
|
+
RuboCop::AST::NodePattern::Sets::SET_RAISE_FAIL = T.let(T.unsafe(nil), Set)
|
3209
|
+
RuboCop::AST::NodePattern::Sets::SET_RAISE_FAIL_THROW_ETC = T.let(T.unsafe(nil), Set)
|
3210
|
+
RuboCop::AST::NodePattern::Sets::SET_REDUCE_INJECT = T.let(T.unsafe(nil), Set)
|
3211
|
+
RuboCop::AST::NodePattern::Sets::SET_REJECT_REJECT = T.let(T.unsafe(nil), Set)
|
3212
|
+
RuboCop::AST::NodePattern::Sets::SET_REQUIRE_REQUIRE_RELATIVE = T.let(T.unsafe(nil), Set)
|
3213
|
+
RuboCop::AST::NodePattern::Sets::SET_SELECT_SELECT = T.let(T.unsafe(nil), Set)
|
3214
|
+
RuboCop::AST::NodePattern::Sets::SET_SEND_PUBLIC_SEND___SEND__ = T.let(T.unsafe(nil), Set)
|
3215
|
+
RuboCop::AST::NodePattern::Sets::SET_SORT_BY_SORT = T.let(T.unsafe(nil), Set)
|
3216
|
+
RuboCop::AST::NodePattern::Sets::SET_SPAWN_SYSTEM = T.let(T.unsafe(nil), Set)
|
3217
|
+
RuboCop::AST::NodePattern::Sets::SET_SPRINTF_FORMAT = T.let(T.unsafe(nil), Set)
|
3218
|
+
RuboCop::AST::NodePattern::Sets::SET_STRUCT_CLASS = T.let(T.unsafe(nil), Set)
|
3219
|
+
RuboCop::AST::NodePattern::Sets::SET_SUCC_PRED_NEXT = T.let(T.unsafe(nil), Set)
|
3220
|
+
RuboCop::AST::NodePattern::Sets::SET_TASK_NAMESPACE = T.let(T.unsafe(nil), Set)
|
3221
|
+
RuboCop::AST::NodePattern::Sets::SET_TEMPFILE_STRINGIO = T.let(T.unsafe(nil), Set)
|
3222
|
+
RuboCop::AST::NodePattern::Sets::SET_TO_ENUM_ENUM_FOR = T.let(T.unsafe(nil), Set)
|
3223
|
+
RuboCop::AST::NodePattern::Sets::SET_TO_H_TO_HASH = T.let(T.unsafe(nil), Set)
|
3224
|
+
RuboCop::AST::NodePattern::Sets::SET_TO_I_TO_F_TO_C_TO_R = T.let(T.unsafe(nil), Set)
|
3225
|
+
RuboCop::AST::NodePattern::Sets::SET_TRUE_FALSE = T.let(T.unsafe(nil), Set)
|
3226
|
+
RuboCop::AST::NodePattern::Sets::SET_TYPE_TEMPLATE_TYPE_MEMBER = T.let(T.unsafe(nil), Set)
|
3227
|
+
RuboCop::AST::NodePattern::Sets::SET_ZERO_POSITIVE_NEGATIVE = T.let(T.unsafe(nil), Set)
|
3228
|
+
RuboCop::AST::NodePattern::Sets::SET__ = T.let(T.unsafe(nil), Set)
|
3229
|
+
RuboCop::AST::NodePattern::Sets::SET__AT_SLICE = T.let(T.unsafe(nil), Set)
|
3230
|
+
RuboCop::AST::NodePattern::Sets::SET__EQUAL_EQL = T.let(T.unsafe(nil), Set)
|
3231
|
+
RuboCop::AST::NodePattern::Sets::SET__FETCH = T.let(T.unsafe(nil), Set)
|
3232
|
+
RuboCop::AST::NodePattern::Sets::SET__GLOB = T.let(T.unsafe(nil), Set)
|
3233
|
+
RuboCop::AST::NodePattern::Sets::SET___ = T.let(T.unsafe(nil), Set)
|
3234
|
+
RuboCop::AST::NodePattern::Sets::SET___2 = T.let(T.unsafe(nil), Set)
|
3235
|
+
RuboCop::AST::NodePattern::Sets::SET___3 = T.let(T.unsafe(nil), Set)
|
3236
|
+
RuboCop::AST::NodePattern::Sets::SET___4 = T.let(T.unsafe(nil), Set)
|
3237
|
+
RuboCop::AST::NodePattern::Sets::SET___5 = T.let(T.unsafe(nil), Set)
|
3238
|
+
RuboCop::AST::NodePattern::Sets::SET___6 = T.let(T.unsafe(nil), Set)
|
3239
|
+
RuboCop::AST::NodePattern::Sets::SET___7 = T.let(T.unsafe(nil), Set)
|
3240
|
+
RuboCop::AST::NodePattern::Sets::SET___EQL = T.let(T.unsafe(nil), Set)
|
3241
|
+
RuboCop::AST::NodePattern::Sets::SET___METHOD_____CALLEE__ = T.let(T.unsafe(nil), Set)
|
3242
|
+
RuboCop::AST::NodePattern::Sets::SET____ = T.let(T.unsafe(nil), Set)
|
3243
|
+
RuboCop::AST::NodePattern::Sets::SET____ETC = T.let(T.unsafe(nil), Set)
|
3244
|
+
RuboCop::AST::NodePattern::Sets::SET____ETC_2 = T.let(T.unsafe(nil), Set)
|
3245
|
+
RuboCop::AST::NodePattern::Sets::SET____ETC_3 = T.let(T.unsafe(nil), Set)
|
3246
|
+
RuboCop::AST::NodePattern::Sets::SET_____2 = T.let(T.unsafe(nil), Set)
|
3247
|
+
RuboCop::AST::NodePattern::VAR = T.let(T.unsafe(nil), String)
|
3248
|
+
|
3249
|
+
# Common functionality for primitive numeric nodes: `int`, `float`, ...
|
3250
|
+
module RuboCop::AST::NumericNode
|
3251
|
+
# Checks whether this is literal has a sign.
|
3252
|
+
#
|
3253
|
+
# @example
|
3254
|
+
#
|
3255
|
+
# +42
|
3256
|
+
# @return [Boolean] whether this literal has a sign.
|
3257
|
+
def sign?; end
|
3258
|
+
end
|
3259
|
+
|
3260
|
+
RuboCop::AST::NumericNode::SIGN_REGEX = T.let(T.unsafe(nil), Regexp)
|
3261
|
+
|
3262
|
+
# A node extension for `op_asgn` nodes.
|
3263
|
+
# This will be used in place of a plain node when the builder constructs
|
3264
|
+
# the AST, making its methods available to all assignment nodes within RuboCop.
|
3265
|
+
class RuboCop::AST::OpAsgnNode < ::RuboCop::AST::Node
|
3266
|
+
# @return [AsgnNode] the assignment node
|
3267
|
+
def assignment_node; end
|
3268
|
+
|
3269
|
+
# The expression being assigned to the variable.
|
3270
|
+
#
|
3271
|
+
# @return [Node] the expression being assigned.
|
3272
|
+
def expression; end
|
3273
|
+
|
3274
|
+
# The name of the variable being assigned as a symbol.
|
3275
|
+
#
|
3276
|
+
# @return [Symbol] the name of the variable being assigned
|
3277
|
+
def name; end
|
3278
|
+
|
3279
|
+
# The operator being used for assignment as a symbol.
|
3280
|
+
#
|
3281
|
+
# @return [Symbol] the assignment operator
|
3282
|
+
def operator; end
|
3283
|
+
end
|
3284
|
+
|
3285
|
+
# A node extension for `op_asgn` nodes.
|
3286
|
+
# This will be used in place of a plain node when the builder constructs
|
3287
|
+
# the AST, making its methods available to all assignment nodes within RuboCop.
|
3288
|
+
class RuboCop::AST::OrAsgnNode < ::RuboCop::AST::OpAsgnNode
|
3289
|
+
# The operator being used for assignment as a symbol.
|
3290
|
+
#
|
3291
|
+
# @return [Symbol] the assignment operator
|
3292
|
+
def operator; end
|
3293
|
+
end
|
3294
|
+
|
3295
|
+
# A node extension for `or` nodes. This will be used in place of a plain
|
3296
|
+
# node when the builder constructs the AST, making its methods available
|
3297
|
+
# to all `or` nodes within RuboCop.
|
3298
|
+
class RuboCop::AST::OrNode < ::RuboCop::AST::Node
|
3299
|
+
include ::RuboCop::AST::BinaryOperatorNode
|
3300
|
+
include ::RuboCop::AST::PredicateOperatorNode
|
3301
|
+
|
3302
|
+
# Returns the alternate operator of the `or` as a string.
|
3303
|
+
# Returns `or` for `||` and vice versa.
|
3304
|
+
#
|
3305
|
+
# @return [String] the alternate of the `or` operator
|
3306
|
+
def alternate_operator; end
|
3307
|
+
|
3308
|
+
# Returns the inverse keyword of the `or` node as a string.
|
3309
|
+
# Returns `and` for `or` and `&&` for `||`.
|
3310
|
+
#
|
3311
|
+
# @return [String] the inverse of the `or` operator
|
3312
|
+
def inverse_operator; end
|
3313
|
+
end
|
3314
|
+
|
3315
|
+
# A node extension for `pair` nodes. This will be used in place of a plain
|
3316
|
+
# node when the builder constructs the AST, making its methods available
|
3317
|
+
# to all `pair` nodes within RuboCop.
|
3318
|
+
class RuboCop::AST::PairNode < ::RuboCop::AST::Node
|
3319
|
+
include ::RuboCop::AST::HashElementNode
|
3320
|
+
|
3321
|
+
# Checks whether the `pair` uses a colon delimiter.
|
3322
|
+
#
|
3323
|
+
# @return [Boolean] whether this `pair` uses a colon delimiter
|
3324
|
+
def colon?; end
|
3325
|
+
|
3326
|
+
# Returns the delimiter of the `pair` as a string. Returns `=>` for a
|
3327
|
+
# colon delimited `pair` and `:` for a hash rocket delimited `pair`.
|
3328
|
+
#
|
3329
|
+
# @param with_spacing [Boolean] whether to include spacing
|
3330
|
+
# @return [String] the delimiter of the `pair`
|
3331
|
+
def delimiter(*deprecated, with_spacing: T.unsafe(nil)); end
|
3332
|
+
|
3333
|
+
# Checks whether the `pair` uses a hash rocket delimiter.
|
3334
|
+
#
|
3335
|
+
# @return [Boolean] whether this `pair` uses a hash rocket delimiter
|
3336
|
+
def hash_rocket?; end
|
3337
|
+
|
3338
|
+
# Returns the inverse delimiter of the `pair` as a string.
|
3339
|
+
#
|
3340
|
+
# @param with_spacing [Boolean] whether to include spacing
|
3341
|
+
# @return [String] the inverse delimiter of the `pair`
|
3342
|
+
def inverse_delimiter(*deprecated, with_spacing: T.unsafe(nil)); end
|
3343
|
+
|
3344
|
+
# Checks whether the `pair` uses hash value omission.
|
3345
|
+
#
|
3346
|
+
# @return [Boolean] whether this `pair` uses hash value omission
|
3347
|
+
def value_omission?; end
|
3348
|
+
|
3349
|
+
# Checks whether the value starts on its own line.
|
3350
|
+
#
|
3351
|
+
# @return [Boolean] whether the value in the `pair` starts its own line
|
3352
|
+
def value_on_new_line?; end
|
3353
|
+
end
|
3354
|
+
|
3355
|
+
RuboCop::AST::PairNode::COLON = T.let(T.unsafe(nil), String)
|
3356
|
+
RuboCop::AST::PairNode::HASH_ROCKET = T.let(T.unsafe(nil), String)
|
3357
|
+
RuboCop::AST::PairNode::SPACED_COLON = T.let(T.unsafe(nil), String)
|
3358
|
+
RuboCop::AST::PairNode::SPACED_HASH_ROCKET = T.let(T.unsafe(nil), String)
|
3359
|
+
|
3360
|
+
# Requires implementing `arguments`.
|
3361
|
+
#
|
3362
|
+
# Common functionality for nodes that are parameterized:
|
3363
|
+
# `send`, `super`, `zsuper`, `def`, `defs`
|
3364
|
+
# and (modern only): `index`, `indexasgn`, `lambda`
|
3365
|
+
module RuboCop::AST::ParameterizedNode
|
3366
|
+
# Checks whether this node has any arguments.
|
3367
|
+
#
|
3368
|
+
# @return [Boolean] whether this node has any arguments
|
3369
|
+
def arguments?; end
|
3370
|
+
|
3371
|
+
# Whether the last argument of the node is a block pass,
|
3372
|
+
# i.e. `&block`.
|
3373
|
+
#
|
3374
|
+
# @return [Boolean] whether the last argument of the node is a block pass
|
3375
|
+
def block_argument?; end
|
3376
|
+
|
3377
|
+
# A shorthand for getting the first argument of the node.
|
3378
|
+
# Equivalent to `arguments.first`.
|
3379
|
+
#
|
3380
|
+
# @return [Node, nil] the first argument of the node,
|
3381
|
+
# or `nil` if there are no arguments
|
3382
|
+
def first_argument; end
|
3383
|
+
|
3384
|
+
# A shorthand for getting the last argument of the node.
|
3385
|
+
# Equivalent to `arguments.last`.
|
3386
|
+
#
|
3387
|
+
# @return [Node, nil] the last argument of the node,
|
3388
|
+
# or `nil` if there are no arguments
|
3389
|
+
def last_argument; end
|
3390
|
+
|
3391
|
+
# Checks whether this node's arguments are wrapped in parentheses.
|
3392
|
+
#
|
3393
|
+
# @return [Boolean] whether this node's arguments are
|
3394
|
+
# wrapped in parentheses
|
3395
|
+
def parenthesized?; end
|
3396
|
+
|
3397
|
+
# Checks whether any argument of the node is a splat
|
3398
|
+
# argument, i.e. `*splat`.
|
3399
|
+
#
|
3400
|
+
# @return [Boolean] whether the node is a splat argument
|
3401
|
+
def rest_argument?; end
|
3402
|
+
|
3403
|
+
# Checks whether any argument of the node is a splat
|
3404
|
+
# argument, i.e. `*splat`.
|
3405
|
+
#
|
3406
|
+
# @return [Boolean] whether the node is a splat argument
|
3407
|
+
def splat_argument?; end
|
3408
|
+
end
|
3409
|
+
|
3410
|
+
# A specialized `ParameterizedNode`.
|
3411
|
+
# Requires implementing `first_argument_index`
|
3412
|
+
# Implements `arguments` as `children[first_argument_index..-1]`
|
3413
|
+
# and optimizes other calls
|
3414
|
+
module RuboCop::AST::ParameterizedNode::RestArguments
|
3415
|
+
include ::RuboCop::AST::ParameterizedNode
|
3416
|
+
|
3417
|
+
# @return [Array<Node>] arguments, if any
|
3418
|
+
def arguments; end
|
3419
|
+
|
3420
|
+
# Checks whether this node has any arguments.
|
3421
|
+
#
|
3422
|
+
# @return [Boolean] whether this node has any arguments
|
3423
|
+
def arguments?; end
|
3424
|
+
|
3425
|
+
# A shorthand for getting the first argument of the node.
|
3426
|
+
# Equivalent to `arguments.first`.
|
3427
|
+
#
|
3428
|
+
# @return [Node, nil] the first argument of the node,
|
3429
|
+
# or `nil` if there are no arguments
|
3430
|
+
def first_argument; end
|
3431
|
+
|
3432
|
+
# A shorthand for getting the last argument of the node.
|
3433
|
+
# Equivalent to `arguments.last`.
|
3434
|
+
#
|
3435
|
+
# @return [Node, nil] the last argument of the node,
|
3436
|
+
# or `nil` if there are no arguments
|
3437
|
+
def last_argument; end
|
3438
|
+
end
|
3439
|
+
|
3440
|
+
# A specialized `ParameterizedNode` for node that have a single child
|
3441
|
+
# containing either `nil`, an argument, or a `begin` node with all the
|
3442
|
+
# arguments
|
3443
|
+
module RuboCop::AST::ParameterizedNode::WrappedArguments
|
3444
|
+
include ::RuboCop::AST::ParameterizedNode
|
3445
|
+
|
3446
|
+
# @return [Array] The arguments of the node.
|
3447
|
+
def arguments; end
|
3448
|
+
end
|
3449
|
+
|
3450
|
+
# Common functionality for nodes that are predicates:
|
3451
|
+
# `or`, `and` ...
|
3452
|
+
module RuboCop::AST::PredicateOperatorNode
|
3453
|
+
# Checks whether this is a logical operator.
|
3454
|
+
#
|
3455
|
+
# @return [Boolean] whether this is a logical operator
|
3456
|
+
def logical_operator?; end
|
3457
|
+
|
3458
|
+
# Returns the operator as a string.
|
3459
|
+
#
|
3460
|
+
# @return [String] the operator
|
3461
|
+
def operator; end
|
3462
|
+
|
3463
|
+
# Checks whether this is a semantic operator.
|
3464
|
+
#
|
3465
|
+
# @return [Boolean] whether this is a semantic operator
|
3466
|
+
def semantic_operator?; end
|
3467
|
+
end
|
3468
|
+
|
3469
|
+
RuboCop::AST::PredicateOperatorNode::LOGICAL_AND = T.let(T.unsafe(nil), String)
|
3470
|
+
RuboCop::AST::PredicateOperatorNode::LOGICAL_OR = T.let(T.unsafe(nil), String)
|
3471
|
+
RuboCop::AST::PredicateOperatorNode::SEMANTIC_AND = T.let(T.unsafe(nil), String)
|
3472
|
+
RuboCop::AST::PredicateOperatorNode::SEMANTIC_OR = T.let(T.unsafe(nil), String)
|
3473
|
+
|
3474
|
+
# A node extension for `procarg0` nodes.
|
3475
|
+
# This will be used in place of a plain node when the builder constructs
|
3476
|
+
# the AST, making its methods available to all `arg` nodes within RuboCop.
|
3477
|
+
class RuboCop::AST::Procarg0Node < ::RuboCop::AST::ArgNode
|
3478
|
+
# Returns the name of an argument.
|
3479
|
+
#
|
3480
|
+
# @return [Symbol, nil] the name of the argument
|
3481
|
+
def name; end
|
3482
|
+
end
|
3483
|
+
|
3484
|
+
# ProcessedSource contains objects which are generated by Parser
|
3485
|
+
# and other information such as disabled lines for cops.
|
3486
|
+
# It also provides a convenient way to access source lines.
|
3487
|
+
class RuboCop::AST::ProcessedSource
|
3488
|
+
include ::RuboCop::Ext::ProcessedSource
|
3489
|
+
|
3490
|
+
# @return [ProcessedSource] a new instance of ProcessedSource
|
3491
|
+
def initialize(source, ruby_version, path = T.unsafe(nil)); end
|
3492
|
+
|
3493
|
+
def [](*args); end
|
3494
|
+
|
3495
|
+
# Returns the value of attribute ast.
|
3496
|
+
def ast; end
|
3497
|
+
|
3498
|
+
def ast_with_comments; end
|
3499
|
+
|
3500
|
+
# @return [Boolean]
|
3501
|
+
def blank?; end
|
3502
|
+
|
3503
|
+
# Returns the value of attribute buffer.
|
3504
|
+
def buffer; end
|
3505
|
+
|
3506
|
+
# Raw source checksum for tracking infinite loops.
|
3507
|
+
def checksum; end
|
3508
|
+
|
3509
|
+
# @return [Comment, nil] the comment at that line, if any.
|
3510
|
+
def comment_at_line(line); end
|
3511
|
+
|
3512
|
+
# Consider using `each_comment_in_lines` instead
|
3513
|
+
#
|
3514
|
+
# @deprecated use contains_comment?
|
3515
|
+
# @return [Boolean] if any of the lines in the given `source_range` has a comment.
|
3516
|
+
def commented?(source_range); end
|
3517
|
+
|
3518
|
+
# Returns the value of attribute comments.
|
3519
|
+
def comments; end
|
3520
|
+
|
3521
|
+
# Should have been called `comments_before_or_at_line`. Doubtful it has of any valid use.
|
3522
|
+
#
|
3523
|
+
# @deprecated Use `each_comment_in_lines`
|
3524
|
+
def comments_before_line(line); end
|
3525
|
+
|
3526
|
+
# Consider using `each_comment_in_lines` instead
|
3527
|
+
#
|
3528
|
+
# @return [Boolean] if any of the lines in the given `source_range` has a comment.
|
3529
|
+
def contains_comment?(source_range); end
|
3530
|
+
|
3531
|
+
def current_line(token); end
|
3532
|
+
|
3533
|
+
# Returns the value of attribute diagnostics.
|
3534
|
+
def diagnostics; end
|
3535
|
+
|
3536
|
+
# @deprecated Use `comments.each`
|
3537
|
+
def each_comment(&block); end
|
3538
|
+
|
3539
|
+
# Enumerates on the comments contained with the given `line_range`
|
3540
|
+
def each_comment_in_lines(line_range); end
|
3541
|
+
|
3542
|
+
# @deprecated Use `tokens.each`
|
3543
|
+
def each_token(&block); end
|
3544
|
+
|
3545
|
+
def file_path; end
|
3546
|
+
|
3547
|
+
# @deprecated Use `comment_at_line`, `each_comment_in_lines`, or `comments.find`
|
3548
|
+
def find_comment(&block); end
|
3549
|
+
|
3550
|
+
# @deprecated Use `tokens.find`
|
3551
|
+
def find_token(&block); end
|
3552
|
+
|
3553
|
+
def first_token_of(range_or_node); end
|
3554
|
+
def following_line(token); end
|
3555
|
+
def last_token_of(range_or_node); end
|
3556
|
+
def line_indentation(line_number); end
|
3557
|
+
|
3558
|
+
# @return [Boolean] if the given line number has a comment.
|
3559
|
+
def line_with_comment?(line); end
|
3560
|
+
|
3561
|
+
# Returns the source lines, line break characters removed, excluding a
|
3562
|
+
# possible __END__ and everything that comes after.
|
3563
|
+
def lines; end
|
3564
|
+
|
3565
|
+
# Returns the value of attribute parser_error.
|
3566
|
+
def parser_error; end
|
3567
|
+
|
3568
|
+
# Returns the value of attribute path.
|
3569
|
+
def path; end
|
3570
|
+
|
3571
|
+
def preceding_line(token); end
|
3572
|
+
|
3573
|
+
# Returns the value of attribute raw_source.
|
3574
|
+
def raw_source; end
|
3575
|
+
|
3576
|
+
# Returns the value of attribute ruby_version.
|
3577
|
+
def ruby_version; end
|
3578
|
+
|
3579
|
+
# The tokens list is always sorted by token position, except for cases when heredoc
|
3580
|
+
# is passed as a method argument. In this case tokens are interleaved by
|
3581
|
+
# heredoc contents' tokens.
|
3582
|
+
def sorted_tokens; end
|
3583
|
+
|
3584
|
+
# @return [Boolean]
|
3585
|
+
def start_with?(string); end
|
3586
|
+
|
3587
|
+
# Returns the value of attribute tokens.
|
3588
|
+
def tokens; end
|
3589
|
+
|
3590
|
+
def tokens_within(range_or_node); end
|
3591
|
+
|
3592
|
+
# @return [Boolean]
|
3593
|
+
def valid_syntax?; end
|
3594
|
+
|
3595
|
+
private
|
3596
|
+
|
3597
|
+
def comment_index; end
|
3598
|
+
def create_parser(ruby_version); end
|
3599
|
+
def first_token_index(range_or_node); end
|
3600
|
+
def last_token_index(range_or_node); end
|
3601
|
+
def parse(source, ruby_version); end
|
3602
|
+
def parser_class(ruby_version); end
|
3603
|
+
def source_range(range_or_node); end
|
3604
|
+
def tokenize(parser); end
|
3605
|
+
|
3606
|
+
class << self
|
3607
|
+
def from_file(path, ruby_version); end
|
3608
|
+
end
|
3609
|
+
end
|
3610
|
+
|
3611
|
+
RuboCop::AST::ProcessedSource::INVALID_LEVELS = T.let(T.unsafe(nil), Array)
|
3612
|
+
|
3613
|
+
# @api private
|
3614
|
+
RuboCop::AST::ProcessedSource::STRING_SOURCE_NAME = T.let(T.unsafe(nil), String)
|
3615
|
+
|
3616
|
+
# A node extension for `irange` and `erange` nodes. This will be used in
|
3617
|
+
# place of a plain node when the builder constructs the AST, making its
|
3618
|
+
# methods available to all `irange` and `erange` nodes within RuboCop.
|
3619
|
+
class RuboCop::AST::RangeNode < ::RuboCop::AST::Node
|
3620
|
+
def begin; end
|
3621
|
+
def end; end
|
3622
|
+
end
|
3623
|
+
|
3624
|
+
# A node extension for `regexp` nodes. This will be used in place of a plain
|
3625
|
+
# node when the builder constructs the AST, making its methods available
|
3626
|
+
# to all `regexp` nodes within RuboCop.
|
3627
|
+
class RuboCop::AST::RegexpNode < ::RuboCop::AST::Node
|
3628
|
+
include ::RuboCop::Ext::RegexpNode
|
3629
|
+
|
3630
|
+
# @return [String] a string of regexp content
|
3631
|
+
def content; end
|
3632
|
+
|
3633
|
+
# @return [Bool] if char is one of the delimiters
|
3634
|
+
def delimiter?(char); end
|
3635
|
+
|
3636
|
+
# @return [String] the regexp delimiters (without %r)
|
3637
|
+
def delimiters; end
|
3638
|
+
|
3639
|
+
# @return [Bool] if regexp uses the extended regopt
|
3640
|
+
def extended?; end
|
3641
|
+
|
3642
|
+
# @return [Bool] if regexp uses the ignore-case regopt
|
3643
|
+
def ignore_case?; end
|
3644
|
+
|
3645
|
+
# @return [Bool] if regexp contains interpolation
|
3646
|
+
def interpolation?; end
|
3647
|
+
|
3648
|
+
# @return [Bool] if regexp uses the multiline regopt
|
3649
|
+
def multiline_mode?; end
|
3650
|
+
|
3651
|
+
# @return [Bool] if regexp uses the no-encoding regopt
|
3652
|
+
def no_encoding?; end
|
3653
|
+
|
3654
|
+
# NOTE: The 'o' option is ignored.
|
3655
|
+
#
|
3656
|
+
# @return [Integer] the Regexp option bits as returned by Regexp#options
|
3657
|
+
def options; end
|
3658
|
+
|
3659
|
+
# @return [Bool] if the regexp is a %r{...} literal (using any delimiters)
|
3660
|
+
def percent_r_literal?; end
|
3661
|
+
|
3662
|
+
# @return [RuboCop::AST::Node] a regopt node
|
3663
|
+
def regopt; end
|
3664
|
+
|
3665
|
+
# @return [Bool] if regexp uses the single-interpolation regopt
|
3666
|
+
def single_interpolation?; end
|
3667
|
+
|
3668
|
+
# @return [Bool] if the regexp is a /.../ literal
|
3669
|
+
def slash_literal?; end
|
3670
|
+
|
3671
|
+
# @return [Regexp] a regexp of this node
|
3672
|
+
def to_regexp; end
|
3673
|
+
|
3674
|
+
private
|
3675
|
+
|
3676
|
+
# @return [Boolean]
|
3677
|
+
def regopt_include?(option); end
|
3678
|
+
end
|
3679
|
+
|
3680
|
+
RuboCop::AST::RegexpNode::OPTIONS = T.let(T.unsafe(nil), Hash)
|
3681
|
+
|
3682
|
+
# A node extension for `resbody` nodes. This will be used in place of a
|
3683
|
+
# plain node when the builder constructs the AST, making its methods
|
3684
|
+
# available to all `resbody` nodes within RuboCop.
|
3685
|
+
class RuboCop::AST::ResbodyNode < ::RuboCop::AST::Node
|
3686
|
+
# Returns the body of the `rescue` clause.
|
3687
|
+
#
|
3688
|
+
# @return [Node, nil] The body of the `resbody`.
|
3689
|
+
def body; end
|
3690
|
+
|
3691
|
+
# Returns the index of the `resbody` branch within the exception handling statement.
|
3692
|
+
#
|
3693
|
+
# @return [Integer] the index of the `resbody` branch
|
3694
|
+
def branch_index; end
|
3695
|
+
|
3696
|
+
# Returns the exception variable of the `rescue` clause.
|
3697
|
+
#
|
3698
|
+
# @return [Node, nil] The exception variable of the `resbody`.
|
3699
|
+
def exception_variable; end
|
3700
|
+
|
3701
|
+
# Returns an array of all the exceptions in the `rescue` clause.
|
3702
|
+
#
|
3703
|
+
# @return [Array<Node>] an array of exception nodes
|
3704
|
+
def exceptions; end
|
3705
|
+
end
|
3706
|
+
|
3707
|
+
# A node extension for `rescue` nodes. This will be used in place of a
|
3708
|
+
# plain node when the builder constructs the AST, making its methods
|
3709
|
+
# available to all `rescue` nodes within RuboCop.
|
3710
|
+
class RuboCop::AST::RescueNode < ::RuboCop::AST::Node
|
3711
|
+
# Returns the body of the rescue node.
|
3712
|
+
#
|
3713
|
+
# @return [Node, nil] The body of the rescue node.
|
3714
|
+
def body; end
|
3715
|
+
|
3716
|
+
# Returns an array of all the rescue branches in the exception handling statement.
|
3717
|
+
#
|
3718
|
+
# and the else (if any). Note that these bodies could be nil.
|
3719
|
+
#
|
3720
|
+
# @return [Array<Node, nil>] an array of the bodies of the rescue branches
|
3721
|
+
def branches; end
|
3722
|
+
|
3723
|
+
# Checks whether this exception handling statement has an `else` branch.
|
3724
|
+
#
|
3725
|
+
# @return [Boolean] whether the exception handling statement has an `else` branch
|
3726
|
+
def else?; end
|
3727
|
+
|
3728
|
+
# Returns the else branch of the exception handling statement, if any.
|
3729
|
+
#
|
3730
|
+
# @return [Node] the else branch node of the exception handling statement
|
3731
|
+
# @return [nil] if the exception handling statement does not have an else branch.
|
3732
|
+
def else_branch; end
|
3733
|
+
|
3734
|
+
# Returns an array of all the rescue branches in the exception handling statement.
|
3735
|
+
#
|
3736
|
+
# @return [Array<ResbodyNode>] an array of `resbody` nodes
|
3737
|
+
def resbody_branches; end
|
3738
|
+
end
|
3739
|
+
|
3740
|
+
# A node extension for `return` nodes. This will be used in place of a
|
3741
|
+
# plain node when the builder constructs the AST, making its methods
|
3742
|
+
# available to all `return` nodes within RuboCop.
|
3743
|
+
class RuboCop::AST::ReturnNode < ::RuboCop::AST::Node
|
3744
|
+
include ::RuboCop::AST::ParameterizedNode
|
3745
|
+
include ::RuboCop::AST::ParameterizedNode::WrappedArguments
|
3746
|
+
end
|
3747
|
+
|
3748
|
+
# Responsible for compatibility with main gem
|
3749
|
+
#
|
3750
|
+
# @api private
|
3751
|
+
module RuboCop::AST::RuboCopCompatibility
|
3752
|
+
# @api private
|
3753
|
+
def rubocop_loaded; end
|
3754
|
+
end
|
3755
|
+
|
3756
|
+
# @api private
|
3757
|
+
RuboCop::AST::RuboCopCompatibility::INCOMPATIBLE_COPS = T.let(T.unsafe(nil), Hash)
|
3758
|
+
|
3759
|
+
# A node extension for `sclass` nodes. This will be used in place of a
|
3760
|
+
# plain node when the builder constructs the AST, making its methods
|
3761
|
+
# available to all `sclass` nodes within RuboCop.
|
3762
|
+
class RuboCop::AST::SelfClassNode < ::RuboCop::AST::Node
|
3763
|
+
# The body of this `sclass` node.
|
3764
|
+
#
|
3765
|
+
# @return [Node, nil] the body of the class
|
3766
|
+
def body; end
|
3767
|
+
|
3768
|
+
# The identifier for this `sclass` node. (Always `self`.)
|
3769
|
+
#
|
3770
|
+
# @return [Node] the identifier of the class
|
3771
|
+
def identifier; end
|
3772
|
+
end
|
3773
|
+
|
3774
|
+
# A node extension for `send` nodes. This will be used in place of a plain
|
3775
|
+
# node when the builder constructs the AST, making its methods available
|
3776
|
+
# to all `send` nodes within RuboCop.
|
3777
|
+
class RuboCop::AST::SendNode < ::RuboCop::AST::Node
|
3778
|
+
include ::RuboCop::AST::ParameterizedNode
|
3779
|
+
include ::RuboCop::AST::ParameterizedNode::RestArguments
|
3780
|
+
include ::RuboCop::AST::MethodIdentifierPredicates
|
3781
|
+
include ::RuboCop::AST::MethodDispatchNode
|
3782
|
+
|
3783
|
+
def attribute_accessor?(param0 = T.unsafe(nil)); end
|
3784
|
+
|
3785
|
+
private
|
3786
|
+
|
3787
|
+
def first_argument_index; end
|
3788
|
+
end
|
3789
|
+
|
3790
|
+
# This module provides a shorthand method to create a {Node} like
|
3791
|
+
# `Parser::AST::Sexp`.
|
3792
|
+
#
|
3793
|
+
# @see https://www.rubydoc.info/gems/ast/AST/Sexp
|
3794
|
+
module RuboCop::AST::Sexp
|
3795
|
+
# Creates a {Node} with type `type` and children `children`.
|
3796
|
+
def s(type, *children); end
|
3797
|
+
end
|
3798
|
+
|
3799
|
+
# A node extension for `str`, `dstr`, and `xstr` nodes. This will be used
|
3800
|
+
# in place of a plain node when the builder constructs the AST, making
|
3801
|
+
# its methods available to all `str` nodes within RuboCop.
|
3802
|
+
class RuboCop::AST::StrNode < ::RuboCop::AST::Node
|
3803
|
+
include ::RuboCop::AST::BasicLiteralNode
|
3804
|
+
|
3805
|
+
# @return [Boolean]
|
3806
|
+
def heredoc?; end
|
3807
|
+
end
|
3808
|
+
|
3809
|
+
# A node extension for `super`- and `zsuper` nodes. This will be used in
|
3810
|
+
# place of a plain node when the builder constructs the AST, making its
|
3811
|
+
# methods available to all `super`- and `zsuper` nodes within RuboCop.
|
3812
|
+
class RuboCop::AST::SuperNode < ::RuboCop::AST::Node
|
3813
|
+
include ::RuboCop::AST::ParameterizedNode
|
3814
|
+
include ::RuboCop::AST::MethodIdentifierPredicates
|
3815
|
+
include ::RuboCop::AST::MethodDispatchNode
|
3816
|
+
|
3817
|
+
def arguments; end
|
3818
|
+
|
3819
|
+
# Custom destructuring method. This can be used to normalize
|
3820
|
+
# destructuring for different variations of the node.
|
3821
|
+
#
|
3822
|
+
# @return [Array] the different parts of the `super` node
|
3823
|
+
def node_parts; end
|
3824
|
+
end
|
3825
|
+
|
3826
|
+
# A node extension for `sym` nodes. This will be used in place of a
|
3827
|
+
# plain node when the builder constructs the AST, making its methods
|
3828
|
+
# available to all `sym` nodes within RuboCop.
|
3829
|
+
class RuboCop::AST::SymbolNode < ::RuboCop::AST::Node
|
3830
|
+
include ::RuboCop::AST::BasicLiteralNode
|
3831
|
+
end
|
3832
|
+
|
3833
|
+
# A basic wrapper around Parser's tokens.
|
3834
|
+
class RuboCop::AST::Token
|
3835
|
+
# @return [Token] a new instance of Token
|
3836
|
+
def initialize(pos, type, text); end
|
3837
|
+
|
3838
|
+
def begin_pos; end
|
3839
|
+
def column; end
|
3840
|
+
|
3841
|
+
# @return [Boolean]
|
3842
|
+
def comma?; end
|
3843
|
+
|
3844
|
+
# Type Predicates
|
3845
|
+
#
|
3846
|
+
# @return [Boolean]
|
3847
|
+
def comment?; end
|
3848
|
+
|
3849
|
+
# @return [Boolean]
|
3850
|
+
def end?; end
|
3851
|
+
|
3852
|
+
def end_pos; end
|
3853
|
+
|
3854
|
+
# @return [Boolean]
|
3855
|
+
def equal_sign?; end
|
3856
|
+
|
3857
|
+
# @return [Boolean]
|
3858
|
+
def left_array_bracket?; end
|
3859
|
+
|
3860
|
+
# @return [Boolean]
|
3861
|
+
def left_brace?; end
|
3862
|
+
|
3863
|
+
# @return [Boolean]
|
3864
|
+
def left_bracket?; end
|
3865
|
+
|
3866
|
+
# @return [Boolean]
|
3867
|
+
def left_curly_brace?; end
|
3868
|
+
|
3869
|
+
# @return [Boolean]
|
3870
|
+
def left_parens?; end
|
3871
|
+
|
3872
|
+
# @return [Boolean]
|
3873
|
+
def left_ref_bracket?; end
|
3874
|
+
|
3875
|
+
def line; end
|
3876
|
+
|
3877
|
+
# Returns the value of attribute pos.
|
3878
|
+
def pos; end
|
3879
|
+
|
3880
|
+
# @return [Boolean]
|
3881
|
+
def rescue_modifier?; end
|
3882
|
+
|
3883
|
+
# @return [Boolean]
|
3884
|
+
def right_bracket?; end
|
3885
|
+
|
3886
|
+
# @return [Boolean]
|
3887
|
+
def right_curly_brace?; end
|
3888
|
+
|
3889
|
+
# @return [Boolean]
|
3890
|
+
def right_parens?; end
|
3891
|
+
|
3892
|
+
# @return [Boolean]
|
3893
|
+
def semicolon?; end
|
3894
|
+
|
3895
|
+
# Checks if there is whitespace after token
|
3896
|
+
#
|
3897
|
+
# @return [Boolean]
|
3898
|
+
def space_after?; end
|
3899
|
+
|
3900
|
+
# Checks if there is whitespace before token
|
3901
|
+
#
|
3902
|
+
# @return [Boolean]
|
3903
|
+
def space_before?; end
|
3904
|
+
|
3905
|
+
# Returns the value of attribute text.
|
3906
|
+
def text; end
|
3907
|
+
|
3908
|
+
def to_s; end
|
3909
|
+
|
3910
|
+
# Returns the value of attribute type.
|
3911
|
+
def type; end
|
3912
|
+
|
3913
|
+
class << self
|
3914
|
+
def from_parser_token(parser_token); end
|
3915
|
+
end
|
3916
|
+
end
|
3917
|
+
|
3918
|
+
# Provides methods for traversing an AST.
|
3919
|
+
# Does not transform an AST; for that, use Parser::AST::Processor.
|
3920
|
+
# Override methods to perform custom processing. Remember to call `super`
|
3921
|
+
# if you want to recursively process descendant nodes.
|
3922
|
+
module RuboCop::AST::Traversal
|
3923
|
+
extend ::RuboCop::AST::Traversal::CallbackCompiler
|
3924
|
+
|
3925
|
+
def on_(node); end
|
3926
|
+
def on___ENCODING__(node); end
|
3927
|
+
def on___FILE__(node); end
|
3928
|
+
def on___LINE__(node); end
|
3929
|
+
def on_alias(node); end
|
3930
|
+
def on_and(node); end
|
3931
|
+
def on_and_asgn(node); end
|
3932
|
+
def on_arg(node); end
|
3933
|
+
def on_arg_expr(node); end
|
3934
|
+
def on_args(node); end
|
3935
|
+
def on_array(node); end
|
3936
|
+
def on_array_pattern(node); end
|
3937
|
+
def on_array_pattern_with_tail(node); end
|
3938
|
+
def on_back_ref(node); end
|
3939
|
+
def on_begin(node); end
|
3940
|
+
def on_block(node); end
|
3941
|
+
def on_block_pass(node); end
|
3942
|
+
def on_blockarg(node); end
|
3943
|
+
def on_break(node); end
|
3944
|
+
def on_case(node); end
|
3945
|
+
def on_case_match(node); end
|
3946
|
+
def on_casgn(node); end
|
3947
|
+
def on_cbase(node); end
|
3948
|
+
def on_class(node); end
|
3949
|
+
def on_complex(node); end
|
3950
|
+
def on_const(node); end
|
3951
|
+
def on_const_pattern(node); end
|
3952
|
+
def on_csend(node); end
|
3953
|
+
def on_cvar(node); end
|
3954
|
+
def on_cvasgn(node); end
|
3955
|
+
def on_def(node); end
|
3956
|
+
def on_defined?(node); end
|
3957
|
+
def on_defs(node); end
|
3958
|
+
def on_dstr(node); end
|
3959
|
+
def on_dsym(node); end
|
3960
|
+
def on_eflipflop(node); end
|
3961
|
+
def on_empty_else(node); end
|
3962
|
+
def on_ensure(node); end
|
3963
|
+
def on_erange(node); end
|
3964
|
+
def on_false(node); end
|
3965
|
+
def on_find_pattern(node); end
|
3966
|
+
def on_float(node); end
|
3967
|
+
def on_for(node); end
|
3968
|
+
def on_forward_arg(node); end
|
3969
|
+
def on_forward_args(node); end
|
3970
|
+
def on_forwarded_args(node); end
|
3971
|
+
def on_gvar(node); end
|
3972
|
+
def on_gvasgn(node); end
|
3973
|
+
def on_hash(node); end
|
3974
|
+
def on_hash_pattern(node); end
|
3975
|
+
def on_if(node); end
|
3976
|
+
def on_if_guard(node); end
|
3977
|
+
def on_iflipflop(node); end
|
3978
|
+
def on_in_match(node); end
|
3979
|
+
def on_in_pattern(node); end
|
3980
|
+
def on_index(node); end
|
3981
|
+
def on_indexasgn(node); end
|
3982
|
+
def on_int(node); end
|
3983
|
+
def on_irange(node); end
|
3984
|
+
def on_ivar(node); end
|
3985
|
+
def on_ivasgn(node); end
|
3986
|
+
def on_kwarg(node); end
|
3987
|
+
def on_kwargs(node); end
|
3988
|
+
def on_kwbegin(node); end
|
3989
|
+
def on_kwnilarg(node); end
|
3990
|
+
def on_kwoptarg(node); end
|
3991
|
+
def on_kwrestarg(node); end
|
3992
|
+
def on_kwsplat(node); end
|
3993
|
+
def on_lambda(node); end
|
3994
|
+
def on_lvar(node); end
|
3995
|
+
def on_lvasgn(node); end
|
3996
|
+
def on_masgn(node); end
|
3997
|
+
def on_match_alt(node); end
|
3998
|
+
def on_match_as(node); end
|
3999
|
+
def on_match_current_line(node); end
|
4000
|
+
def on_match_nil_pattern(node); end
|
4001
|
+
def on_match_pattern(node); end
|
4002
|
+
def on_match_pattern_p(node); end
|
4003
|
+
def on_match_rest(node); end
|
4004
|
+
def on_match_var(node); end
|
4005
|
+
def on_match_with_lvasgn(node); end
|
4006
|
+
def on_match_with_trailing_comma(node); end
|
4007
|
+
def on_mlhs(node); end
|
4008
|
+
def on_module(node); end
|
4009
|
+
def on_mrasgn(node); end
|
4010
|
+
def on_next(node); end
|
4011
|
+
def on_nil(node); end
|
4012
|
+
def on_not(node); end
|
4013
|
+
def on_nth_ref(node); end
|
4014
|
+
def on_numblock(node); end
|
4015
|
+
def on_op_asgn(node); end
|
4016
|
+
def on_optarg(node); end
|
4017
|
+
def on_or(node); end
|
4018
|
+
def on_or_asgn(node); end
|
4019
|
+
def on_pair(node); end
|
4020
|
+
def on_pin(node); end
|
4021
|
+
def on_postexe(node); end
|
4022
|
+
def on_preexe(node); end
|
4023
|
+
def on_procarg0(node); end
|
4024
|
+
def on_rasgn(node); end
|
4025
|
+
def on_rational(node); end
|
4026
|
+
def on_redo(node); end
|
4027
|
+
def on_regexp(node); end
|
4028
|
+
def on_regopt(node); end
|
4029
|
+
def on_resbody(node); end
|
4030
|
+
def on_rescue(node); end
|
4031
|
+
def on_restarg(node); end
|
4032
|
+
def on_retry(node); end
|
4033
|
+
def on_return(node); end
|
4034
|
+
def on_sclass(node); end
|
4035
|
+
def on_self(node); end
|
4036
|
+
def on_send(node); end
|
4037
|
+
def on_shadowarg(node); end
|
4038
|
+
def on_splat(node); end
|
4039
|
+
def on_str(node); end
|
4040
|
+
def on_super(node); end
|
4041
|
+
def on_sym(node); end
|
4042
|
+
def on_true(node); end
|
4043
|
+
def on_undef(node); end
|
4044
|
+
def on_unless_guard(node); end
|
4045
|
+
def on_until(node); end
|
4046
|
+
def on_until_post(node); end
|
4047
|
+
def on_when(node); end
|
4048
|
+
def on_while(node); end
|
4049
|
+
def on_while_post(node); end
|
4050
|
+
def on_xstr(node); end
|
4051
|
+
def on_yield(node); end
|
4052
|
+
def on_zsuper(node); end
|
4053
|
+
def walk(node); end
|
4054
|
+
end
|
4055
|
+
|
4056
|
+
# @api private
|
4057
|
+
module RuboCop::AST::Traversal::CallbackCompiler
|
4058
|
+
# @api private
|
4059
|
+
def arity_check(range); end
|
4060
|
+
|
4061
|
+
# @api private
|
4062
|
+
def body(signature, prelude); end
|
4063
|
+
|
4064
|
+
# @api private
|
4065
|
+
def def_callback(type, *signature, arity: T.unsafe(nil), arity_check: T.unsafe(nil), body: T.unsafe(nil)); end
|
4066
|
+
end
|
4067
|
+
|
4068
|
+
# @api private
|
4069
|
+
RuboCop::AST::Traversal::CallbackCompiler::SEND = T.let(T.unsafe(nil), String)
|
4070
|
+
|
4071
|
+
# @api private
|
4072
|
+
RuboCop::AST::Traversal::CallbackCompiler::TEMPLATE = T.let(T.unsafe(nil), Hash)
|
4073
|
+
|
4074
|
+
# Only for debugging.
|
4075
|
+
#
|
4076
|
+
# @api private
|
4077
|
+
class RuboCop::AST::Traversal::DebugError < ::RuntimeError; end
|
4078
|
+
|
4079
|
+
RuboCop::AST::Traversal::NO_CHILD_NODES = T.let(T.unsafe(nil), Set)
|
4080
|
+
RuboCop::AST::Traversal::TYPE_TO_METHOD = T.let(T.unsafe(nil), Hash)
|
4081
|
+
|
4082
|
+
# A node extension for `until` nodes. This will be used in place of a plain
|
4083
|
+
# node when the builder constructs the AST, making its methods available
|
4084
|
+
# to all `until` nodes within RuboCop.
|
4085
|
+
class RuboCop::AST::UntilNode < ::RuboCop::AST::Node
|
4086
|
+
include ::RuboCop::AST::ConditionalNode
|
4087
|
+
include ::RuboCop::AST::ModifierNode
|
4088
|
+
|
4089
|
+
# Checks whether the `until` node has a `do` keyword.
|
4090
|
+
#
|
4091
|
+
# @return [Boolean] whether the `until` node has a `do` keyword
|
4092
|
+
def do?; end
|
4093
|
+
|
4094
|
+
# Returns the inverse keyword of the `until` node as a string.
|
4095
|
+
# Returns `while` for `until` nodes and vice versa.
|
4096
|
+
#
|
4097
|
+
# @return [String] the inverse keyword of the `until` statement
|
4098
|
+
def inverse_keyword; end
|
4099
|
+
|
4100
|
+
# Returns the keyword of the `until` statement as a string.
|
4101
|
+
#
|
4102
|
+
# @return [String] the keyword of the `until` statement
|
4103
|
+
def keyword; end
|
4104
|
+
end
|
4105
|
+
|
4106
|
+
module RuboCop::AST::Version; end
|
4107
|
+
RuboCop::AST::Version::STRING = T.let(T.unsafe(nil), String)
|
4108
|
+
|
4109
|
+
# A node extension for `when` nodes. This will be used in place of a plain
|
4110
|
+
# node when the builder constructs the AST, making its methods available
|
4111
|
+
# to all `when` nodes within RuboCop.
|
4112
|
+
class RuboCop::AST::WhenNode < ::RuboCop::AST::Node
|
4113
|
+
# Returns the body of the `when` node.
|
4114
|
+
#
|
4115
|
+
# @return [Node, nil] the body of the `when` node
|
4116
|
+
def body; end
|
4117
|
+
|
4118
|
+
# Returns the index of the `when` branch within the `case` statement.
|
4119
|
+
#
|
4120
|
+
# @return [Integer] the index of the `when` branch
|
4121
|
+
def branch_index; end
|
4122
|
+
|
4123
|
+
# Returns an array of all the conditions in the `when` branch.
|
4124
|
+
#
|
4125
|
+
# @return [Array<Node>] an array of condition nodes
|
4126
|
+
def conditions; end
|
4127
|
+
|
4128
|
+
# @deprecated Use `conditions.each`
|
4129
|
+
def each_condition(&block); end
|
4130
|
+
|
4131
|
+
# Checks whether the `when` node has a `then` keyword.
|
4132
|
+
#
|
4133
|
+
# @return [Boolean] whether the `when` node has a `then` keyword
|
4134
|
+
def then?; end
|
4135
|
+
end
|
4136
|
+
|
4137
|
+
# A node extension for `while` nodes. This will be used in place of a plain
|
4138
|
+
# node when the builder constructs the AST, making its methods available
|
4139
|
+
# to all `while` nodes within RuboCop.
|
4140
|
+
class RuboCop::AST::WhileNode < ::RuboCop::AST::Node
|
4141
|
+
include ::RuboCop::AST::ConditionalNode
|
4142
|
+
include ::RuboCop::AST::ModifierNode
|
4143
|
+
|
4144
|
+
# Checks whether the `until` node has a `do` keyword.
|
4145
|
+
#
|
4146
|
+
# @return [Boolean] whether the `until` node has a `do` keyword
|
4147
|
+
def do?; end
|
4148
|
+
|
4149
|
+
# Returns the inverse keyword of the `while` node as a string.
|
4150
|
+
# Returns `until` for `while` nodes and vice versa.
|
4151
|
+
#
|
4152
|
+
# @return [String] the inverse keyword of the `while` statement
|
4153
|
+
def inverse_keyword; end
|
4154
|
+
|
4155
|
+
# Returns the keyword of the `while` statement as a string.
|
4156
|
+
#
|
4157
|
+
# @return [String] the keyword of the `while` statement
|
4158
|
+
def keyword; end
|
4159
|
+
end
|
4160
|
+
|
4161
|
+
# A node extension for `yield` nodes. This will be used in place of a plain
|
4162
|
+
# node when the builder constructs the AST, making its methods available
|
4163
|
+
# to all `yield` nodes within RuboCop.
|
4164
|
+
class RuboCop::AST::YieldNode < ::RuboCop::AST::Node
|
4165
|
+
include ::RuboCop::AST::ParameterizedNode
|
4166
|
+
include ::RuboCop::AST::MethodIdentifierPredicates
|
4167
|
+
include ::RuboCop::AST::MethodDispatchNode
|
4168
|
+
|
4169
|
+
def arguments; end
|
4170
|
+
|
4171
|
+
# Custom destructuring method. This can be used to normalize
|
4172
|
+
# destructuring for different variations of the node.
|
4173
|
+
#
|
4174
|
+
# @return [Array] the different parts of the `send` node
|
4175
|
+
def node_parts; end
|
4176
|
+
end
|
4177
|
+
|
4178
|
+
RuboCop::NodePattern = RuboCop::AST::NodePattern
|
4179
|
+
RuboCop::ProcessedSource = RuboCop::AST::ProcessedSource
|
4180
|
+
RuboCop::Token = RuboCop::AST::Token
|