Mercurial > urweb
changeset 1222:117f13bdc1fd
Express all query outputs using record literals
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 11 Apr 2010 12:45:15 -0400 (2010-04-11) |
parents | 00e628854005 |
children | 62af4cacd191 |
files | src/iflow.sml |
diffstat | 1 files changed, 27 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/iflow.sml Sun Apr 11 12:38:21 2010 -0400 +++ b/src/iflow.sml Sun Apr 11 12:45:15 2010 -0400 @@ -1426,21 +1426,34 @@ end | AllCols oe => let - val (p', rvN) = - foldl (fn (si, (p, rvN)) => - let - val (p', rvN) = - case si of - SqField (v, f) => (Reln (Eq, [Proj (Proj (oe, v), f), - Proj (rvOf v, f)]), rvN) - | SqExp (e, f) => + val (ts, es, rvN) = + foldl (fn (si, (ts, es, rvN)) => + case si of + SqField (v, f) => + let + val fs = getOpt (SM.find (ts, v), SM.empty) + in + (SM.insert (ts, v, SM.insert (fs, f, Proj (rvOf v, f))), es, rvN) + end + | SqExp (e, f) => + let + val (e, rvN) = case expIn (e, rvN) of - (inr p, rvN) => (Cond (Proj (oe, f), p), rvN) - | (inl e, rvN) => (Reln (Eq, [Proj (oe, f), e]), rvN) - in - (And (p, p'), rvN) - end) - (True, rvN) (#Select r) + (inr _, rvN) => + let + val (rvN, e) = rv rvN + in + (e, rvN) + end + | (inl e, rvN) => (e, rvN) + in + (ts, SM.insert (es, f, e), rvN) + end) + (SM.empty, SM.empty, rvN) (#Select r) + + val p' = Reln (Eq, [oe, Recd (map (fn (t, fs) => (t, Recd (SM.listItemsi fs))) + (SM.listItemsi ts) + @ SM.listItemsi es)]) in (rvN, And (p, p'), True, []) end