class TypedRb::Types::TyTopLevelObject

Public Class Methods

new() click to toggle source
Calls superclass method TypedRb::Types::TyObject::new
# File lib/typed/types/ty_top_level_object.rb, line 4
def initialize
  super(TOPLEVEL_BINDING.receiver.class)
end

Public Instance Methods

as_object_type() click to toggle source
# File lib/typed/types/ty_top_level_object.rb, line 12
def as_object_type
  self
end
compatible?(_other_type) click to toggle source
# File lib/typed/types/ty_top_level_object.rb, line 8
def compatible?(_other_type)
  fail StandardError, 'invoking compatible? in the top level object'
end
find_function_type(message, num_args, block) click to toggle source
# File lib/typed/types/ty_top_level_object.rb, line 16
def find_function_type(message, num_args, block)
  found_type = select_matching_function_in_class(:main, :instance, message, num_args, block)
  if found_type && !found_type.is_a?(TyDynamicFunction)
    [:main, found_type]
  else
    TyObject.new(ruby_type, node).find_function_type(message, num_args, block)
  end
end
find_var_type(var) click to toggle source
Calls superclass method TypedRb::Types::TyObject#find_var_type
# File lib/typed/types/ty_top_level_object.rb, line 25
def find_var_type(var)
  super(var, :main)
end
resolve_ruby_method(message) click to toggle source
# File lib/typed/types/ty_top_level_object.rb, line 29
def resolve_ruby_method(message)
  @ruby_type.method(message)
end
to_s() click to toggle source
# File lib/typed/types/ty_top_level_object.rb, line 33
def to_s
  'Object[\'main\']'
end