aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/mono_util.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2013-03-15 16:09:55 -0400
committerGravatar Adam Chlipala <adam@chlipala.net>2013-03-15 16:09:55 -0400
commit3d21914a4b831ee9c727dd4296e56961c1e4ea89 (patch)
tree23527da3ec268f47015698c307c3d19f5c35b594 /src/mono_util.sml
parent76e5e75ab203b7a8b7701b9d3e496653bd213345 (diff)
Make Scriptcheck catch more script/message-passing uses, and move the phase earlier in compilation
Diffstat (limited to 'src/mono_util.sml')
-rw-r--r--src/mono_util.sml55
1 files changed, 28 insertions, 27 deletions
diff --git a/src/mono_util.sml b/src/mono_util.sml
index 58498996..61638858 100644
--- a/src/mono_util.sml
+++ b/src/mono_util.sml
@@ -664,9 +664,9 @@ fun mapfoldB (all as {bind, ...}) =
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 @@ fun mapfoldB (all as {bind, ...}) =
| 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 @@ fun fold {typ, exp, decl} s d =
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 appLoc f =
+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 (fl : file) =
let
val eal = Exp.appLoc f
@@ -790,7 +791,7 @@ fun appLoc f =
| PolUpdate e1 => eal e1
| PolSequence e1 => eal e1
in
- app appl
+ app appl (#1 fl)
end
end