rubocop-ast 1.32.3 → 1.36.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 289c6acb690241440018fb6d23e23759c6cf52100b2bf373b47226ee71cad215
4
- data.tar.gz: 45cd10ff396ddf599ac11277b5d14a2e7cede79b267a40b2e53a83ccd2580479
3
+ metadata.gz: 07c76274a87f19afed0f78fd17a51276f0018b7d1771e762135102b4d52b5a5e
4
+ data.tar.gz: b1e0a8669b789f063b3a73cdddc6187ef65fa80e8af376a898d90003af988370
5
5
  SHA512:
6
- metadata.gz: 137d5b737b87e1a136b23c6ae6b591334e5971e923c01727c37280b42e96a0a41fc534b54e8ea1b83074256b5d6645f86c079977fd72ffd6404d9f4eb61d92c6
7
- data.tar.gz: d7c4e19d909f3591b4f7460a54e50f77555d37b517baa86359c635a2b32eeb119804464fb17c95adc69f23147f3023322142d44117f0e9ea0262e8c1fdd3aec2
6
+ metadata.gz: 53acbd7b42693e94af37b5ec5e894c77416edabb7a5ad7cb9a4bc82f605dad8b6f324a41a68fe83cfe8227d4421fff4bba77c1b6c33d1234af7972b74a3e6f2f
7
+ data.tar.gz: d5723bec108faa1d19eff03b0fefb2f8eeefe885253f16180bedbde4589cba16db6dfd45d27bb82a0f14538e9c93416dd23756f0f79fa3d68ae67a7b3ff30c64
@@ -63,8 +63,11 @@ module RuboCop
63
63
  irange: RangeNode,
64
64
  erange: RangeNode,
65
65
  kwargs: HashNode,
66
+ kwbegin: KeywordBeginNode,
66
67
  kwsplat: KeywordSplatNode,
67
68
  lambda: LambdaNode,
69
+ masgn: MasgnNode,
70
+ mlhs: MlhsNode,
68
71
  module: ModuleNode,
69
72
  next: NextNode,
70
73
  op_asgn: OpAsgnNode,
@@ -87,6 +90,10 @@ module RuboCop
87
90
  sym: SymbolNode,
88
91
  until: UntilNode,
89
92
  until_post: UntilNode,
93
+ lvar: VarNode,
94
+ ivar: VarNode,
95
+ cvar: VarNode,
96
+ gvar: VarNode,
90
97
  when: WhenNode,
91
98
  while: WhileNode,
92
99
  while_post: WhileNode,
@@ -12,6 +12,7 @@ module RuboCop
12
12
  def name
13
13
  node_parts[0]
14
14
  end
15
+ alias lhs name
15
16
 
16
17
  # The expression being assigned to the variable.
17
18
  #
@@ -19,6 +20,7 @@ module RuboCop
19
20
  def expression
20
21
  node_parts[1]
21
22
  end
23
+ alias rhs expression
22
24
  end
23
25
  end
24
26
  end
@@ -90,14 +90,14 @@ module RuboCop
90
90
  #
91
91
  # @return [Boolean] whether the `block` literal is enclosed in braces
92
92
  def braces?
93
- loc.end&.is?('}')
93
+ loc.end.is?('}')
94
94
  end
95
95
 
96
96
  # Checks whether the `block` literal is delimited by `do`-`end` keywords.
97
97
  #
98
98
  # @return [Boolean] whether the `block` literal is enclosed in `do`-`end`
99
99
  def keywords?
100
- loc.end&.is?('end')
100
+ loc.end.is?('end')
101
101
  end
102
102
 
103
103
  # The delimiters for this `block` literal.
@@ -6,19 +6,10 @@ module RuboCop
6
6
  # This will be used in place of a plain node when the builder constructs
7
7
  # the AST, making its methods available to all assignment nodes within RuboCop.
8
8
  class CasgnNode < Node
9
- # The namespace of the constant being assigned.
10
- #
11
- # @return [Node, nil] the node associated with the scope (e.g. cbase, const, ...)
12
- def namespace
13
- node_parts[0]
14
- end
9
+ include ConstantNode
15
10
 
16
- # The name of the variable being assigned as a symbol.
17
- #
18
- # @return [Symbol] the name of the variable being assigned
19
- def name
20
- node_parts[1]
21
- end
11
+ alias name short_name
12
+ alias lhs short_name
22
13
 
23
14
  # The expression being assigned to the variable.
24
15
  #
@@ -26,6 +17,7 @@ module RuboCop
26
17
  def expression
27
18
  node_parts[2]
28
19
  end
20
+ alias rhs expression
29
21
  end
30
22
  end
31
23
  end
@@ -4,58 +4,7 @@ module RuboCop
4
4
  module AST
5
5
  # A node extension for `const` nodes.
6
6
  class ConstNode < Node
