Class: Solargraph::Source::Chain::Call
- Inherits:
-
Link
- Object
- Link
- Solargraph::Source::Chain::Call
show all
- Includes:
- ParserGem::NodeMethods
- Defined in:
- lib/solargraph/source/chain/call.rb
Instance Attribute Summary collapse
Attributes inherited from Link
#last_context
Instance Method Summary
collapse
Methods inherited from Link
#==, #clone_body, #clone_head, #constant?, #desc, #head?, #inspect, #nullable?, #undefined?
Constructor Details
#initialize(word, arguments = [], block = nil) ⇒ Call
Returns a new instance of Call.
21
22
23
24
25
26
|
# File 'lib/solargraph/source/chain/call.rb', line 21
def initialize word, arguments = [], block = nil
@word = word
@arguments = arguments
@block = block
fix_block_pass
end
|
Instance Attribute Details
#arguments ⇒ ::Array<Chain>
13
14
15
|
# File 'lib/solargraph/source/chain/call.rb', line 13
def arguments
@arguments
end
|
16
17
18
|
# File 'lib/solargraph/source/chain/call.rb', line 16
def block
@block
end
|
#word ⇒ String
10
11
12
|
# File 'lib/solargraph/source/chain/call.rb', line 10
def word
@word
end
|
Instance Method Details
#resolve(api_map, name_pin, locals) ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/solargraph/source/chain/call.rb', line 35
def resolve api_map, name_pin, locals
return super_pins(api_map, name_pin) if word == 'super'
return yield_pins(api_map, name_pin) if word == 'yield'
found = if head?
locals.select { |p| p.name == word }
else
[]
end
return inferred_pins(found, api_map, name_pin, locals) unless found.empty?
pins = name_pin.binder.each_unique_type.flat_map do |context|
method_context = context.namespace == '' ? '' : context.tag
api_map.get_method_stack(method_context, word, scope: context.scope)
end
return [] if pins.empty?
inferred_pins(pins, api_map, name_pin, locals)
end
|
#with_block? ⇒ Boolean
28
29
30
|
# File 'lib/solargraph/source/chain/call.rb', line 28
def with_block?
!!@block
end
|