Mercurial > urweb
diff src/iflow.sml @ 1224:3950cf1f5736
Complete update records with fields that are not being set
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 11 Apr 2010 13:18:32 -0400 |
parents | 62af4cacd191 |
children | df5bd4115267 |
line wrap: on
line diff
--- a/src/iflow.sml Sun Apr 11 13:11:25 2010 -0400 +++ b/src/iflow.sml Sun Apr 11 13:18:32 2010 -0400 @@ -1834,6 +1834,8 @@ end +val tabs = ref (SM.empty : string list SM.map) + fun evalExp env (e as (_, loc), st) = let fun default () = @@ -2139,6 +2141,16 @@ end) st fs + val fs' = case SM.find (!tabs, "uw_" ^ tab) of + NONE => raise Fail "Iflow.evalExp: Updating unknown table" + | SOME fs' => fs' + + val fs = foldl (fn (f, fs) => + if List.exists (fn (f', _) => f' = f) fs then + fs + else + (f, Proj (Var old, f)) :: fs) fs fs' + val (p, st) = case expIn (e, st) of (inl e, _) => raise Fail "Iflow.evalExp: UPDATE with non-boolean" | (inr p, st) => (p, st) @@ -2188,7 +2200,10 @@ fun decl ((d, _), (vals, inserts, deletes, updates, client, insert, delete, update)) = case d of - DVal (_, n, _, e, _) => + DTable (tab, fs, _, _) => + (tabs := SM.insert (!tabs, tab, map #1 fs); + (vals, inserts, deletes, updates, client, insert, delete, update)) + | DVal (_, n, _, e, _) => let val isExptd = IS.member (exptd, n) @@ -2248,6 +2263,7 @@ val (vals, inserts, deletes, updates, client, insert, delete, update) = foldl decl ([], [], [], [], [], [], [], []) file + val decompH = decomp true (fn (e1, e2) => e1 andalso e2 ()) val decompG = decomp false (fn (e1, e2) => e1 orelse e2 ())