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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c8abd574665322b04af26974900562ce6224cdccb59fc1d8926971e39f0503f
|
4
|
+
data.tar.gz: 87096e43215bc016c8afc66194a93dc22567960e3bfebfaa99468e8736e35b36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
|
55
|
+
"but got expression matching multiple elements: #{detail}"
|
56
56
|
end
|
57
57
|
|
58
58
|
# Overrides Racc::Parser's method:
|
data/lib/rubocop/ast/version.rb
CHANGED
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.
|
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-
|
13
|
+
date: 2021-07-14 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: parser
|