class TypedRb::Model::TmFor
Attributes
body[R]
condition[R]
Public Class Methods
new(condition, body, node)
click to toggle source
Calls superclass method
TypedRb::Model::Expr::new
# File lib/typed/model/tm_for.rb, line 7 def initialize(condition, body, node) super(node) @condition = condition @body = body end
Public Instance Methods
check_type(context)
click to toggle source
# File lib/typed/model/tm_for.rb, line 13 def check_type(context) condition.check_type(context) result_type = body.check_type(context) if result_type.stack_jump? && (result_type.next? || result_type.break?) result_type.wrapped_type.check_type(context) elsif result_type.either? process_either_type(result_type, context) else result_type end end
Private Instance Methods
process_either_type(either_type, context)
click to toggle source
# File lib/typed/model/tm_for.rb, line 27 def process_either_type(either_type, context) return_type = either_type[:return] final_type = either_type.check_type(context, [:normal, :next, :break]) if return_type.nil? final_type else new_either_type = Types::TyEither.new(node) new_either_type[:return] = return_type new_either_type[:normal] = final_type new_either_type end end