Class: Steep::Locator::TypeAssertionResult

Inherits:
Data
  • Object
show all
Includes:
TypeNameLocator
Defined in:
lib/steep/locator.rb,
lib/steep/locator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from TypeNameLocator

#type_name_at

Instance Attribute Details

#assertionObject (readonly)

Returns the value of attribute assertion

Returns:

  • (Object)

    the current value of assertion



30
31
32
# File 'lib/steep/locator.rb', line 30

def assertion
  @assertion
end

#nodeObject (readonly)

Returns the value of attribute node

Returns:

  • (Object)

    the current value of node



30
31
32
# File 'lib/steep/locator.rb', line 30

def node
  @node
end

Instance Method Details

#locate_type_name(position, nesting, subtyping, type_vars) ⇒ Object



47
48
49
50
51
52
53
54
55
56
# File 'lib/steep/locator.rb', line 47

def locate_type_name(position, nesting, subtyping, type_vars)
  if type = assertion.rbs_type(nesting, subtyping, type_vars)
    location = type.location or raise
    if location.start_pos <= position && position <= location.end_pos
      if loc = type_name_at(position, type)
        return loc
      end
    end
  end
end