Class: TypeProf::Core::Block

Inherits:
Object
  • Object
show all
Defined in:
lib/typeprof/core/env/method.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(node, f_ary_arg, f_args, next_boxes) ⇒ Block

: (AST::CallBaseNode, Vertex, Array, Array) -> void



428
429
430
431
432
433
# File 'lib/typeprof/core/env/method.rb', line 428

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

Instance Attribute Details

#f_argsObject (readonly)

Returns the value of attribute f_args.



435
436
437
# File 'lib/typeprof/core/env/method.rb', line 435

def f_args
  @f_args
end

#next_boxesObject (readonly)

Returns the value of attribute next_boxes.



435
436
437
# File 'lib/typeprof/core/env/method.rb', line 435

def next_boxes
  @next_boxes
end

#nodeObject (readonly)

Returns the value of attribute node.



435
436
437
# File 'lib/typeprof/core/env/method.rb', line 435

def node
  @node
end

Instance Method Details

#accept_args(genv, changes, caller_positionals) ⇒ Object



437
438
439
440
441
442
443
444
445
# File 'lib/typeprof/core/env/method.rb', line 437

def accept_args(genv, changes, caller_positionals)
  if caller_positionals.size == 1 && @f_args.size >= 2
    changes.add_edge(genv, caller_positionals[0], @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
end

#add_ret(genv, changes, ret) ⇒ Object



447
448
449
450
451
# File 'lib/typeprof/core/env/method.rb', line 447

def add_ret(genv, changes, ret)
  @next_boxes.each do |box|
    changes.add_edge(genv, box.a_ret, ret)
  end
end