Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/vis12/src/compiler/typechecker/util.sml
ViewVC logotype

Diff of /branches/vis12/src/compiler/typechecker/util.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1974, Sun Jul 15 22:59:41 2012 UTC revision 1975, Mon Jul 16 01:01:19 2012 UTC
# Line 26  Line 26 
26    (* attempt to match a list of parameter types with a list of typed arguments.  Return    (* attempt to match a list of parameter types with a list of typed arguments.  Return
27     * the arguments with any required coercions, or NONE on failure.     * the arguments with any required coercions, or NONE on failure.
28     *)     *)
29        val matchArgs : Types.ty list * AST.expr list * Types.ty list -> AST.expr list option
30      val tryMatchArgs : Types.ty list * AST.expr list * Types.ty list -> AST.expr list option      val tryMatchArgs : Types.ty list * AST.expr list * Types.ty list -> AST.expr list option
31    
32      val equalType : Types.ty * Types.ty -> bool      val equalType : Types.ty * Types.ty -> bool
# Line 221  Line 222 
222    (* attempt to match a list of parameter types with a list of typed arguments.  Return    (* attempt to match a list of parameter types with a list of typed arguments.  Return
223     * the arguments with any required coercions, or NONE on failure.     * the arguments with any required coercions, or NONE on failure.
224     *)     *)
225      fun tryMatchArgs (paramTys, args, argTys) = let      local
226            val pl = ref[]        fun matchArgs' (pl, paramTys, args, argTys) = let
227            fun matchArgTys ([], [], [], args') = SOME(List.rev args')            fun matchArgTys ([], [], [], args') = SOME(List.rev args')
228              | matchArgTys (ty1::tys1, arg::args, ty2::tys2, args') = (              | matchArgTys (ty1::tys1, arg::args, ty2::tys2, args') = (
229                  case unifyTypeWithCoercion (pl, ty1, ty2)                  case unifyTypeWithCoercion (pl, ty1, ty2)
# Line 233  Line 234 
234            in            in
235              matchArgTys (paramTys, args, argTys, [])              matchArgTys (paramTys, args, argTys, [])
236            end            end
237        in
238        fun matchArgs (paramTys, args, argTys) = matchArgs' (ref[], paramTys, args, argTys)
239        fun tryMatchArgs (paramTys, args, argTys) = let
240              val pl = ref[]
241              in
242                case matchArgs' (ref[], paramTys, args, argTys)
243                 of NONE => (undo pl; NONE)
244                  | someResult => someResult
245                (* end case *)
246              end
247        end
248    
249    (* rebind equalDim without patch-list argument *)    (* rebind equalDim without patch-list argument *)
250      val equalDim = fn (d1, d2) => equalDim(ref [], d1, d2)      val equalDim = fn (d1, d2) => equalDim(ref [], d1, d2)

Legend:
Removed from v.1974  
changed lines
  Added in v.1975

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0