Class: Solargraph::Source::Chain::Constant

Inherits:
Link
  • Object
show all
Defined in:
lib/solargraph/source/chain/constant.rb

Constant Summary

Constants included from Logging

Logging::DEFAULT_LOG_LEVEL, Logging::LOG_LEVELS

Instance Attribute Summary

Attributes inherited from Link

#last_context, #word

Instance Method Summary collapse

Methods inherited from Link

#clone_body, #clone_head, #constant?, #desc, #head?, #inspect, #nullable?, #to_s, #undefined?

Methods included from Logging

logger

Methods included from Equality

#==, #eql?, #equality_fields, #freeze, #hash

Constructor Details

#initialize(word) ⇒ Constant



7
8
9
# File 'lib/solargraph/source/chain/constant.rb', line 7

def initialize word
  @word = word
end

Instance Method Details

#resolve(api_map, name_pin, locals) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/solargraph/source/chain/constant.rb', line 11

def resolve api_map, name_pin, locals
  return [Pin::ROOT_PIN] if word.empty?
  if word.start_with?('::')
    base = word[2..-1]
    gates = ['']
  else
    base = word
    gates = name_pin.gates
  end
  fqns = api_map.resolve(base, gates)
  api_map.get_path_pins(fqns)
end