class TypedRb::Model::TmRescue

Attributes

catch_var[R]
exceptions[R]
rescue_body[R]

Public Class Methods

new(exceptions, catch_var, rescue_body) click to toggle source
# File lib/typed/model/tm_rescue.rb, line 8
def initialize(exceptions, catch_var, rescue_body)
  @exceptions = exceptions
  @catch_var = catch_var
  @rescue_body = rescue_body
end

Public Instance Methods

check_type(context) click to toggle source
# File lib/typed/model/tm_rescue.rb, line 14
def check_type(context)
  if catch_var
    exception_type = exceptions.map{|e| e.check_type(context) }.reduce(&:max)
    context.add_binding!(catch_var, exception_type)
  end
  if rescue_body
    rescue_body.check_type(context)
  else
    Types::TyUnit.new
  end
end