class TypeProf::TypedBlock

Attributes

msig[R]
ret_ty[R]

Public Class Methods

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

Public Instance Methods

consistent?(other) click to toggle source
# File typeprof-0.21.9/lib/typeprof/block.rb, line 77
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:, replace_cref:, &ctn) click to toggle source
# File typeprof-0.21.9/lib/typeprof/block.rb, line 91
def do_call(aargs, caller_ep, caller_env, scratch, replace_recv_ty:, replace_cref:, &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 compatible to RBS block")
  end
  # check?
  #subst = { Type::Var.new(:self) => caller_env.static_env.recv_ty }
  # XXX: Update type vars
  ret_ty = @ret_ty.remove_type_vars
  ctn[ret_ty, caller_ep, caller_env]
end
substitute(subst, depth) click to toggle source
# File typeprof-0.21.9/lib/typeprof/block.rb, line 85
def substitute(subst, depth)
  msig = @msig.substitute(subst, depth)
  ret_ty = @ret_ty.substitute(subst, depth)
  TypedBlock.new(msig, ret_ty)
end