Class: TypeProf::Type::Cell::Elements
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Instance Chain:
|
|
Inherits: | Object |
Defined in: | lib/typeprof/container-type.rb |
Overview
Class Method Summary
- .dummy_elements
- .new(elems) ⇒ Elements constructor
Instance Attribute Summary
- #elems readonly
Instance Method Summary
- #[](idx)
- #each_free_type_variable(&blk)
- #globalize(env, visited, depth)
- #include_untyped?(scratch) ⇒ Boolean
- #limit_size(limit)
- #localize(env, alloc_site, depth)
- #match?(other) ⇒ Boolean
- #pretty_print(q)
- #screen_name(scratch)
- #substitute(subst, depth)
- #to_local_type(id, base_ty)
- #union(other)
- #update(idx, ty)
Constructor Details
.new(elems) ⇒ Elements
Class Method Details
.dummy_elements
[ GitHub ]# File 'lib/typeprof/container-type.rb', line 126
def self.dummy_elements Elements.new([]) # XXX end
Instance Attribute Details
#elems (readonly)
[ GitHub ]# File 'lib/typeprof/container-type.rb', line 130
attr_reader :elems
Instance Method Details
#[](idx)
[ GitHub ]# File 'lib/typeprof/container-type.rb', line 186
def [](idx) @elems[idx] end
#each_free_type_variable(&blk)
[ GitHub ]# File 'lib/typeprof/container-type.rb', line 176
def each_free_type_variable(&blk) @elems.each do |ty| ty.each_free_type_variable(&blk) end end
#globalize(env, visited, depth)
[ GitHub ]# File 'lib/typeprof/container-type.rb', line 136
def globalize(env, visited, depth) Elements.new(@elems.map {|ty| ty.globalize(env, visited, depth) }) end
#include_untyped?(scratch) ⇒ Boolean
# File 'lib/typeprof/container-type.rb', line 206
def include_untyped?(scratch) return @elems.any? {|ty| ty.include_untyped?(scratch) } end
#limit_size(limit)
[ GitHub ]# File 'lib/typeprof/container-type.rb', line 149
def limit_size(limit) Elements.new(@elems.map {|ty| ty.limit_size(limit) }) end
#localize(env, alloc_site, depth)
[ GitHub ]
#match?(other) ⇒ Boolean
#pretty_print(q)
[ GitHub ]# File 'lib/typeprof/container-type.rb', line 157
def pretty_print(q) q.group(9, "Elements[", "]") do q.seplist(@elems) do |elem| q.pp elem end end end
#screen_name(scratch)
[ GitHub ]# File 'lib/typeprof/container-type.rb', line 153
def screen_name(scratch) "*[#{ @elems.map {|ty| ty.screen_name(scratch) }.join(", ") }]" end
#substitute(subst, depth)
[ GitHub ]# File 'lib/typeprof/container-type.rb', line 182
def substitute(subst, depth) Elements.new(@elems.map {|ty| ty.substitute(subst, depth) }) end
#to_local_type(id, base_ty)
[ GitHub ]#union(other)
[ GitHub ]#update(idx, ty)
[ GitHub ]# File 'lib/typeprof/container-type.rb', line 190
def update(idx, ty) Elements.new(Utils.array_update(@elems, idx, @elems[idx].union(ty))) end