Class: TypeProf::Type::Hash
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 |
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) ⇒ Hash
Instance Attribute Details
#base_type (readonly)
[ GitHub ]# File 'lib/typeprof/container-type.rb', line 568
attr_reader :elems, :base_type
#elems (readonly)
[ GitHub ]# File 'lib/typeprof/container-type.rb', line 568
attr_reader :elems, :base_type
Instance Method Details
#generate_substitution
[ GitHub ]# File 'lib/typeprof/container-type.rb', line 602
def generate_substitution tyvar_k = Type::Var.new(:K) tyvar_v = Type::Var.new(:V) k_ty0, v_ty0 = @elems.squash # XXX: need to heuristically replace ret type Hash[K, V] with self, instead of conversative type? { tyvar_k => k_ty0, tyvar_v => v_ty0 } end
#inspect
[ GitHub ]# File 'lib/typeprof/container-type.rb', line 570
def inspect "Type::Hash#{ @elems.inspect }" end
#limit_size(limit)
[ GitHub ]#localize(env, alloc_site, depth)
[ GitHub ]# File 'lib/typeprof/container-type.rb', line 578
def localize(env, alloc_site, depth) return env, Type.any if depth <= 0 alloc_site = alloc_site.add_id(:hash).add_id(@base_type) env, elems = @elems.localize(env, alloc_site, depth - 1) ty = Local.new(Hash, 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 592
def method_dispatch_info raise end
#screen_name(scratch)
[ GitHub ]# File 'lib/typeprof/container-type.rb', line 574
def screen_name(scratch) @elems.screen_name(scratch) end