読者です 読者をやめる 読者になる 読者になる

コードハイライティング

(**
  Typing Ruby - a type checking tool for Ruby programs
  
     Copyright (C) 2006 Soutaro Matsumoto

  This program is free software; you can redistribute it and/or
  modify it under the terms of the GNU General Public License
  as published by the Free Software Foundation; either version 2
  of the License, or (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
**)

open ExtLib

open Types
open Typing_core

let fresh_asttype_type mono_vars self ty =
  match ty with
      Rbi_ast.Tvar _ -> fresh_poly_type()
    | Rbi_ast.Tivar x -> List.assoc x mono_vars
    | Rbi_ast.Tname _ -> fresh_poly_type()
    | Rbi_ast.Tself -> self
    | Rbi_ast.Tany -> fresh_poly_type()

let fresh_method_type mono_vars self ups =
  let f = fresh_asttype_type mono_vars self in
  match ups with
      Rbi_ast.Ufun(xs, y) -> FunType(List.map f xs, f y)
    | Rbi_ast.Uiter(a, b, c, d) ->
        let ft1 = FunType(List.map f a, f d) in
        let ft2 = FunType(List.map f b, f c) in
          IterType(ft1,ft2)

おおーーーー