class TypeProf::Core::Block

Attributes

f_args[R]
node[R]
ret[R]

Public Class Methods

new(node, f_ary_arg, f_args, next_boxes) click to toggle source
# File typeprof-0.30.1/lib/typeprof/core/env/method.rb, line 85
def initialize(node, f_ary_arg, f_args, next_boxes)
  @node = node
  @f_ary_arg = f_ary_arg
  @f_args = f_args
  @next_boxes = next_boxes
end

Public Instance Methods

accept_args(genv, changes, caller_positionals, caller_ret, ret_check) click to toggle source
# File typeprof-0.30.1/lib/typeprof/core/env/method.rb, line 94
def accept_args(genv, changes, caller_positionals, caller_ret, ret_check)
  if caller_positionals.size == 1 && @f_args.size >= 2
    # TODO: support splat "do |a, *b, c|"
    changes.add_edge(genv, caller_positionals[0].new_vertex(genv, @node), @f_ary_arg)
  else
    caller_positionals.zip(@f_args) do |a_arg, f_arg|
      changes.add_edge(genv, a_arg, f_arg) if f_arg
    end
  end
  if ret_check
    @next_boxes.each do |box|
      changes.add_edge(genv, caller_ret, box.f_ret)
    end
  else
    @next_boxes.each do |box|
      changes.add_edge(genv, box.a_ret, caller_ret)
    end
  end
end