class TypeProf::Core::EscapeBox

Attributes

a_ret[R]
f_ret[R]

Public Class Methods

new(node, genv, a_ret, f_ret) click to toggle source
Calls superclass method TypeProf::Core::Box::new
# File typeprof-0.30.1/lib/typeprof/core/graph/box.rb, line 255
def initialize(node, genv, a_ret, f_ret)
  super(node)
  @a_ret = a_ret.new_vertex(genv, node)
  @f_ret = f_ret
  @f_ret.add_edge(genv, self)
end

Public Instance Methods

ret(= @a_ret) click to toggle source
# File typeprof-0.30.1/lib/typeprof/core/graph/box.rb, line 264
  def ret = @a_ret

  def run0(genv, changes)
    unless @a_ret.check_match(genv, changes, @f_ret)
      msg = "expected: #{ @f_ret.show }; actual: #{ @a_ret.show }"
      case @node
      when AST::ReturnNode
        changes.add_diagnostic(:code_range, msg)
      when AST::DefNode
        changes.add_diagnostic(:last_stmt_code_range, msg)
      when AST::NextNode
        changes.add_diagnostic(:code_range, msg)
      when AST::CallNode
        changes.add_diagnostic(:block_last_stmt_code_range, msg)
      when AST::AttrReaderMetaNode, AST::AttrAccessorMetaNode
        changes.add_diagnostic(:code_range, msg)
      else
        pp @node.class
      end
    end
  end
end
run0(genv, changes) click to toggle source
# File typeprof-0.30.1/lib/typeprof/core/graph/box.rb, line 266
def run0(genv, changes)
  unless @a_ret.check_match(genv, changes, @f_ret)
    msg = "expected: #{ @f_ret.show }; actual: #{ @a_ret.show }"
    case @node
    when AST::ReturnNode
      changes.add_diagnostic(:code_range, msg)
    when AST::DefNode
      changes.add_diagnostic(:last_stmt_code_range, msg)
    when AST::NextNode
      changes.add_diagnostic(:code_range, msg)
    when AST::CallNode
      changes.add_diagnostic(:block_last_stmt_code_range, msg)
    when AST::AttrReaderMetaNode, AST::AttrAccessorMetaNode
      changes.add_diagnostic(:code_range, msg)
    else
      pp @node.class
    end
  end
end