In Files

  • typeprof-0.12.0/lib/typeprof/block.rb

Class/Module Index [+]

Quicksearch

TypeProf::TypedBlock

Attributes

msig[R]
ret_ty[R]

Public Class Methods

new(msig, ret_ty) click to toggle source
 
               # File typeprof-0.12.0/lib/typeprof/block.rb, line 69
def initialize(msig, ret_ty)
  @msig = msig
  @ret_ty = ret_ty
end
            

Public Instance Methods

consistent?(other) click to toggle source
 
               # File typeprof-0.12.0/lib/typeprof/block.rb, line 76
def consistent?(other)
  if other.is_a?(ISeqBlock)
    raise "assert false"
  else
    self == other
  end
end
            
do_call(aargs, caller_ep, caller_env, scratch, replace_recv_ty:, &ctn) click to toggle source
 
               # File typeprof-0.12.0/lib/typeprof/block.rb, line 90
def do_call(aargs, caller_ep, caller_env, scratch, replace_recv_ty,, &ctn)
  aargs = scratch.globalize_type(aargs, caller_env, caller_ep)
  subst = aargs.consistent_with_method_signature?(@msig)
  unless subst
    scratch.warn(caller_ep, "The arguments is not compatibile to RBS block")
  end
  # check?
  #subst = { Type::Var.new(:self) => caller_env.static_env.recv_ty }
  # XXX: Update type vars
  ctn[@ret_ty, caller_ep, caller_env]
end
            
substitute(subst, depth) click to toggle source
 
               # File typeprof-0.12.0/lib/typeprof/block.rb, line 84
def substitute(subst, depth)
  msig = @msig.substitute(subst, depth)
  ret_ty = @ret_ty.substitute(subst, depth)
  TypedBlock.new(msig, ret_ty)
end