class Steep::AST::Node::TypeAssertion

def self.parse(location)

def self.parse(location)
  if location.source =~/\A:\s*(.+)/
    TypeAssertion.new(location)
  end
end

def initialize(location)

def initialize(location)
  @location = location
end

def line

def line
  location.start_line
end

def source

def source
  location.source
end

def type(context, factory, type_vars)

def type(context, factory, type_vars)
  if ty = RBS::Parser.parse_type(type_location.buffer, range: type_location.range, variables: type_vars)
    ty = factory.type(ty)
    factory.absolute_type(ty, context: context)
  else
    nil
  end
rescue ::RBS::ParsingError => exn
  exn
end

def type?(context, factory, type_vars)

def type?(context, factory, type_vars)
  case type = type(context, factory, type_vars)
  when RBS::ParsingError
    nil
  else
    type
  end
end

def type_location

def type_location
  offset = source.size - type_str.size
  RBS::Location.new(location.buffer, location.start_pos + offset, location.end_pos)
end

def type_str

def type_str
  @type_str ||= source.delete_prefix(":").lstrip
end