7
- # @return [Node, nil] the node associated with the scope (e.g. cbase, const, ...)
8
- def namespace
9
- children[0]
10
- end
11
-
12
- # @return [Symbol] the demodulized name of the constant: "::Foo::Bar" => :Bar
13
- def short_name
14
- children[1]
15
- end
16
-
17
- # @return [Boolean] if the constant is a Module / Class, according to the standard convention.
18
- # Note: some classes might have uppercase in which case this method
19
- # returns false
20
- def module_name?
21
- short_name.match?(/[[:lower:]]/)
22
- end
23
- alias class_name? module_name?
24
-
25
- # @return [Boolean] if the constant starts with `::` (aka s(:cbase))
26
- def absolute?
27
- return false unless namespace
28
-
29
- each_path.first.cbase_type?
30
- end
31
-
32
- # @return [Boolean] if the constant does not start with `::` (aka s(:cbase))
33
- def relative?
34
- !absolute?
35
- end
36
-
37
- # Yield nodes for the namespace
38
- #
39
- # For `::Foo::Bar::BAZ` => yields:
40
- # s(:cbase), then
41
- # s(:const, :Foo), then
42
- # s(:const, s(:const, :Foo), :Bar)
43
- def each_path(&block)
44
- return to_enum(__method__) unless block
45
-
46
- descendants = []
47
- last = self
48
- loop do
49
- last = last.children.first
50
- break if last.nil?
51
-
52
- descendants << last
53
- break unless last.const_type?
54
- end
55
- descendants.reverse_each(&block)
56
-
57
- self
58
- end
7
+ include ConstantNode
59
8
  end
60
9
  end
61
10
  end
@@ -9,10 +9,25 @@ module RuboCop
9
9
  # Returns the body of the `ensure` clause.
10
10
  #
11
11
  # @return [Node, nil] The body of the `ensure`.
12
+ # @deprecated Use `EnsureNode#branch`
12
13
  def body
14
+ branch
15
+ end
16
+
17
+ # Returns an the ensure branch in the exception handling statement.
18
+ #
19
+ # @return [Node, nil] the body of the ensure branch.
20
+ def branch
13
21
  node_parts[1]
14
22
  end
15
23
 
24
+ # Returns the `rescue` node of the `ensure`, if present.
25
+ #
26
+ # @return [Node, nil] The `rescue` node.
27
+ def rescue_node
28
+ node_parts[0] if node_parts[0].rescue_type?
29
+ end
30
+
16
31
  # Checks whether this node body is a void context.
17
32
  # Always `true` for `ensure`.
18
33
  #
@@ -102,7 +102,7 @@ module RuboCop
102
102
  #
103
103
  # @return [Boolean] whether the `if` node has at least one `elsif` branch
104
104
  def elsif_conditional?
105
- else_branch&.if_type? && else_branch&.elsif?
105
+ else_branch&.if_type? && else_branch.elsif?
106
106
  end
107
107
 
