diff src/mono_util.sml @ 1845:c1e3805e604e

Make Scriptcheck catch more script/message-passing uses, and move the phase earlier in compilation
author Adam Chlipala <adam@chlipala.net>
date Fri, 15 Mar 2013 16:09:55 -0400
parents 38297294cf98
children 8958b580d026
line wrap: on
line diff
--- a/src/mono_util.sml	Tue Mar 12 16:21:20 2013 -0400
+++ b/src/mono_util.sml	Fri Mar 15 16:09:55 2013 -0400
@@ -664,9 +664,9 @@
     let
         val mfd = Decl.mapfoldB all
 
-        fun mff ctx ds =
+        fun mff ctx (ds, ps) =
             case ds of
-                nil => S.return2 nil
+                nil => S.return2 (nil, ps)
               | d :: ds' =>
                 S.bind2 (mfd ctx d,
                          fn d' =>
@@ -705,9 +705,9 @@
                                       | DPolicy _ => ctx
                                       | DOnError _ => ctx
                             in
-                                S.map2 (mff ctx' ds',
-                                     fn ds' =>
-                                        d' :: ds')
+                                S.map2 (mff ctx' (ds', ps),
+                                     fn (ds', _) =>
+                                        (d' :: ds', ps))
                             end)
     in
         mff
@@ -741,27 +741,28 @@
         S.Continue (_, s) => s
       | S.Return _ => raise Fail "MonoUtil.File.fold: Impossible"
 
-val maxName = foldl (fn ((d, _) : decl, count) =>
-                        case d of
-                            DDatatype dts =>
-                            foldl (fn ((_, n, ns), count) =>
-                                      foldl (fn ((_, n', _), m) => Int.max (n', m))
-                                            (Int.max (n, count)) ns) count dts
-                          | DVal (_, n, _, _, _) => Int.max (n, count)
-                          | DValRec vis => foldl (fn ((_, n, _, _, _), count) => Int.max (n, count)) count vis
-                          | DExport _ => count
-                          | DTable _ => count
-                          | DSequence _ => count
-                          | DView _ => count
-                          | DDatabase _ => count
-                          | DJavaScript _ => count
-                          | DCookie _ => count
-                          | DStyle _ => count
-                          | DTask _ => count
-                          | DPolicy _ => count
-                          | DOnError _ => count) 0
+fun maxName (f : file) =
+    foldl (fn ((d, _) : decl, count) =>
+              case d of
+                  DDatatype dts =>
+                  foldl (fn ((_, n, ns), count) =>
+                            foldl (fn ((_, n', _), m) => Int.max (n', m))
+                                  (Int.max (n, count)) ns) count dts
+                | DVal (_, n, _, _, _) => Int.max (n, count)
+                | DValRec vis => foldl (fn ((_, n, _, _, _), count) => Int.max (n, count)) count vis
+                | DExport _ => count
+                | DTable _ => count
+                | DSequence _ => count
+                | DView _ => count
+                | DDatabase _ => count
+                | DJavaScript _ => count
+                | DCookie _ => count
+                | DStyle _ => count
+                | DTask _ => count
+                | DPolicy _ => count
+                | DOnError _ => count) 0 (#1 f)
 
-fun appLoc f =
+fun appLoc f (fl : file) =
     let
         val eal = Exp.appLoc f
 
@@ -790,7 +791,7 @@
               | PolUpdate e1 => eal e1
               | PolSequence e1 => eal e1
     in
-        app appl
+        app appl (#1 fl)
     end
 
 end