solargraph 0.40.1 → 0.40.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/.rubocop.yml +2 -2
- data/lib/solargraph/parser/legacy/node_methods.rb +4 -0
- data/lib/solargraph/parser/rubyvm/node_methods.rb +9 -2
- data/lib/solargraph/type_checker.rb +24 -17
- data/lib/solargraph/version.rb +1 -1
- data/solargraph.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70d201ad10b41bf9e0322370c2de7fa8c0efa25d8746b5b7cb3d1adc81902721
|
4
|
+
data.tar.gz: 7547665a359af045b4c9d1a0991d4dec4b37c621e7baf15b20656228ce69fa1f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f79d086cf827d4bfa0a1c24c002a7487e742a0de65e5094126c9cb0dd12ca43aa08ec7e62debf074577adf81b8cd0d7e8916ee90676a3d2a5f0e8bfa6e9296c
|
7
|
+
data.tar.gz: 15afa63bb7bf32dfa51dff97432c8a8070d6521a364097b4f399e5a5962b25f9d86d336e26aad3810c66de01ba5ec273224030628d56b6640db60f10501cc578
|
data/CHANGELOG.md
CHANGED
data/lib/.rubocop.yml
CHANGED
@@ -123,6 +123,10 @@ module Solargraph
|
|
123
123
|
Parser.is_ast_node?(node.children[0]) && node.children[0].type == :kwsplat
|
124
124
|
end
|
125
125
|
|
126
|
+
def splatted_call? node
|
127
|
+
Parser.is_ast_node?(node.children[0]) && node.children[0].type == :kwsplat && node.children[0].children[0].type != :hash
|
128
|
+
end
|
129
|
+
|
126
130
|
# @todo Temporarily here for testing. Move to Solargraph::Parser.
|
127
131
|
def call_nodes_from node
|
128
132
|
return [] unless node.is_a?(::Parser::AST::Node)
|
@@ -106,11 +106,18 @@ module Solargraph
|
|
106
106
|
end
|
107
107
|
|
108
108
|
def splatted_hash? node
|
109
|
+
splatted_node?(node) && node.children[0].children[1].type == :HASH
|
110
|
+
end
|
111
|
+
|
112
|
+
def splatted_node? node
|
109
113
|
node?(node.children[0]) &&
|
110
114
|
[:ARRAY, :LIST].include?(node.children[0].type) &&
|
111
115
|
node.children[0].children[0].nil? &&
|
112
|
-
node?(node.children[0].children[1])
|
113
|
-
|
116
|
+
node?(node.children[0].children[1])
|
117
|
+
end
|
118
|
+
|
119
|
+
def splatted_call? node
|
120
|
+
splatted_node?(node) && node.children[0].children[1].type != :HASH
|
114
121
|
end
|
115
122
|
|
116
123
|
def node? node
|
@@ -334,6 +334,8 @@ module Solargraph
|
|
334
334
|
result
|
335
335
|
end
|
336
336
|
|
337
|
+
# @param [Pin::Method]
|
338
|
+
# @return [Hash]
|
337
339
|
def param_hash(pin)
|
338
340
|
tags = pin.docstring.tags(:param)
|
339
341
|
return {} if tags.empty?
|
@@ -346,6 +348,7 @@ module Solargraph
|
|
346
348
|
end
|
347
349
|
|
348
350
|
# @param [Array<Pin::Method>]
|
351
|
+
# @return [Hash]
|
349
352
|
def first_param_hash(pins)
|
350
353
|
pins.each do |pin|
|
351
354
|
result = param_hash(pin)
|
@@ -413,24 +416,28 @@ module Solargraph
|
|
413
416
|
end
|
414
417
|
settled_kwargs = 0
|
415
418
|
unless unchecked.empty?
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
419
|
+
if Parser.is_ast_node?(unchecked.last.node) && splatted_call?(unchecked.last.node)
|
420
|
+
settled_kwargs = pin.parameters.count(&:keyword?)
|
421
|
+
else
|
422
|
+
kwargs = convert_hash(unchecked.last.node)
|
423
|
+
if pin.parameters.any? { |param| [:kwarg, :kwoptarg].include?(param.decl) || param.kwrestarg? }
|
424
|
+
if kwargs.empty?
|
425
|
+
add_params += 1
|
426
|
+
else
|
427
|
+
unchecked.pop
|
428
|
+
pin.parameters.each do |param|
|
429
|
+
next unless param.keyword?
|
430
|
+
if kwargs.key?(param.name.to_sym)
|
431
|
+
kwargs.delete param.name.to_sym
|
432
|
+
settled_kwargs += 1
|
433
|
+
elsif param.decl == :kwarg
|
434
|
+
return [Problem.new(location, "Missing keyword argument #{param.name} to #{pin.path}")]
|
435
|
+
end
|
436
|
+
end
|
437
|
+
kwargs.clear if pin.parameters.any?(&:kwrestarg?)
|
438
|
+
unless kwargs.empty?
|
439
|
+
return [Problem.new(location, "Unrecognized keyword argument #{kwargs.keys.first} to #{pin.path}")]
|
429
440
|
end
|
430
|
-
end
|
431
|
-
kwargs.clear if pin.parameters.any?(&:kwrestarg?)
|
432
|
-
unless kwargs.empty?
|
433
|
-
return [Problem.new(location, "Unrecognized keyword argument #{kwargs.keys.first} to #{pin.path}")]
|
434
441
|
end
|
435
442
|
end
|
436
443
|
end
|
data/lib/solargraph/version.rb
CHANGED
data/solargraph.gemspec
CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
|
|
26
26
|
s.add_runtime_dependency 'jaro_winkler', '~> 1.5'
|
27
27
|
s.add_runtime_dependency 'kramdown', '~> 2.3'
|
28
28
|
s.add_runtime_dependency 'kramdown-parser-gfm', '~> 1.1'
|
29
|
-
s.add_runtime_dependency 'parser', '~>
|
29
|
+
s.add_runtime_dependency 'parser', '~> 3.0'
|
30
30
|
s.add_runtime_dependency 'reverse_markdown', '>= 1.0.5', '< 3'
|
31
31
|
s.add_runtime_dependency 'rubocop', '>= 0.52'
|
32
32
|
s.add_runtime_dependency 'thor', '~> 1.0'
|
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.40.
|
4
|
+
version: 0.40.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fred Snyder
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: backport
|
@@ -114,14 +114,14 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
117
|
+
version: '3.0'
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
124
|
+
version: '3.0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: reverse_markdown
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|