108
108
  # Returns the branch of the `if` node that gets evaluated when its
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module AST
5
+ # A node extension for `kwbegin` nodes. This will be used in place of a plain
6
+ # node when the builder constructs the AST, making its methods available
7
+ # to all `kwbegin` nodes within RuboCop.
8
+ class KeywordBeginNode < Node
9
+ # Returns the body of the `kwbegin` block. Returns `self` if the `kwbegin` contains
10
+ # multiple nodes.
11
+ #
12
+ # @return [Node, nil] The body of the `kwbegin`.
13
+ def body
14
+ return unless node_parts.any?
15
+
16
+ if rescue_node
17
+ rescue_node.body
18
+ elsif ensure_node
19
+ ensure_node.node_parts[0]
20
+ elsif node_parts.one?
21
+ node_parts[0]
22
+ else
23
+ self
24
+ end
25
+ end
26
+
27
+ # Returns the `rescue` node of the `kwbegin` block, if one is present.
28
+ #
29
+ # @return [Node, nil] The `rescue` node within `kwbegin`.
30
+ def ensure_node
31
+ node_parts[0] if node_parts[0]&.ensure_type?
32
+ end
33
+
34
+ # Returns the `rescue` node of the `kwbegin` block, if one is present.
35
+ #
36
+ # @return [Node, nil] The `rescue` node within `kwbegin`.
37
+ def rescue_node
38
+ return ensure_node&.rescue_node if ensure_node&.rescue_node
39
+
40
+ node_parts[0] if node_parts[0]&.rescue_type?
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module AST
5
+ # A node extension for `masgn` nodes.
6
+ # This will be used in place of a plain node when the builder constructs
7
+ # the AST, making its methods available to all assignment nodes within RuboCop.
8
+ class MasgnNode < Node
9
+ # @return [MlhsNode] the `mlhs` node
10
+ def lhs
11
+ # The first child is a `mlhs` node
12
+ node_parts[0]
13
+ end
14
+
15
+ # @return [Array<Node>] the assignment nodes of the multiple assignment
16
+ def assignments
17
+ lhs.assignments
18
+ end
19
+
20
+ # @return [Array<Symbol>] names of all the variables being assigned
21
+ def names
22
+ assignments.map do |assignment|
23
+ if assignment.send_type? || assignment.indexasgn_type?
24
+ assignment.method_name
25
+ else
26
+ assignment.name
27
+ end
28
+ end
29
+ end
30
+
31
+ # The RHS (right hand side) of the multiple assignment. This returns
32
+ # the nodes as parsed: either a single node if the RHS has a single value,
33
+ # or an `array` node containing multiple nodes.
34
+ #
35
+ # NOTE: Due to how parsing works, `expression` will return the same for
36
+ # `a, b = x, y` and `a, b = [x, y]`.
37
+ #
38
+ # @return [Node] the right hand side of a multiple assignment.
39
+ def expression
40
+ node_parts[1]
41
+ end
42
+ alias rhs expression
43
+
44
+ # In contrast to `expression`, `values` always returns a Ruby array
45
+ # containing all the nodes being assigned on the RHS.
46
+ #
47
+ # Literal arrays are considered a singular value; but unlike `expression`,
48
+ # implied `array` nodes from assigning multiple values on the RHS are treated
49
+ # as separate.
50
+ #
51
+ # @return [Array<Node>] individual values being assigned on the RHS of the multiple assignment
52
+ def values
53
+ multiple_rhs? ? expression.children : [expression]
54
+ end
55
+
56
+ private
57
+
58
+ def multiple_rhs?
59
+ expression.array_type? && !expression.bracketed?
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module AST
5
+ # Common functionality for nodes that deal with constants:
6
+ # `const`, `casgn`.
7
+ module ConstantNode
8
+ # @return [Node, nil] the node associated with the scope (e.g. cbase, const, ...)
9
+ def namespace
10
+ children[0]
11
+ end
12
+
13
+ # @return [Symbol] the demodulized name of the constant: "::Foo::Bar" => :Bar
14
+ def short_name
15
+ children[1]
16
+ end
17
+
18
+ # @return [Boolean] if the constant is a Module / Class, according to the standard convention.
19
+ # Note: some classes might have uppercase in which case this method
20
+ # returns false
21
+ def module_name?
22
+ short_name.match?(/[[:lower:]]/)
23
+ end
24
+ alias class_name? module_name?
25
+
26
+ # @return [Boolean] if the constant starts with `::` (aka s(:cbase))
27
+ def absolute?
28
+ return false unless namespace
29
+
30
+ each_path.first.cbase_type?
31
+ end
32
+
33
+ # @return [Boolean] if the constant does not start with `::` (aka s(:cbase))
34
+ def relative?
35
+ !absolute?
36
+ end
37
+
38
+ # Yield nodes for the namespace
39
+ #
40
+ # For `::Foo::Bar::BAZ` => yields:
41
+ # s(:cbase), then
42
+ # s(:const, :Foo), then
43
+ # s(:const, s(:const, :Foo), :Bar)
44
+ def each_path(&block)
45
+ return to_enum(__method__) unless block
46
+
47
+ descendants = []
48
+ last = self
49
+ loop do
50
+ last = last.children.first
51
+ break if last.nil?
52
+
53
+ descendants << last
54
+ break unless last.const_type?
55
+ end
56
+ descendants.reverse_each(&block)
57
+
58
+ self
59
+ end
60
+ end
61
+ end
62
+ end
@@ -117,7 +117,7 @@ module RuboCop
117
117
  #
118
118
  # @return [Boolean] whether the method was called with a connecting dot
119
119
  def dot?
120
- loc.respond_to?(:dot) && loc.dot && loc.dot.is?('.')
120
+ loc.respond_to?(:dot) && loc.dot&.is?('.')
121
121
  end
122
122
 
123
123
  # Checks whether the dispatched method uses a double colon to connect the
@@ -125,7 +125,7 @@ module RuboCop
125
125
  #
126
126
  # @return [Boolean] whether the method was called with a connecting dot
127
127
  def double_colon?
128
- loc.respond_to?(:dot) && loc.dot && loc.dot.is?('::')
128
+ loc.respond_to?(:dot) && loc.dot&.is?('::')
129
129
  end
130
130
 
131
131
  # Checks whether the dispatched method uses a safe navigation operator to
@@ -133,7 +133,7 @@ module RuboCop
133
133
  #
134
134
  # @return [Boolean] whether the method was called with a connecting dot
135
135
  def safe_navigation?
136
- loc.respond_to?(:dot) && loc.dot && loc.dot.is?('&.')
136
+ loc.respond_to?(:dot) && loc.dot&.is?('&.')
137
137
  end
138
138
 
139
139
  # Checks whether the *explicit* receiver of this method dispatch is
@@ -281,7 +281,7 @@ module RuboCop
281
281
 
