solargraph 0.35.0 → 0.35.1

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: 02a0b8dd485332480c292f17a1cae69217cf9cb4e5f3aa9c29bd94ac55d57ab8
4
- data.tar.gz: f74891d9e13561d6a1ece0fb64fd014af2b1504e412e9d51b4e83d8d6a9aa089
3
+ metadata.gz: e6e65af0d45e5656d2bc17c0670ef5e308e3fb6f64be8db0ec1891e2203a81d6
4
+ data.tar.gz: 47e21df5e48d43ed40281d37ae3c50ddf6aaf643dff49da07b849d917f3fcf16
5
5
  SHA512:
6
- metadata.gz: f3c8574a741707ef88be3f6ec1e1287b4a67b091d0c12634e65d563e93510ba135c193b55f9f4d05af5a5f8b1d9a6c661f691e571811281cd523c6a62eec5513
7
- data.tar.gz: 13a013bcc7738c449696207a3622e1b3d3b7bed626fd2e39fe2a89c08eb42776fd19a32c7d65642b4ada6535a94af0f3f0a6ea3aee303eba1c2407daff9d4ad9
6
+ metadata.gz: 39b7b5fb39ce59ccf93c62775e3f685f0e71409aa791f76bf61a44202cb21d1501452961d267f07b40fb4dbbba8a82a2ebc349cea6857dc9e3b9796af9c8e510
7
+ data.tar.gz: 584f2110a4faf9cd98edd37bed4167b59f119b66168786d1faa0ad774d3180d66a0408e195d4a669f62cbd9252db75d0aa442fc6e4640f403eccd227b6320062
@@ -45,7 +45,10 @@ module Solargraph
45
45
  returns_from(@assignment).each do |node|
46
46
  pos = Solargraph::Position.new(node.loc.expression.last_line, node.loc.expression.last_column)
47
47
  clip = api_map.clip_at(location.filename, pos)
48
- result = clip.infer
48
+ # Use the return node for inference. The clip might infer from the
49
+ # first node in a method call instead of the entire call.
50
+ chain = Solargraph::Source::NodeChainer.chain(node, nil, clip.in_block?)
51
+ result = chain.infer(api_map, closure, clip.locals)
49
52
  types.push result unless result.undefined?
50
53
  end
51
54
  return ComplexType::UNDEFINED if types.empty?
@@ -95,6 +95,14 @@ module Solargraph
95
95
  block.gates
96
96
  end
97
97
 
98
+ def in_block?
99
+ return @in_block unless @in_block.nil?
100
+ @in_block = begin
101
+ tree = cursor.source.tree_at(cursor.position.line, cursor.position.column)
102
+ tree[1].is_a?(Parser::AST::Node) && tree[1].type == :block
103
+ end
104
+ end
105
+
98
106
  private
99
107
 
100
108
  # @return [ApiMap]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Solargraph
4
- VERSION = '0.35.0'
4
+ VERSION = '0.35.1'
5
5
  end
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.35.0
4
+ version: 0.35.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fred Snyder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-22 00:00:00.000000000 Z
11
+ date: 2019-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backport