class Solargraph::Source::Chain::Literal

def equality_fields

@sg-ignore Fix "Not enough arguments to Module#protected"
def equality_fields
[@value, @type, @literal_type, @complex_type]

def initialize type, node

Parameters:
  • node (Parser::AST::Node, Object) --
  • type (String) --
def initialize type, node
  if node.is_a?(::Parser::AST::Node)
    if node.type == :true
      @value = true
    elsif node.type == :false
      @value = false
    elsif [:int, :sym].include?(node.type)
      @value = node.children.first
    end
  end
  @type = type
  @literal_type = ComplexType.try_parse(@value.inspect)
  @complex_type = ComplexType.try_parse(type)
end

def resolve api_map, name_pin, locals

def resolve api_map, name_pin, locals
  if api_map.super_and_sub?(@complex_type.name, @literal_type.name)
    [Pin::ProxyType.anonymous(@literal_type)]
  else
    # we don't support this value as a literal type

    [Pin::ProxyType.anonymous(@complex_type)]
  end
end

def word

def word
  @word ||= "<#{@type}>"
end