Class: TypeProf::Core::CRef
- Inherits:
-
Object
- Object
- TypeProf::Core::CRef
- Defined in:
- lib/typeprof/core/env.rb
Constant Summary collapse
- Toplevel =
self.new([], :instance, nil, nil)
Instance Attribute Summary collapse
-
#cpath ⇒ Object
readonly
Returns the value of attribute cpath.
-
#mid ⇒ Object
readonly
Returns the value of attribute mid.
-
#outer ⇒ Object
readonly
Returns the value of attribute outer.
-
#scope_level ⇒ Object
readonly
Returns the value of attribute scope_level.
Instance Method Summary collapse
- #get_self(genv) ⇒ Object
-
#initialize(cpath, scope_level, mid, outer) ⇒ CRef
constructor
A new instance of CRef.
Constructor Details
#initialize(cpath, scope_level, mid, outer) ⇒ CRef
Returns a new instance of CRef.
341 342 343 344 345 346 |
# File '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 |
Instance Attribute Details
#cpath ⇒ Object (readonly)
Returns the value of attribute cpath.
348 349 350 |
# File 'lib/typeprof/core/env.rb', line 348 def cpath @cpath end |
#mid ⇒ Object (readonly)
Returns the value of attribute mid.
348 349 350 |
# File 'lib/typeprof/core/env.rb', line 348 def mid @mid end |
#outer ⇒ Object (readonly)
Returns the value of attribute outer.
348 349 350 |
# File 'lib/typeprof/core/env.rb', line 348 def outer @outer end |
#scope_level ⇒ Object (readonly)
Returns the value of attribute scope_level.
348 349 350 |
# File 'lib/typeprof/core/env.rb', line 348 def scope_level @scope_level end |
Instance Method Details
#get_self(genv) ⇒ Object
350 351 352 353 354 355 356 357 358 359 360 361 362 |
# File '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 |