summaryrefslogtreecommitdiff
path: root/src/iflow.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2010-04-11 13:18:32 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2010-04-11 13:18:32 -0400
commit750ee01b9760664192e6ff63d221033b141c3d70 (patch)
tree32a8aaf7ec1b100f9591506d79c4408b313401ad /src/iflow.sml
parent30b7dba0eaa5a961ded15729ba64bbf67ce8903e (diff)
Complete update records with fields that are not being set
Diffstat (limited to 'src/iflow.sml')
-rw-r--r--src/iflow.sml18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/iflow.sml b/src/iflow.sml
index 564cd20b..f9b7cf08 100644
--- a/src/iflow.sml
+++ b/src/iflow.sml
@@ -1834,6 +1834,8 @@ fun addUpdate (t : t, c) = {Var = #Var t,
end
+val tabs = ref (SM.empty : string list SM.map)
+
fun evalExp env (e as (_, loc), st) =
let
fun default () =
@@ -2139,6 +2141,16 @@ fun evalExp env (e as (_, loc), st) =
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 check file =
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 @@ fun check file =
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 ())