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.
370 371 372 373 374 375 |
# File 'lib/typeprof/core/env.rb', line 370 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.
377 378 379 |
# File 'lib/typeprof/core/env.rb', line 377 def cpath @cpath end |
#mid ⇒ Object (readonly)
Returns the value of attribute mid.
377 378 379 |
# File 'lib/typeprof/core/env.rb', line 377 def mid @mid end |
#outer ⇒ Object (readonly)
Returns the value of attribute outer.
377 378 379 |
# File 'lib/typeprof/core/env.rb', line 377 def outer @outer end |
#scope_level ⇒ Object (readonly)
Returns the value of attribute scope_level.
377 378 379 |
# File 'lib/typeprof/core/env.rb', line 377 def scope_level @scope_level end |
Instance Method Details
#get_self(genv) ⇒ Object
379 380 381 382 383 384 385 386 387 388 389 390 391 |
# File 'lib/typeprof/core/env.rb', line 379 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 |