rubocop-ast 1.7.0 → 1.8.0

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: 25e84f96e233a9c966ad15efd834e109fea1c11d0998e2913ffd81310568d2b2
4
- data.tar.gz: f6b8a033d2fd90518fb102f2cfaa27a5ef32bcfb892783ef79e2b9ad33ab4235
3
+ metadata.gz: 9c8abd574665322b04af26974900562ce6224cdccb59fc1d8926971e39f0503f
4
+ data.tar.gz: 87096e43215bc016c8afc66194a93dc22567960e3bfebfaa99468e8736e35b36
5
5
  SHA512:
6
- metadata.gz: 326d28041a4c30d64cac801ceec9677eea264c7a98754217ae27b026bf9779122803402cdddd8306881320e8ac185ce3ff708d4b6e2c869840622303b50b9ab1
7
- data.tar.gz: 293b516ba03824c5c9fc56557943993688cf0796bd7ffe567434f7633ca71aa24aec8ebcac89284c3b7b9fb7d38302cf666b1e7b0bb844700d70bad8c65cc767
6
+ metadata.gz: 6a92317d5065b2b344c0130eaf37e77a410f4e0652cc30b9724ed44f0de05173213418bf9fd990b52de44e437547e90c0c6198f237c37ad8c8f99c9f4d0f2d9a
7
+ data.tar.gz: 9a304655d736e46e9f2f8a2094e4f0ac5ed7bcd1aa0ad19b16ad954f3b4d170d965203b24552478505454ac1f38650a393c8a0aede4c9412c083259756bf9ea1
@@ -31,6 +31,19 @@ module RuboCop
31
31
  node_parts[1...-1]
32
32
  end
33
33
 
34
+ # Returns an array of all the when branches in the `case` statement.
35
+ #
36
+ # @return [Array<Node, nil>] an array of the bodies of the `in` branches
37
+ # and the `else` (if any). Note that these bodies could be nil.
38
+ def branches
39
+ bodies = in_pattern_branches.map(&:body)
40
+ if else?
41
+ # `empty-else` node sets nil because it has no body.
42
+ else_branch.empty_else_type? ? bodies.push(nil) : bodies.push(else_branch)
43
+ end
44
+ bodies
45
+ end
46
+
34
47
  # Returns the else branch of the `case` statement, if any.
35
48
  #
36
49
  # @return [Node] the else branch node of the `case` statement
@@ -347,7 +347,7 @@ module RuboCop
347
347
  def compile_loop_advance(to = '+=1')
348
348
  # The `#{@cur_child_var} ||` is just to avoid unused variable warning
349
349
  "(#{@cur_child_var} = #{@seq_var}.children[#{@cur_index_var} #{to}]; " \
350
- "#{@cur_child_var} || true)"
350
+ "#{@cur_child_var} || true)"
351
351
  end
352
352
 
353
353
  def compile_loop(term)
@@ -52,7 +52,7 @@ module RuboCop
52
52
 
53
53
  detail = node.loc&.expression&.source || node.to_s
54
54
  raise NodePattern::Invalid, 'parse error, expected unary node pattern ' \
55
- "but got expression matching multiple elements: #{detail}"
55
+ "but got expression matching multiple elements: #{detail}"
56
56
  end
57
57
 
58
58
  # Overrides Racc::Parser's method:
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module AST
5
5
  module Version
6
- STRING = '1.7.0'
6
+ STRING = '1.8.0'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-ast
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bozhidar Batsov
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-05-28 00:00:00.000000000 Z
13
+ date: 2021-07-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: parser