# HG changeset patch # User Adam Chlipala # Date 1271006312 14400 # Node ID 3950cf1f5736cfcc868edfebe2491a280fda14df # Parent 62af4cacd1910d3aba1aa5b71dddb044111b4ab3 Complete update records with fields that are not being set diff -r 62af4cacd191 -r 3950cf1f5736 src/iflow.sml --- 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 ())