[MLton-commit] r6336

Matthew Fluet fluet at mlton.org
Thu Jan 17 09:21:41 PST 2008


Record types of constructors and exceptions for def-use mode
----------------------------------------------------------------------

U   mlton/trunk/mlton/elaborate/elaborate-env.fun

----------------------------------------------------------------------

Modified: mlton/trunk/mlton/elaborate/elaborate-env.fun
===================================================================
--- mlton/trunk/mlton/elaborate/elaborate-env.fun	2008-01-17 13:48:35 UTC (rev 6335)
+++ mlton/trunk/mlton/elaborate/elaborate-env.fun	2008-01-17 17:21:40 UTC (rev 6336)
@@ -1783,31 +1783,28 @@
       ()
    end
 
-fun newCons (T {vals, ...}, v) =
+fun newCons (T {vals, ...}, v) = fn v' =>
    let
       val forceUsed = 1 = Vector.length v
-      val v =
-         Vector.map (v, fn {con, name} =>
-                     let
-                        val uses = NameSpace.newUses (vals, Class.Con,
-                                                      Ast.Vid.fromCon name,
-                                                      [])
-                        val () = 
-                           if not (warnUnused ()) orelse forceUsed
-                              then Uses.forceUsed uses
-                              else ()
-                     in
-                        {con = con,
-                         name = name,
-                         uses = uses}
-                     end)
    in
-      fn v' => Cons.T (Vector.map2
-                       (v, v', fn ({con, name, uses}, scheme) =>
-                        {con = con,
-                         name = name,
-                         scheme = scheme,
-                         uses = uses}))
+      Cons.T (Vector.map2
+              (v, v', fn ({con, name}, scheme) =>
+               let
+                  val uses = NameSpace.newUses (vals, Class.Con,
+                                                Ast.Vid.fromCon name,
+                                                if isSome (!Control.showDefUse)
+                                                   then [(Vid.Con con, SOME scheme)]
+                                                else [])
+                  val () = 
+                     if not (warnUnused ()) orelse forceUsed
+                        then Uses.forceUsed uses
+                     else ()
+               in
+                  {con = con,
+                   name = name,
+                   scheme = scheme,
+                   uses = uses}
+               end))
    end
 
 (* ------------------------------------------------- *)
@@ -2015,7 +2012,11 @@
          let
             val u = NameSpace.newUses (ns, class range, domain,
                                        if isSome (!Control.showDefUse)
-                                          andalso class range = Class.Var
+                                          andalso (class range = Class.Var
+                                                   orelse
+                                                   class range = Class.Exn
+                                                   orelse
+                                                   class range = Class.Con)
                                        then [range]
                                        else [])
             val () = 




More information about the MLton-commit mailing list