diff src/elab_util.sml @ 754:8688e01ae469

A view query works
author Adam Chlipala <adamc@hcoop.net>
date Tue, 28 Apr 2009 15:04:37 -0400
parents acb8537f58f0
children d20d6afc1206
line wrap: on
line diff
--- a/src/elab_util.sml	Tue Apr 28 14:02:23 2009 -0400
+++ b/src/elab_util.sml	Tue Apr 28 15:04:37 2009 -0400
@@ -791,6 +791,13 @@
                                                    end
                                                  | DSequence (tn, x, n) =>
                                                    bind (ctx, NamedE (x, (CModProj (n, [], "sql_sequence"), loc)))
+                                                 | DView (tn, x, n, _, c) =>
+                                                   let
+                                                       val ct = (CModProj (n, [], "sql_view"), loc)
+                                                       val ct = (CApp (ct, c), loc)
+                                                   in
+                                                       bind (ctx, NamedE (x, ct))
+                                                   end
                                                  | DClass (x, n, k, _) =>
                                                    bind (ctx, NamedC (x, n, (KArrow (k, (KType, loc)), loc)))
                                                  | DDatabase _ => ctx
@@ -899,6 +906,12 @@
                                                               fn cc' =>
                                                                  (DTable (tn, x, n, c', pe', pc', ce', cc'), loc))))))
               | DSequence _ => S.return2 dAll
+              | DView (tn, x, n, e, c) =>
+                S.bind2 (mfe ctx e,
+                        fn e' =>
+                           S.map2 (mfc ctx c,
+                                   fn c' =>
+                                      (DView (tn, x, n, e', c'), loc)))
 
               | DClass (x, n, k, c) =>
                 S.bind2 (mfk ctx k,
@@ -1051,6 +1064,7 @@
       | DExport _ => 0
       | DTable (n1, _, n2, _, _, _, _, _) => Int.max (n1, n2)
       | DSequence (n1, _, n2) => Int.max (n1, n2)
+      | DView (n1, _, n2, _, _) => Int.max (n1, n2)
       | DDatabase _ => 0
       | DCookie (n1, _, n2, _) => Int.max (n1, n2)
       | DStyle (n1, _, n2) => Int.max (n1, n2)