class TypedRb::Model::TmBreak

Attributes

elements[R]

Public Class Methods

new(elements, node) click to toggle source
Calls superclass method TypedRb::Model::Expr::new
# File lib/typed/model/tm_break.rb, line 7
def initialize(elements, node)
  super(node)
  @elements = elements
end

Public Instance Methods

check_type(context) click to toggle source
# File lib/typed/model/tm_break.rb, line 12
def check_type(context)
  returned_type = if elements.size == 0
                    Types::TyUnit.new(node)
                  elsif elements.size == 1
                    elements.first.check_type(context)
                  else
                    TmArrayLiteral.new(elements, node).check_type(context)
                  end
  Types::TyStackJump.break(returned_type, node)
end