class TypeProf::Core::CRef

Constants

Toplevel

Attributes

cpath[R]
mid[R]
outer[R]
scope_level[R]

Public Class Methods

new(cpath, scope_level, mid, outer) click to toggle source
# File typeprof-0.30.1/lib/typeprof/core/env.rb, line 341
def initialize(cpath, scope_level, mid, outer)
  @cpath = cpath
  @scope_level = scope_level
  @mid = mid
  @outer = outer
end

Public Instance Methods

get_self(genv) click to toggle source
# File typeprof-0.30.1/lib/typeprof/core/env.rb, line 350
def get_self(genv)
  case @scope_level
  when :instance
    mod = genv.resolve_cpath(@cpath || [])
    type_params = mod.type_params.map {|ty_param| Source.new() } # TODO: better support
    ty = Type::Instance.new(genv, mod, type_params)
    Source.new(ty)
  when :class
    Source.new(Type::Singleton.new(genv, genv.resolve_cpath(@cpath || [])))
  else
    Source.new()
  end
end