solargraph 0.39.13 → 0.39.14

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: b06a4823fe5895875513bafc0192b627ecc2a5eff460bdc4e9bd511e8d31ecda
4
- data.tar.gz: e5cfad1cfaa75dec019e2a772297c4f5c936370a9dcb49d1a61ae1e9e0529581
3
+ metadata.gz: 3ec8cbe63061b570e7d0fb984e1a4a15ed40c265e34fb6bd7d027f859d32a4d4
4
+ data.tar.gz: 93e53c212c5c608b0ecdea34ce7771213b92c75917cf110673e5a4fa1f3f785e
5
5
  SHA512:
6
- metadata.gz: 3e169cdfe2badf421a2323c6e796d346dea9c17f1b919a2d96de47ac7f1d0a3ebc77a799ac1ff7f44022b6621c01936fb31178ec9db56ea0b6ee63f44e279f47
7
- data.tar.gz: 1c7783cd9b43ed4b9dc29a30fea180c10c9440961a630e7180f4101bcc064b40db9fd9018b5d94594cf061c9b993402cf18ffdcff3a4537f0366dd6f29992865
6
+ metadata.gz: a0e7c03a9f231ebe695cf95150402a525fe0e3abfedb82dc6cd275e58e64170814dde79a24c03f02ff4f2477dacfef7a64ed71006a54e5b30abd5b27a7d7afcd
7
+ data.tar.gz: b78c8f4bf6f7f0f291391fdc1e9c6a95376f51801426efdb7a17b6c0eed380056074df02321dd61a34d1afb82ccae52ba97fba383388d962ede99bd9e3e753ed
@@ -15,7 +15,7 @@ module Solargraph
15
15
  @@conventions = Set.new
16
16
 
17
17
  # @param convention [Class<Convention::Base>]
18
- # @return [Convention::Base]
18
+ # @return [void]
19
19
  def self.register convention
20
20
  @@conventions.add convention.new
21
21
  end
@@ -66,6 +66,7 @@ module Solargraph
66
66
  @return_single_parameter
67
67
  )),
68
68
  Override.method_return('Array#uniq', 'self'),
69
+ Override.method_return('Array#zip', 'Array, nil'),
69
70
 
70
71
  Override.from_comment('BasicObject#==', %(
71
72
  @param other [BasicObject]
@@ -197,7 +197,7 @@ module Solargraph
197
197
  result.push node
198
198
  result.concat get_return_nodes_only(node.children[1])
199
199
  elsif node.type == :CASE
200
- node.children.each do |cc|
200
+ node.children[1..-1].each do |cc|
201
201
  result.concat reduce_to_value_nodes(cc.children[1..-1])
202
202
  end
203
203
  else
@@ -54,6 +54,7 @@ module Solargraph
54
54
  register :KW_ARG, Rubyvm::NodeProcessors::KwArgNode
55
55
  register :ITER, Rubyvm::NodeProcessors::BlockNode
56
56
  register :LAMBDA, Rubyvm::NodeProcessors::BlockNode
57
+ register :FOR, Rubyvm::NodeProcessors::BlockNode
57
58
  register :OP_ASGN_OR, Rubyvm::NodeProcessors::OrasgnNode
58
59
  register :LIT, Rubyvm::NodeProcessors::LitNode
59
60
  end
@@ -7,16 +7,30 @@ module Solargraph
7
7
  class ArgsNode < Parser::NodeProcessor::Base
8
8
  def process
9
9
  if region.closure.is_a?(Pin::BaseMethod) || region.closure.is_a?(Pin::Block)
10
- node.children[0].times do |i|
11
- locals.push Solargraph::Pin::Parameter.new(
12
- location: region.closure.location,
13
- closure: region.closure,
14
- comments: comments_for(node),
15
- name: region.lvars[i].to_s,
16
- presence: region.closure.location.range,
17
- decl: :arg
18
- )
19
- region.closure.parameters.push locals.last
10
+ if region.lvars[0].nil?
11
+ node.children[0].times do |i|
12
+ locals.push Solargraph::Pin::Parameter.new(
13
+ location: region.closure.location,
14
+ closure: region.closure,
15
+ comments: comments_for(node),
16
+ name: extract_name(node.children[i + 1]),
17
+ presence: region.closure.location.range,
18
+ decl: :arg
19
+ )
20
+ region.closure.parameters.push locals.last
21
+ end
22
+ else
23
+ node.children[0].times do |i|
24
+ locals.push Solargraph::Pin::Parameter.new(
25
+ location: region.closure.location,
26
+ closure: region.closure,
27
+ comments: comments_for(node),
28
+ name: region.lvars[i].to_s,
29
+ presence: region.closure.location.range,
30
+ decl: :arg
31
+ )
32
+ region.closure.parameters.push locals.last
33
+ end
20
34
  end
21
35
  # @todo Optional args, keyword args, etc.
22
36
  if node.children[6]
@@ -55,6 +69,16 @@ module Solargraph
55
69
  end
56
70
  process_children
57
71
  end
72
+
73
+ private
74
+
75
+ def extract_name var
76
+ if Parser.is_ast_node?(var)
77
+ var.children[0].to_s
78
+ else
79
+ var.to_s
80
+ end
81
+ end
58
82
  end
59
83
  end
60
84
  end
@@ -153,6 +153,7 @@ module Solargraph
153
153
  probcount += problems.length
154
154
  end
155
155
  puts "#{probcount} problem#{probcount != 1 ? 's' : ''} found#{files.length != 1 ? " in #{filecount} of #{files.length} files" : ''}."
156
+ exit 1 if probcount.positive?
156
157
  end
157
158
 
158
159
  desc 'scan', 'Test the workspace for problems'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Solargraph
4
- VERSION = '0.39.13'
4
+ VERSION = '0.39.14'
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.39.13
4
+ version: 0.39.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fred Snyder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-05 00:00:00.000000000 Z
11
+ date: 2020-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backport