Class: TypeProf::Type::Cell
| Relationships & Source Files | |
| Namespace Children | |
| 
       Classes: 
      
     | |
| Super Chains via Extension / Inclusion / Inheritance | |
| 
         Class Chain: 
        
          self,
           
      ContainerType,
          ::TypeProf::Type
         | 
    |
| 
         Instance Chain: 
        
       | 
    |
| Inherits: | 
        TypeProf::Type::ContainerType
        
  | 
    
| Defined in: | lib/typeprof/container-type.rb | 
Overview
The most basic container type for default type parameter class
Constant Summary
::TypeProf::Type - Inherited
  
Class Method Summary
Instance Attribute Summary
- #base_type readonly
 - #elems readonly
 
Instance Method Summary
- #generate_substitution
 - #inspect
 - #limit_size(limit)
 - #localize(env, alloc_site, depth)
 - #method_dispatch_info
 - #screen_name(scratch)
 - #substitute(subst, depth)
 
ContainerType - Inherited
::TypeProf::Type - Inherited
Constructor Details
    .new(elems, base_type)  ⇒ Cell 
  
Instance Attribute Details
#base_type (readonly)
[ GitHub ]# File 'lib/typeprof/container-type.rb', line 68
attr_reader :elems, :base_type
#elems (readonly)
[ GitHub ]# File 'lib/typeprof/container-type.rb', line 68
attr_reader :elems, :base_type
Instance Method Details
#generate_substitution
[ GitHub ]# File 'lib/typeprof/container-type.rb', line 106
def generate_substitution subst = {} tyvars = @base_type.klass.type_params.map {|name,| Type::Var.new(name) } tyvars.zip(@elems.elems) do |tyvar, elem| if subst[tyvar] subst[tyvar] = subst[tyvar].union(elem) else subst[tyvar] = elem end end subst end
#inspect
[ GitHub ]# File 'lib/typeprof/container-type.rb', line 70
def inspect "Type::Cell[#{ @elems.inspect }, base_type: #{ @base_type.inspect }]" end
#limit_size(limit)
[ GitHub ]#localize(env, alloc_site, depth)
[ GitHub ]# File 'lib/typeprof/container-type.rb', line 82
def localize(env, alloc_site, depth) return env, Type.any if depth <= 0 alloc_site = alloc_site.add_id(:cell).add_id(@base_type) env, elems = @elems.localize(env, alloc_site, depth) ty = Local.new(Cell, alloc_site, @base_type) env = env.deploy_type(alloc_site, elems) return env, ty end
#method_dispatch_info
[ GitHub ]# File 'lib/typeprof/container-type.rb', line 96
def method_dispatch_info raise end
#screen_name(scratch)
[ GitHub ]# File 'lib/typeprof/container-type.rb', line 74
def screen_name(scratch) str = @elems.screen_name(scratch) if str.start_with?("*") str = @base_type.screen_name(scratch) + str[1..] end str end