solargraph 0.29.3 → 0.29.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60d754493bfc4ef0b40c6fd5b7c872b67e9ee5caa83930f9ede99389bb4b9007
|
4
|
+
data.tar.gz: '077452469bb99c0b6b7fede9bcadf8fb115d1b9889733c52170800f4b2a953f3'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 066a7d0a1b04ba6c9cba7cac8cbb8339a2c2b5a47bd387ab8fdc11b40a6b9ec3cd076c8f2672efb08be8d90db5df32575fea5cf3516e0d0d9e844a169b778580
|
7
|
+
data.tar.gz: 16a58b9ffc792406b3c95b4ab7d0b5835334a8851c6bb9ab89657606bde490c5184ca7bc5228dc122d39d70a71cb94d459d8a868bde0501c0ebba3cf6804c906
|
@@ -20,7 +20,9 @@ module Solargraph
|
|
20
20
|
else
|
21
21
|
ns = ''
|
22
22
|
end
|
23
|
-
api_map.get_constants(ns, context)
|
23
|
+
result = api_map.get_constants(ns, context)
|
24
|
+
last_name = bottom.split('::').last
|
25
|
+
result.select{ |p| p.name == last_name }
|
24
26
|
end
|
25
27
|
end
|
26
28
|
end
|
@@ -109,6 +109,22 @@ module Solargraph
|
|
109
109
|
signature
|
110
110
|
end
|
111
111
|
|
112
|
+
# Find all the nodes within the provided node that potentially return a
|
113
|
+
# value.
|
114
|
+
#
|
115
|
+
# The node parameter typically represents a method's logic, e.g., the
|
116
|
+
# second child (after the :args node) of a :def node. A simple one-line
|
117
|
+
# method would typically return itself, while a node with conditions
|
118
|
+
# would return the resulting node from each conditional branch. Nodes
|
119
|
+
# that follow a :return node are assumed to be unreachable. Implicit nil
|
120
|
+
# values are ignored.
|
121
|
+
#
|
122
|
+
# @todo Maybe this method should include implicit nil values in results.
|
123
|
+
# For example, a bare `return` would return a :nil node instead of an
|
124
|
+
# empty array.
|
125
|
+
#
|
126
|
+
# @param node [AST::Node]
|
127
|
+
# @return [Array<AST::Node>]
|
112
128
|
def returns_from node
|
113
129
|
DeepInference.get_return_nodes(node)
|
114
130
|
end
|
@@ -120,11 +136,14 @@ module Solargraph
|
|
120
136
|
SKIPPABLE = [:def, :defs, :class, :sclass, :module]
|
121
137
|
|
122
138
|
def get_return_nodes node
|
139
|
+
return [] unless node.is_a?(Parser::AST::Node)
|
123
140
|
result = []
|
124
141
|
if REDUCEABLE.include?(node.type)
|
125
142
|
result.concat get_return_nodes_from_children(node)
|
126
143
|
elsif CONDITIONAL.include?(node.type)
|
127
144
|
result.concat reduce_to_value_nodes(node.children[1..-1])
|
145
|
+
elsif node.type == :return
|
146
|
+
result.concat reduce_to_value_nodes([node.children[0]])
|
128
147
|
else
|
129
148
|
result.push node
|
130
149
|
end
|
@@ -140,8 +159,8 @@ module Solargraph
|
|
140
159
|
next if SKIPPABLE.include?(node.type)
|
141
160
|
if node.type == :return
|
142
161
|
result.concat reduce_to_value_nodes([node.children[0]])
|
143
|
-
#
|
144
|
-
#
|
162
|
+
# Return the result here because the rest of the code is
|
163
|
+
# unreachable
|
145
164
|
return result
|
146
165
|
else
|
147
166
|
result.concat get_return_nodes_only(node)
|
@@ -158,8 +177,9 @@ module Solargraph
|
|
158
177
|
next if SKIPPABLE.include?(node.type)
|
159
178
|
if node.type == :return
|
160
179
|
result.concat reduce_to_value_nodes([node.children[0]])
|
161
|
-
#
|
162
|
-
#
|
180
|
+
# Return the result here because the rest of the code is
|
181
|
+
# unreachable
|
182
|
+
return result
|
163
183
|
else
|
164
184
|
result.concat get_return_nodes_only(node)
|
165
185
|
end
|
@@ -170,11 +190,9 @@ module Solargraph
|
|
170
190
|
def reduce_to_value_nodes nodes
|
171
191
|
result = []
|
172
192
|
nodes.each do |node|
|
193
|
+
next unless node.is_a?(Parser::AST::Node)
|
173
194
|
if REDUCEABLE.include?(node.type)
|
174
195
|
result.concat get_return_nodes_from_children(node)
|
175
|
-
# node.children.each do |child|
|
176
|
-
# result.concat reduce_to_value_nodes(child)
|
177
|
-
# end
|
178
196
|
elsif CONDITIONAL.include?(node.type)
|
179
197
|
result.concat reduce_to_value_nodes(node.children[1..-1])
|
180
198
|
elsif node.type == :return
|
@@ -186,7 +204,7 @@ module Solargraph
|
|
186
204
|
result
|
187
205
|
end
|
188
206
|
end
|
189
|
-
end
|
207
|
+
end
|
190
208
|
end
|
191
209
|
end
|
192
210
|
end
|
data/lib/solargraph/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solargraph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.29.
|
4
|
+
version: 0.29.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fred Snyder
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-12-
|
11
|
+
date: 2018-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eventmachine
|