282
282
  # @!method non_bare_access_modifier_declaration?(node = self)
283
283
  def_node_matcher :non_bare_access_modifier_declaration?, <<~PATTERN
284
- (send nil? {:public :protected :private :module_function} _)
284
+ (send nil? {:public :protected :private :module_function} _+)
285
285
  PATTERN
286
286
  end
287
287
  end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module AST
5
+ # A node extension for `mlhs` nodes.
6
+ # This will be used in place of a plain node when the builder constructs
7
+ # the AST, making its methods available to all assignment nodes within RuboCop.
8
+ class MlhsNode < Node
9
+ # Returns all the assignment nodes on the left hand side (LHS) of a multiple assignment.
10
+ # These are generally assignment nodes (`lvasgn`, `ivasgn`, `cvasgn`, `gvasgn`, `casgn`)
11
+ # but can also be `send` nodes in case of `foo.bar, ... =` or `foo[:bar], ... =`,
12
+ # or a `splat` node for `*, ... =`.
13
+ #
14
+ # @return [Array<Node>] the assignment nodes of the multiple assignment LHS
15
+ def assignments
16
+ child_nodes.flat_map do |node|
17
+ if node.splat_type?
18
+ # Anonymous splats have no children
19
+ node.child_nodes.first || node
20
+ elsif node.mlhs_type?
21
+ node.assignments
22
+ else
23
+ node
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -10,12 +10,13 @@ module RuboCop
10
10
  def assignment_node
11
11
  node_parts[0]
12
12
  end
13
+ alias lhs assignment_node
13
14
 
14
15
  # The name of the variable being assigned as a symbol.
15
16
  #
16
17
  # @return [Symbol] the name of the variable being assigned
17
18
  def name
18
- assignment_node.name
19
+ assignment_node.call_type? ? assignment_node.method_name : assignment_node.name
19
20
  end
20
21
 
21
22
  # The operator being used for assignment as a symbol.
@@ -31,6 +32,7 @@ module RuboCop
31
32
  def expression
32
33
  node_parts.last
33
34
  end
35
+ alias rhs expression
34
36
  end
35
37
  end
36
38
  end
@@ -9,7 +9,7 @@ module RuboCop
9
9
  include BasicLiteralNode
10
10
 
11
11
  def character_literal?
12
- loc.respond_to?(:begin) && loc.begin && loc.begin.is?('?')
12
+ loc.respond_to?(:begin) && loc.begin&.is?('?')
13
13
  end
14
14
 
15
15
  def heredoc?
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module AST
5
+ # A node extension for `lvar`, `ivar`, `cvar` and `gvar` nodes.
6
+ # This will be used in place of a plain node when the builder constructs
7
+ # the AST, making its methods available to all assignment nodes within RuboCop.
8
+ class VarNode < Node
9
+ # @return [Symbol] The name of the variable.
10
+ def name
11
+ node_parts[0]
12
+ end
13
+ end
14
+ end
15
+ end
@@ -88,6 +88,34 @@ module RuboCop
88
88
  EMPTY_PROPERTIES = {}.freeze
89
89
  private_constant :EMPTY_CHILDREN, :EMPTY_PROPERTIES
90
90
 
91
+ # @api private
92
+ GROUP_FOR_TYPE = {
93
+ arg: :argument,
94
+ optarg: :argument,
95
+ restarg: :argument,
96
+ kwarg: :argument,
97
+ kwoptarg: :argument,
98
+ kwrestarg: :argument,
99
+ blockarg: :argument,
100
+ forward_arg: :argument,
101
+ shardowarg: :argument,
102
+
103
+ true: :boolean,
104
+ false: :boolean,
105
+
106
+ int: :numeric,
107
+ float: :numeric,
108
+ rational: :numeric,
109
+ complex: :numeric,
110
+
111
+ irange: :range,
112
+ erange: :range,
113
+
114
+ send: :call,
115
+ csend: :call
116
+ }.freeze
117
+ private_constant :GROUP_FOR_TYPE
118
+
91
119
  # Define a +recursive_?+ predicate method for the given node kind.
92
120
  private_class_method def self.def_recursive_literal_predicate(kind) # rubocop:disable Metrics/MethodLength
93
121
  recursive_kind = "recursive_#{kind}?"
@@ -126,6 +154,16 @@ module RuboCop
126
154
  end
127
155
  end
128
156
 
157
+ # Determine if the node is one of several node types in a single query
158
+ # Allows specific single node types, as well as "grouped" types
159
+ # (e.g. `:boolean` for `:true` or `:false`)
160
+ def type?(*types)
161
+ return true if types.include?(type)
162
+
163
+ group_type = GROUP_FOR_TYPE[type]
164
+ !group_type.nil? && types.include?(group_type)
165
+ end
166
+
129
167
  (Parser::Meta::NODE_TYPES - [:send]).each do |node_type|
