Class: TypeProf::ISeqBlock
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
Block
|
|
Instance Chain:
self,
Block ,
Utils::StructuralEquality
|
|
Inherits: |
TypeProf::Block
|
Defined in: | lib/typeprof/block.rb |
Class Method Summary
- .new(iseq, ep) ⇒ ISeqBlock constructor
Instance Attribute Summary
Instance Method Summary
Constructor Details
.new(iseq, ep) ⇒ ISeqBlock
Instance Attribute Details
#iseq (readonly)
[ GitHub ]# File 'lib/typeprof/block.rb', line 12
attr_reader :iseq, :outer_ep
#outer_ep (readonly)
[ GitHub ]# File 'lib/typeprof/block.rb', line 12
attr_reader :iseq, :outer_ep
Instance Method Details
#consistent?(other) ⇒ Boolean
# File 'lib/typeprof/block.rb', line 18
def consistent?(other) if other.is_a?(ISeqBlock) self == other else true # XXX end end
#do_call(aargs, caller_ep, caller_env, scratch, replace_recv_ty:, replace_cref:, &ctn)
[ GitHub ]# File 'lib/typeprof/block.rb', line 30
def do_call(aargs, caller_ep, caller_env, scratch, replace_recv_ty:, replace_cref:, &ctn) blk_env = scratch.return_envs[@outer_ep] if replace_recv_ty replace_recv_ty = scratch.globalize_type(replace_recv_ty, caller_env, caller_ep) blk_env = blk_env.replace_recv_ty(replace_recv_ty) end aargs = scratch.globalize_type(aargs, caller_env, caller_ep) scratch.add_block_signature!(self, aargs.to_block_signature) locals = [Type.nil] * @iseq.locals.size blk_ty, start_pcs = aargs.setup_formal_arguments(:block, locals, @iseq.fargs_format) if blk_ty.is_a?(String) scratch.error(caller_ep, blk_ty) ctn[Type.any, caller_ep, caller_env] return end cref = replace_cref || @outer_ep.ctx.cref nctx = Context.new(@iseq, cref, nil) callee_ep = ExecutionPoint.new(nctx, 0, @outer_ep) nenv = Env.new(blk_env.static_env, locals, [], nil) alloc_site = AllocationSite.new(callee_ep) locals.each_with_index do |ty, i| alloc_site2 = alloc_site.add_id(i) nenv, ty = scratch.localize_type(ty, nenv, callee_ep, alloc_site2) nenv = nenv.local_update(i, ty) end start_pcs.each do |start_pc| scratch.merge_env(ExecutionPoint.new(nctx, start_pc, @outer_ep), nenv) end scratch.add_block_to_ctx!(self, callee_ep.ctx) scratch.add_callsite!(callee_ep.ctx, caller_ep, caller_env, &ctn) end
#inspect
[ GitHub ]# File 'lib/typeprof/block.rb', line 14
def inspect "#<ISeqBlock: #{ @outer_ep.source_location }>" end
#substitute(_subst, _depth)
[ GitHub ]# File 'lib/typeprof/block.rb', line 26
def substitute(_subst, _depth) self end