Mercurial > urweb
changeset 2252:e843a04499d4
Revert to revision 2222.
author | Ziv Scully <ziv@mit.edu> |
---|---|
date | Mon, 21 Sep 2015 10:16:55 -0400 |
parents | 25874084bf1f |
children | d665925acff8 |
files | src/cjrize.sml src/dbmodecheck.sml src/fuse.sml src/iflow.sml src/jscomp.sml src/mono.sml src/mono_print.sml src/mono_reduce.sml src/mono_shake.sml src/mono_util.sml src/monoize.sml src/name_js.sml src/pathcheck.sml src/scriptcheck.sml src/sigcheck.sml src/sqlcache.sml src/untangle.sml |
diffstat | 17 files changed, 56 insertions(+), 55 deletions(-) [+] |
line wrap: on
line diff
--- a/src/cjrize.sml Sun Sep 13 17:02:17 2015 -0400 +++ b/src/cjrize.sml Mon Sep 21 10:16:55 2015 -0400 @@ -701,7 +701,7 @@ | L.DPolicy _ => (NONE, NONE, sm) | L.DOnError n => (SOME (L'.DOnError n, loc), NONE, sm) -fun cjrize {decls = ds, sideInfo} = +fun cjrize (ds, sideInfo) = let val (dsF, ds, ps, sm) = foldl (fn (d, (dsF, ds, ps, sm)) => let
--- a/src/dbmodecheck.sml Sun Sep 13 17:02:17 2015 -0400 +++ b/src/dbmodecheck.sml Mon Sep 21 10:16:55 2015 -0400 @@ -16,7 +16,7 @@ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN @@ -31,7 +31,7 @@ structure IM = IntBinaryMap -fun classify {decls = ds, sideInfo = ps} = +fun classify (ds, ps) = let fun mergeModes (m1, m2) = case (m1, m2) of @@ -79,7 +79,8 @@ val ps = IM.foldli (fn (n, mode, ps) => (n, ServerOnly, mode) :: ps) ps modes in - {decls = ds, sideInfo = ps} + (ds, ps) end end +
--- a/src/fuse.sml Sun Sep 13 17:02:17 2015 -0400 +++ b/src/fuse.sml Mon Sep 21 10:16:55 2015 -0400 @@ -16,7 +16,7 @@ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN @@ -139,14 +139,14 @@ in (U.Decl.map {typ = fn x => x, exp = exp, - decl = fn x => x} + decl = fn x => x} d, (funcs, maxName)) end - val (ds, _) = ListUtil.foldlMap doDecl (IM.empty, U.File.maxName file + 1) (#decls file) + val (ds, _) = ListUtil.foldlMap doDecl (IM.empty, U.File.maxName file + 1) (#1 file) in - {decls = ds, sideInfo = #sideInfo file} + (ds, #2 file) end end
--- a/src/iflow.sml Sun Sep 13 17:02:17 2015 -0400 +++ b/src/iflow.sml Mon Sep 21 10:16:55 2015 -0400 @@ -1900,7 +1900,7 @@ val exptd = foldl (fn ((d, _), exptd) => case d of DExport (_, _, n, _, _, _) => IS.add (exptd, n) - | _ => exptd) IS.empty (#decls file) + | _ => exptd) IS.empty (#1 file) fun decl (d, loc) = case d of @@ -2164,7 +2164,7 @@ | _ => () in - app decl (#decls file) + app decl (#1 file) end val check = fn file =>
--- a/src/jscomp.sml Sun Sep 13 17:02:17 2015 -0400 +++ b/src/jscomp.sml Mon Sep 21 10:16:55 2015 -0400 @@ -79,7 +79,7 @@ someTs) someTs dts, nameds) | (_, state) => state) - (IM.empty, IM.empty) (#decls file) + (IM.empty, IM.empty) (#1 file) fun str loc s = (EPrim (Prim.String (Prim.Normal, s)), loc) @@ -1335,7 +1335,7 @@ listInjectors = TM.empty, decoders = IM.empty, maxName = U.File.maxName file + 1} - (#decls file) + (#1 file) val inf = TextIO.openIn (OS.Path.joinDirFile {dir = Settings.libJs (), file = "urweb.js"}) fun lines acc = @@ -1365,7 +1365,7 @@ "" in TextIO.closeIn inf; - {decls = (DJavaScript script, ErrorMsg.dummySpan) :: ds, sideInfo = #sideInfo file} + ((DJavaScript script, ErrorMsg.dummySpan) :: ds, #2 file) end end
--- a/src/mono.sml Sun Sep 13 17:02:17 2015 -0400 +++ b/src/mono.sml Mon Sep 21 10:16:55 2015 -0400 @@ -168,6 +168,6 @@ | OneQuery | AnyDb -type file = {decls : decl list, sideInfo : (int * sidedness * dbmode) list} +type file = decl list * (int * sidedness * dbmode) list end
--- a/src/mono_print.sml Sun Sep 13 17:02:17 2015 -0400 +++ b/src/mono_print.sml Mon Sep 21 10:16:55 2015 -0400 @@ -542,12 +542,12 @@ p_policy env p] | DOnError _ => string "ONERROR" -fun p_file env (file : file) = +fun p_file env (file, _) = let val (pds, _) = ListUtil.foldlMap (fn (d, env) => (p_decl env d, E.declBinds env d)) - env (#decls file) + env file in p_list_sep newline (fn x => x) pds end
--- a/src/mono_reduce.sml Sun Sep 13 17:02:17 2015 -0400 +++ b/src/mono_reduce.sml Mon Sep 21 10:16:55 2015 -0400 @@ -16,7 +16,7 @@ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN @@ -390,7 +390,7 @@ absCounts vis) | _ => (timpures, impures, absCounts) end) - (IS.empty, IS.empty, IM.empty) (#decls file) + (IS.empty, IS.empty, IM.empty) (#1 file) val uses = U.File.fold {typ = fn (_, m) => m, exp = fn (e, m) => @@ -406,7 +406,7 @@ val functionInside' = U.Typ.exists (fn c => case c of TFun _ => true | _ => false) - + fun functionInside t = case #1 t of TFun (t1, t2) => functionInside' t1 orelse functionInside t2 @@ -520,7 +520,7 @@ | ERedirect (e, _) => summarize d e @ [Abort] | EWrite e => summarize d e @ [WritePage] - + | ESeq (e1, e2) => summarize d e1 @ summarize d e2 | ELet (_, _, e1, e2) => summarize d e1 @ summarize (if d = ~1 then ~1 else d + 1) e2
--- a/src/mono_shake.sml Sun Sep 13 17:02:17 2015 -0400 +++ b/src/mono_shake.sml Mon Sep 21 10:16:55 2015 -0400 @@ -16,7 +16,7 @@ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN @@ -60,7 +60,7 @@ | ((DTask _, _), acc) => acc | ((DPolicy _, _), acc) => acc | ((DOnError _, _), acc) => acc) - (IM.empty, IM.empty) (#decls file) + (IM.empty, IM.empty) (#1 file) fun typ (c, s) = case c of @@ -130,7 +130,7 @@ usedVars st e1 end | ((DOnError n, _), (page_cs, page_es)) => (page_cs, IS.add (page_es, n)) - | (_, st) => st) (IS.empty, IS.empty) (#decls file) + | (_, st) => st) (IS.empty, IS.empty) (#1 file) val s = {con = page_cs, exp = page_es} @@ -145,8 +145,7 @@ NONE => raise Fail "MonoShake: Couldn't find 'val'" | SOME (t, e) => shakeExp s e) s page_es in - {decls = - List.filter (fn (DDatatype dts, _) => List.exists (fn (_, n, _) => IS.member (#con s, n)) dts + (List.filter (fn (DDatatype dts, _) => List.exists (fn (_, n, _) => IS.member (#con s, n)) dts | (DVal (_, n, _, _, _), _) => IS.member (#exp s, n) | (DValRec vis, _) => List.exists (fn (_, n, _, _, _) => IS.member (#exp s, n)) vis | (DExport _, _) => true @@ -159,7 +158,7 @@ | (DStyle _, _) => true | (DTask _, _) => true | (DPolicy _, _) => true - | (DOnError _, _) => true) (#decls file), sideInfo = #sideInfo file} + | (DOnError _, _) => true) (#1 file), #2 file) end end
--- a/src/mono_util.sml Sun Sep 13 17:02:17 2015 -0400 +++ b/src/mono_util.sml Mon Sep 21 10:16:55 2015 -0400 @@ -695,9 +695,9 @@ let val mfd = Decl.mapfoldB all - fun mff ctx (file : file) = - case #decls file of - nil => S.return2 {decls = nil, sideInfo = #sideInfo file} + fun mff ctx (ds, ps) = + case ds of + nil => S.return2 (nil, ps) | d :: ds' => S.bind2 (mfd ctx d, fn d' => @@ -736,9 +736,9 @@ | DPolicy _ => ctx | DOnError _ => ctx in - S.map2 (mff ctx' {decls = ds', sideInfo = #sideInfo file}, - fn {decls = ds', ...} => - {decls = d' :: ds', sideInfo = #sideInfo file}) + S.map2 (mff ctx' (ds', ps), + fn (ds', _) => + (d' :: ds', ps)) end) in mff @@ -791,7 +791,7 @@ | DStyle _ => count | DTask _ => count | DPolicy _ => count - | DOnError _ => count) 0 (#decls f) + | DOnError _ => count) 0 (#1 f) fun appLoc f (fl : file) = let @@ -822,7 +822,7 @@ | PolUpdate e1 => eal e1 | PolSequence e1 => eal e1 in - app appl (#decls fl) + app appl (#1 fl) end end
--- a/src/monoize.sml Sun Sep 13 17:02:17 2015 -0400 +++ b/src/monoize.sml Mon Sep 21 10:16:55 2015 -0400 @@ -4786,7 +4786,7 @@ pvars := RM.empty; pvarDefs := []; pvarOldDefs := []; - {decls = rev ds, sideInfo = []} + (rev ds, []) end end
--- a/src/name_js.sml Sun Sep 13 17:02:17 2015 -0400 +++ b/src/name_js.sml Mon Sep 21 10:16:55 2015 -0400 @@ -16,7 +16,7 @@ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN @@ -92,7 +92,7 @@ | DValRec vis => foldl (fn ((_, n, _, _, _), dontName) => IS.add (dontName, n)) dontName vis | _ => dontName else - dontName) IS.empty (#decls file) + dontName) IS.empty (#1 file) val (ds, _) = ListUtil.foldlMapConcat (fn (d, nextName) => let @@ -126,9 +126,9 @@ val vs = freeVars e' val vs = IS.listItems vs - + val x = "script" ^ Int.toString nextName - + val un = (TRecord [], loc) val s = (TFfi ("Basis", "string"), loc) val base = (TFun (un, s), loc) @@ -165,9 +165,9 @@ DValRec vis => [(DValRec (vis @ newDs), #2 d)] | _ => List.revAppend (map (fn vi => (DVal vi, #2 d)) newDs, [d]), nextName) - end) (U.File.maxName file + 1) (#decls file) + end) (U.File.maxName file + 1) (#1 file) in - {decls = ds, sideInfo = #sideInfo file} + (ds, #2 file) end end
--- a/src/pathcheck.sml Sun Sep 13 17:02:17 2015 -0400 +++ b/src/pathcheck.sml Mon Sep 21 10:16:55 2015 -0400 @@ -16,7 +16,7 @@ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN @@ -68,7 +68,7 @@ in case d of DExport (_, s, _, _, _, _) => doFunc s - + | DTable (s, _, pe, ce) => let fun constraints (e, rels) = @@ -110,6 +110,6 @@ | _ => (funcs, rels, cookies, styles) end -fun check (file : file) = ignore (foldl checkDecl (SS.empty, SS.empty, SS.empty, SS.empty) (#decls file)) +fun check (ds, _) = ignore (foldl checkDecl (SS.empty, SS.empty, SS.empty, SS.empty) ds) end
--- a/src/scriptcheck.sml Sun Sep 13 17:02:17 2015 -0400 +++ b/src/scriptcheck.sml Mon Sep 21 10:16:55 2015 -0400 @@ -16,7 +16,7 @@ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN @@ -91,7 +91,7 @@ dump r')) m; print "</Module>\n") -fun classify {decls = ds, sideInfo = ps} = +fun classify (ds, ps) = let val proto = Settings.currentProtocol () @@ -100,7 +100,7 @@ fun hasClient {basis, rpcs, funcs, push} = MonoUtil.Exp.exists {typ = fn _ => false, exp = fn ERecv _ => push - | EFfiApp ("Basis", x, _) => SS.member (basis, x) + | EFfiApp ("Basis", x, _) => SS.member (basis, x) | EJavaScript _ => not push | ENamed n => IS.member (funcs, n) | EServerCall (e, _, _, _) => @@ -175,7 +175,8 @@ else ServerOnly, AnyDb)) (IS.listItems all_ids) in - {decls = ds, sideInfo = ps} + (ds, ps) end end +
--- a/src/sigcheck.sml Sun Sep 13 17:02:17 2015 -0400 +++ b/src/sigcheck.sml Mon Sep 21 10:16:55 2015 -0400 @@ -16,7 +16,7 @@ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN @@ -32,7 +32,7 @@ structure IS = IntBinarySet structure E = ErrorMsg -fun check (file : file) = +fun check (ds, sl) = let fun isSiggy siggers = MonoUtil.Decl.exists {typ = fn _ => false, @@ -89,9 +89,9 @@ (sigify sigdecs d, (siggers, sigdecs)) | _ => (sigify sigdecs d, (siggers, sigdecs)) - val (ds, _) = ListUtil.foldlMap doDecl (IS.empty, IS.empty) (#decls file) + val (ds, _) = ListUtil.foldlMap doDecl (IS.empty, IS.empty) ds in - {decls = ds, sideInfo = #sideInfo file} + (ds, sl) end end
--- a/src/sqlcache.sml Sun Sep 13 17:02:17 2015 -0400 +++ b/src/sqlcache.sml Mon Sep 21 10:16:55 2015 -0400 @@ -101,7 +101,7 @@ end (* TODO: test this. *) -fun effectfulDecls ({decls, ...} : file) = +fun effectfulDecls (decls, _) = let fun doVal ((_, name, _, e, _), effs) = if effectful effs MonoEnv.empty e
--- a/src/untangle.sml Sun Sep 13 17:02:17 2015 -0400 +++ b/src/untangle.sml Mon Sep 21 10:16:55 2015 -0400 @@ -16,7 +16,7 @@ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN @@ -208,7 +208,7 @@ end | _ => [dAll] in - {decls = ListUtil.mapConcat decl (#decls file), sideInfo = #sideInfo file} + (ListUtil.mapConcat decl (#1 file), #2 file) end end