130
168
  method_name = "#{node_type.to_s.gsub(/\W/, '')}_type?"
131
169
  class_eval <<~RUBY, __FILE__, __LINE__ + 1
@@ -312,13 +350,12 @@ module RuboCop
312
350
  def_node_matcher :str_content, '(str $_)'
313
351
 
314
352
  def const_name
315
- return unless const_type?
353
+ return unless const_type? || casgn_type?
316
354
 
317
- namespace, name = *self
318
355
  if namespace && !namespace.cbase_type?
319
- "#{namespace.const_name}::#{name}"
356
+ "#{namespace.const_name}::#{short_name}"
320
357
  else
321
- name.to_s
358
+ short_name.to_s
322
359
  end
323
360
  end
324
361
 
@@ -460,11 +497,11 @@ module RuboCop
460
497
  end
461
498
 
462
499
  def parenthesized_call?
463
- loc.respond_to?(:begin) && loc.begin && loc.begin.is?('(')
500
+ loc.respond_to?(:begin) && loc.begin&.is?('(')
464
501
  end
465
502
 
466
503
  def call_type?
467
- send_type? || csend_type?
504
+ GROUP_FOR_TYPE[type] == :call
468
505
  end
469
506
 
470
507
  def chained?
@@ -476,23 +513,23 @@ module RuboCop
476
513
  end
477
514
 
478
515
  def argument_type?
479
- ARGUMENT_TYPES.include?(type)
516
+ GROUP_FOR_TYPE[type] == :argument
480
517
  end
481
518
 
482
519
  def boolean_type?
483
- true_type? || false_type?
520
+ GROUP_FOR_TYPE[type] == :boolean
484
521
  end
485
522
 
486
523
  def numeric_type?
487
- int_type? || float_type? || rational_type? || complex_type?
524
+ GROUP_FOR_TYPE[type] == :numeric
488
525
  end
489
526
 
490
527
  def range_type?
491
- irange_type? || erange_type?
528
+ GROUP_FOR_TYPE[type] == :range
492
529
  end
493
530
 
494
531
  def guard_clause?
495
- node = and_type? || or_type? ? rhs : self
532
+ node = operator_keyword? ? rhs : self
496
533
 
497
534
  node.match_guard_clause?
498
535
  end
@@ -2,7 +2,7 @@
2
2
  # encoding: UTF-8
3
3
  #--
4
4
  # This file is automatically generated. Do not modify it.
5
- # Generated by: oedipus_lex version 2.6.0.
5
+ # Generated by: oedipus_lex version 2.6.2.
6
6
  # Source: lib/rubocop/ast/node_pattern/lexer.rex
7
7
  #++
8
8
 
@@ -70,7 +70,6 @@ class RuboCop::AST::NodePattern::LexerRex
70
70
  yield
71
71
  end
72
72
 
73
-
74
73
  ##
75
74
  # The current scanner class. Must be overridden in subclasses.
76
75
 
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
  #
3
3
  # DO NOT MODIFY!!!!
4
- # This file is automatically generated by Racc 1.5.0
5
- # from Racc grammar file "".
4
+ # This file is automatically generated by Racc 1.8.1
5
+ # from Racc grammar file "parser.y".
6
6
  #
7
7
 
8
8
  require 'racc/parser.rb'
@@ -14,15 +14,15 @@ module RuboCop
14
14
 
