diff src/monoize.sml @ 1192:9c82548c97e9

Subquery FROM items
author Adam Chlipala <adamc@hcoop.net>
date Thu, 25 Mar 2010 16:06:04 -0400
parents 61c3139eab12
children aff5e661b5f8
line wrap: on
line diff
--- a/src/monoize.sml	Thu Mar 25 15:44:24 2010 -0400
+++ b/src/monoize.sml	Thu Mar 25 16:06:04 2010 -0400
@@ -1882,7 +1882,7 @@
                                            strcatComma (map (fn (x, t) =>
                                                                 strcat [
                                                                 (L'.EField (gf "SelectExps", x), loc),
-                                                                sc (" AS _" ^ x)
+                                                                sc (" AS uw_" ^ x)
                                                             ]) sexps
                                                         @ map (fn (x, xts) =>
                                                                   strcatComma
@@ -2059,6 +2059,19 @@
                                    (L'.EPrim (Prim.String (" AS T_" ^ name)), loc)]), loc),
                  fm)
             end
+          | L.ECApp ((L.ECApp ((L.ECApp ((L.EFfi ("Basis", "sql_from_query"), _), _),
+                                          _), _), _),
+                     (L.CName name, _)) =>
+            let
+                val s = (L'.TFfi ("Basis", "string"), loc)
+                fun sc s = (L'.EPrim (Prim.String s), loc)
+            in
+                ((L'.EAbs ("q", s, s,
+                           strcat [sc "(",
+                                   (L'.ERel 0, loc),
+                                   sc (") AS T_" ^ name)]), loc),
+                 fm)
+            end
           | L.ECApp ((L.ECApp ((L.ECApp ((L.EFfi ("Basis", "sql_from_comma"), _), _), _), _), _), _) =>
             let
                 val s = (L'.TFfi ("Basis", "string"), loc)
@@ -2317,7 +2330,7 @@
                _), _),
               _), _),
              _), _),
-            (L.CName nm, _)) => ((L'.EPrim (Prim.String ("_" ^ lowercaseFirst nm)), loc), fm)
+            (L.CName nm, _)) => ((L'.EPrim (Prim.String ("uw_" ^ lowercaseFirst nm)), loc), fm)
 
           | L.ECApp (
             (L.ECApp (