Class: Solargraph::Source::Chain::Call

Inherits:
Link
  • Object
show all
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

#==, #constant?, #undefined?

Constructor Details

#initialize(word, arguments = []) ⇒ Call


13
14
15
16
# File 'lib/solargraph/source/chain/call.rb', line 13

def initialize word, arguments = []
  @word = word
  @arguments = arguments
end

Instance Attribute Details

#argumentsArray<Chain> (readonly)


9
10
11
# File 'lib/solargraph/source/chain/call.rb', line 9

def arguments
  @arguments
end

#wordString (readonly)


6
7
8
# File 'lib/solargraph/source/chain/call.rb', line 6

def word
  @word
end

Instance Method Details

#resolve(api_map, name_pin, locals) ⇒ Object


21
22
23
24
25
26
27
# File 'lib/solargraph/source/chain/call.rb', line 21

def resolve api_map, name_pin, locals
  found = locals.select{|p| p.name == word}
  return inferred_pins(found, api_map, name_pin.context, locals) unless found.empty?
  pins = api_map.get_method_stack(name_pin.binder.namespace, word, scope: name_pin.binder.scope)
  return [] if pins.empty?
  inferred_pins(pins, api_map, name_pin.context, locals)
end