15
15
  racc_action_table = [
16
16
  14, 15, 16, 21, 18, 17, 19, 10, 11, 12,
17
- 60, 22, 20, 4, 40, 5, 43, 6, 7, 8,
18
- 28, 23, 56, 50, 66, 61, 24, 51, 51, 40,
17
+ 60, 22, 20, 4, 24, 5, 40, 6, 7, 8,
18
+ 28, 23, 56, 50, 40, 61, 43, 66, 51, 51,
19
19
  58, 14, 15, 16, 21, 18, 17, 19, 10, 11,
20
20
  12, nil, 22, 20, 4, nil, 5, nil, 6, 7,
21
21
  8, 28, 23, nil, nil, -34, 14, 15, 16, 21,
22
22
  18, 17, 19, 10, 11, 12, nil, 22, 20, 4,
23
23
  nil, 5, nil, 6, 7, 8, 9, 23, 14, 15,
24
24
  16, 21, 18, 17, 19, 10, 11, 12, nil, 22,
25
- 20, 4, nil, 5, nil, 6, 7, 8, 9, 23,
25
+ 20, 4, nil, 5, nil, 6, 7, 8, 28, 23,
26
26
  14, 15, 16, 21, 18, 17, 19, 10, 11, 12,
27
27
  nil, 22, 20, 4, nil, 5, nil, 6, 7, 8,
28
28
  9, 23, 14, 15, 16, 21, 18, 17, 19, 10,
@@ -33,7 +33,7 @@ racc_action_table = [
33
33
  18, 17, 19, 10, 11, 12, nil, 22, 20, 4,
34
34
  nil, 5, nil, 6, 7, 8, 9, 23, 14, 15,
35
35
  16, 21, 18, 17, 19, 10, 11, 12, nil, 22,
36
- 20, 4, nil, 5, nil, 6, 7, 8, 28, 23,
36
+ 20, 4, nil, 5, nil, 6, 7, 8, 9, 23,
37
37
  14, 15, 16, 21, 18, 17, 19, 10, 11, 12,
38
38
  nil, 22, 20, 4, 44, 5, nil, 6, 7, 8,
39
39
  28, 23, 14, 15, 16, 21, 18, 17, 19, 10,
@@ -47,31 +47,31 @@ racc_action_table = [
47
47
  20, 4, nil, 5, nil, 6, 7, 8, 9, 23,
48
48
  14, 15, 16, 21, 18, 17, 19, 10, 11, 12,
49
49
  nil, 22, 20, 4, nil, 5, nil, 6, 7, 8,
50
- 9, 23, 47, 48, 49, -1, -1, -1, -2, -2,
51
- -2 ]
50
+ 9, 23, -1, -1, -1, -2, -2, -2, 47, 48,
51
+ 49 ]
52
52
 
53
53
  racc_action_check = [
54
54
  42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
55
- 54, 42, 42, 42, 11, 42, 24, 42, 42, 42,
56
- 42, 42, 42, 30, 62, 54, 1, 63, 30, 10,
55
+ 54, 42, 42, 42, 1, 42, 10, 42, 42, 42,
56
+ 42, 42, 42, 30, 11, 54, 24, 62, 30, 63,
57
57
  42, 59, 59, 59, 59, 59, 59, 59, 59, 59,
58
58
  59, nil, 59, 59, 59, nil, 59, nil, 59, 59,
59
- 59, 59, 59, nil, nil, 59, 5, 5, 5, 5,
60
- 5, 5, 5, 5, 5, 5, nil, 5, 5, 5,
61
- nil, 5, nil, 5, 5, 5, 5, 5, 6, 6,
62
- 6, 6, 6, 6, 6, 6, 6, 6, nil, 6,
63
- 6, 6, nil, 6, nil, 6, 6, 6, 6, 6,
64
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
65
- nil, 7, 7, 7, nil, 7, nil, 7, 7, 7,
66
- 7, 7, 8, 8, 8, 8, 8, 8, 8, 8,
67
- 8, 8, nil, 8, 8, 8, nil, 8, nil, 8,
68
- 8, 8, 8, 8, 9, 9, 9, 9, 9, 9,
69
- 9, 9, 9, 9, nil, 9, 9, 9, nil, 9,
70
- nil, 9, 9, 9, 9, 9, 0, 0, 0, 0,
59
+ 59, 59, 59, nil, nil, 59, 0, 0, 0, 0,
71
60
  0, 0, 0, 0, 0, 0, nil, 0, 0, 0,
72
61
  nil, 0, nil, 0, 0, 0, 0, 0, 4, 4,
73
62
  4, 4, 4, 4, 4, 4, 4, 4, nil, 4,
74
63
  4, 4, nil, 4, nil, 4, 4, 4, 4, 4,
64
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
65
+ nil, 5, 5, 5, nil, 5, nil, 5, 5, 5,
66
+ 5, 5, 6, 6, 6, 6, 6, 6, 6, 6,
67
+ 6, 6, nil, 6, 6, 6, nil, 6, nil, 6,
68
+ 6, 6, 6, 6, 7, 7, 7, 7, 7, 7,
69
+ 7, 7, 7, 7, nil, 7, 7, 7, nil, 7,
70
+ nil, 7, 7, 7, 7, 7, 8, 8, 8, 8,
71
+ 8, 8, 8, 8, 8, 8, nil, 8, 8, 8,
72
+ nil, 8, nil, 8, 8, 8, 8, 8, 9, 9,
73
+ 9, 9, 9, 9, 9, 9, 9, 9, nil, 9,
74
+ 9, 9, nil, 9, nil, 9, 9, 9, 9, 9,
75
75
  27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
76
76
  nil, 27, 27, 27, 27, 27, nil, 27, 27, 27,
77
77
  27, 27, 28, 28, 28, 28, 28, 28, 28, 28,
@@ -85,17 +85,17 @@ racc_action_check = [
85
85
  50, 50, nil, 50, nil, 50, 50, 50, 50, 50,
86
86
  61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
87
87
  nil, 61, 61, 61, nil, 61, nil, 61, 61, 61,
88
- 61, 61, 29, 29, 29, 25, 25, 25, 26, 26,
89
- 26 ]
88
+ 61, 61, 25, 25, 25, 26, 26, 26, 29, 29,
89
+ 29 ]
90
90
 
91
91
  racc_action_pointer = [
92
- 164, 26, nil, nil, 186, 54, 76, 98, 120, 142,
93
- 17, 2, nil, nil, nil, nil, nil, nil, nil, nil,
94
- nil, nil, nil, nil, 16, 318, 321, 208, 230, 315,
92
+ 54, 14, nil, nil, 76, 98, 120, 142, 164, 186,
93
+ 4, 12, nil, nil, nil, nil, nil, nil, nil, nil,
94
+ nil, nil, nil, nil, 26, 315, 318, 208, 230, 321,
95
95
  -2, nil, nil, 252, nil, nil, nil, nil, nil, nil,
96
96
  274, nil, -2, nil, nil, nil, nil, nil, nil, nil,
97
97
  296, nil, nil, nil, -6, nil, nil, nil, nil, 29,
98
- nil, 318, -2, -3, nil, nil, nil ]
98
+ nil, 318, 1, -1, nil, nil, nil ]
99
99
 
