# File lib/type_checker.rb, line 616 def process_if(exp) cond_exp = process exp.shift then_exp = process exp.shift else_exp = process exp.shift rescue nil # might be empty cond_exp.sexp_type.unify Type.bool begin then_exp.sexp_type.unify else_exp.sexp_type unless then_exp.nil? or else_exp.nil? rescue TypeError => err puts "Error unifying #{then_exp.inspect} with #{else_exp.inspect}" raise end # FIX: at least document this type = then_exp.sexp_type unless then_exp.nil? type = else_exp.sexp_type unless else_exp.nil? return t(:if, cond_exp, then_exp, else_exp, type) end