100
100
  racc_action_default = [
101
101
  -47, -47, -1, -2, -31, -47, -47, -47, -47, -47,
@@ -107,26 +107,26 @@ racc_action_default = [
107
107
  -37, -47, -47, -47, -35, -39, -26 ]
108
108
 
109
109
  racc_goto_table = [
110
- 1, 33, 64, 32, 25, 34, 35, 36, 37, 38,
111
- 54, 26, 39, 41, 27, 42, 46, 63, 62, nil,
112
- nil, nil, nil, nil, nil, nil, 45, 25, 38, nil,
113
- nil, nil, nil, 53, 26, nil, nil, nil, nil, nil,
114
- 55, 57, 25, nil, nil, nil, 59, nil, nil, 26,
110
+ 1, 33, 27, 25, 26, 34, 35, 36, 37, 38,
111
+ 42, 32, 39, 41, 46, 63, 62, 64, 54, nil,
112
+ nil, nil, nil, nil, nil, nil, 25, 26, 38, nil,
113
+ nil, nil, nil, 53, 45, nil, nil, nil, nil, nil,
114
+ 55, 25, 26, nil, nil, nil, 59, nil, nil, 57,
115
115
  34, nil, nil, nil, nil, nil, nil, nil, nil, 53,
116
116
  nil, 65 ]
117
117
 
118
118
  racc_goto_check = [
119
- 1, 5, 13, 9, 2, 1, 1, 1, 1, 1,
120
- 14, 3, 6, 6, 4, 8, 10, 11, 12, nil,
121
- nil, nil, nil, nil, nil, nil, 9, 2, 1, nil,
122
- nil, nil, nil, 1, 3, nil, nil, nil, nil, nil,
123
- 1, 9, 2, nil, nil, nil, 5, nil, nil, 3,
119
+ 1, 5, 4, 2, 3, 1, 1, 1, 1, 1,
120
+ 8, 9, 6, 6, 10, 11, 12, 13, 14, nil,
121
+ nil, nil, nil, nil, nil, nil, 2, 3, 1, nil,
122
+ nil, nil, nil, 1, 9, nil, nil, nil, nil, nil,
123
+ 1, 2, 3, nil, nil, nil, 5, nil, nil, 9,
124
124
  1, nil, nil, nil, nil, nil, nil, nil, nil, 1,
125
125
  nil, 1 ]
126
126
 
127
127
  racc_goto_pointer = [
128
- nil, 0, 0, 7, 10, -4, 2, nil, -8, -1,
129
- -13, -42, -41, -57, -30 ]
128
+ nil, 0, -1, 0, -2, -4, 2, nil, -13, 7,
129
+ -15, -44, -43, -42, -22 ]
130
130
 
131
131
  racc_goto_default = [
132
132
  nil, 29, 2, 3, nil, nil, nil, 13, nil, nil,
@@ -239,6 +239,7 @@ Racc_arg = [
239
239
  racc_shift_n,
240
240
  racc_reduce_n,
241
241
  racc_use_result_var ]
242
+ Ractor.make_shareable(Racc_arg) if defined?(Ractor)
242
243
 
243
244
  Racc_token_to_s_table = [
244
245
  "$end",
@@ -289,6 +290,7 @@ Racc_token_to_s_table = [
289
290
  "opt_rest",
290
291
  "rest",
291
292
  "arg_list" ]
293
+ Ractor.make_shareable(Racc_token_to_s_table) if defined?(Ractor)
292
294
 
293
295
  Racc_debug_parser = false
294
296
 
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module AST
5
5
  module Version
6
- STRING = '1.32.3'
6
+ STRING = '1.36.2'
7
7
  end
8
8
  end
9
9
  end
data/lib/rubocop/ast.rb CHANGED
@@ -27,6 +27,7 @@ require_relative 'ast/node/mixin/method_identifier_predicates'
27
27
  require_relative 'ast/node/mixin/binary_operator_node'
28
28
  require_relative 'ast/node/mixin/collection_node'
29
29
  require_relative 'ast/node/mixin/conditional_node'
30
+ require_relative 'ast/node/mixin/constant_node'
30
31
  require_relative 'ast/node/mixin/hash_element_node'
31
32
  require_relative 'ast/node/mixin/method_dispatch_node'
32
33
  require_relative 'ast/node/mixin/modifier_node'
@@ -59,8 +60,11 @@ require_relative 'ast/node/in_pattern_node'
59
60
  require_relative 'ast/node/index_node'
60
61
  require_relative 'ast/node/indexasgn_node'
61
62
  require_relative 'ast/node/int_node'
63
+ require_relative 'ast/node/keyword_begin_node'
62
64
  require_relative 'ast/node/keyword_splat_node'
63
65
  require_relative 'ast/node/lambda_node'
66
+ require_relative 'ast/node/masgn_node'
67
+ require_relative 'ast/node/mlhs_node'
64
68
  require_relative 'ast/node/module_node'
65
69
  require_relative 'ast/node/next_node'
66
70
  require_relative 'ast/node/op_asgn_node'
@@ -83,6 +87,7 @@ require_relative 'ast/node/dstr_node'
83
87
  require_relative 'ast/node/super_node'
84
88
  require_relative 'ast/node/symbol_node'
85
89
  require_relative 'ast/node/until_node'
90
+ require_relative 'ast/node/var_node'
86
91
  require_relative 'ast/node/when_node'
87
92
  require_relative 'ast/node/while_node'
88
93
  require_relative 'ast/node/yield_node'
metadata CHANGED
@@ -1,15 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-ast
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.32.3
4
+ version: 1.36.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bozhidar Batsov
8
8
  - Jonas Arvidsson
9
9
  - Yuji Nakayama
10
+ autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2024-09-04 00:00:00.000000000 Z
13
+ date: 2024-11-27 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: parser
@@ -68,12 +69,15 @@ files:
68
69
  - lib/rubocop/ast/node/index_node.rb
69
70
  - lib/rubocop/ast/node/indexasgn_node.rb
70
71
  - lib/rubocop/ast/node/int_node.rb
72
+ - lib/rubocop/ast/node/keyword_begin_node.rb
71
73
  - lib/rubocop/ast/node/keyword_splat_node.rb
72
74
  - lib/rubocop/ast/node/lambda_node.rb
75
+ - lib/rubocop/ast/node/masgn_node.rb
73
76
  - lib/rubocop/ast/node/mixin/basic_literal_node.rb
74
77
  - lib/rubocop/ast/node/mixin/binary_operator_node.rb
75
78
  - lib/rubocop/ast/node/mixin/collection_node.rb
76
79
  - lib/rubocop/ast/node/mixin/conditional_node.rb
80
+ - lib/rubocop/ast/node/mixin/constant_node.rb
77
81
  - lib/rubocop/ast/node/mixin/descendence.rb
78
82
  - lib/rubocop/ast/node/mixin/hash_element_node.rb
79
83
  - lib/rubocop/ast/node/mixin/method_dispatch_node.rb
@@ -82,6 +86,7 @@ files:
82
86
  - lib/rubocop/ast/node/mixin/numeric_node.rb
83
87
  - lib/rubocop/ast/node/mixin/parameterized_node.rb
84
88
  - lib/rubocop/ast/node/mixin/predicate_operator_node.rb
89
+ - lib/rubocop/ast/node/mlhs_node.rb
85
90
  - lib/rubocop/ast/node/module_node.rb
86
91
  - lib/rubocop/ast/node/next_node.rb
87
92
  - lib/rubocop/ast/node/op_asgn_node.rb
@@ -101,6 +106,7 @@ files:
101
106
  - lib/rubocop/ast/node/super_node.rb
102
107
  - lib/rubocop/ast/node/symbol_node.rb
103
108
  - lib/rubocop/ast/node/until_node.rb
109
+ - lib/rubocop/ast/node/var_node.rb
104
110
  - lib/rubocop/ast/node/when_node.rb
105
111
  - lib/rubocop/ast/node/while_node.rb
106
112
  - lib/rubocop/ast/node/yield_node.rb
@@ -141,6 +147,7 @@ metadata:
141
147
  documentation_uri: https://docs.rubocop.org/rubocop-ast/
142
148
  bug_tracker_uri: https://github.com/rubocop/rubocop-ast/issues
143
149
  rubygems_mfa_required: 'true'
150
+ post_install_message:
144
151
  rdoc_options: []
145
152
  require_paths:
146
153
  - lib
@@ -155,7 +162,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
155
162
  - !ruby/object:Gem::Version
156
163
  version: '0'
157
164
  requirements: []
158
- rubygems_version: 3.6.0.dev
165
+ rubygems_version: 3.5.11
166
+ signing_key:
159
167
  specification_version: 4
160
168
  summary: RuboCop tools to deal with Ruby code AST.
161
169
  test_files: []