comparison 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
comparison
equal deleted inserted replaced
753:d484df4e841a 754:8688e01ae469
789 in 789 in
790 bind (ctx, NamedE (x, ct)) 790 bind (ctx, NamedE (x, ct))
791 end 791 end
792 | DSequence (tn, x, n) => 792 | DSequence (tn, x, n) =>
793 bind (ctx, NamedE (x, (CModProj (n, [], "sql_sequence"), loc))) 793 bind (ctx, NamedE (x, (CModProj (n, [], "sql_sequence"), loc)))
794 | DView (tn, x, n, _, c) =>
795 let
796 val ct = (CModProj (n, [], "sql_view"), loc)
797 val ct = (CApp (ct, c), loc)
798 in
799 bind (ctx, NamedE (x, ct))
800 end
794 | DClass (x, n, k, _) => 801 | DClass (x, n, k, _) =>
795 bind (ctx, NamedC (x, n, (KArrow (k, (KType, loc)), loc))) 802 bind (ctx, NamedC (x, n, (KArrow (k, (KType, loc)), loc)))
796 | DDatabase _ => ctx 803 | DDatabase _ => ctx
797 | DCookie (tn, x, n, c) => 804 | DCookie (tn, x, n, c) =>
798 bind (ctx, NamedE (x, (CApp ((CModProj (n, [], "cookie"), loc), 805 bind (ctx, NamedE (x, (CApp ((CModProj (n, [], "cookie"), loc),
897 fn ce' => 904 fn ce' =>
898 S.map2 (mfc ctx cc, 905 S.map2 (mfc ctx cc,
899 fn cc' => 906 fn cc' =>
900 (DTable (tn, x, n, c', pe', pc', ce', cc'), loc)))))) 907 (DTable (tn, x, n, c', pe', pc', ce', cc'), loc))))))
901 | DSequence _ => S.return2 dAll 908 | DSequence _ => S.return2 dAll
909 | DView (tn, x, n, e, c) =>
910 S.bind2 (mfe ctx e,
911 fn e' =>
912 S.map2 (mfc ctx c,
913 fn c' =>
914 (DView (tn, x, n, e', c'), loc)))
902 915
903 | DClass (x, n, k, c) => 916 | DClass (x, n, k, c) =>
904 S.bind2 (mfk ctx k, 917 S.bind2 (mfk ctx k,
905 fn k' => 918 fn k' =>
906 S.map2 (mfc ctx c, 919 S.map2 (mfc ctx c,
1049 | DConstraint _ => 0 1062 | DConstraint _ => 0
1050 | DClass (_, n, _, _) => n 1063 | DClass (_, n, _, _) => n
1051 | DExport _ => 0 1064 | DExport _ => 0
1052 | DTable (n1, _, n2, _, _, _, _, _) => Int.max (n1, n2) 1065 | DTable (n1, _, n2, _, _, _, _, _) => Int.max (n1, n2)
1053 | DSequence (n1, _, n2) => Int.max (n1, n2) 1066 | DSequence (n1, _, n2) => Int.max (n1, n2)
1067 | DView (n1, _, n2, _, _) => Int.max (n1, n2)
1054 | DDatabase _ => 0 1068 | DDatabase _ => 0
1055 | DCookie (n1, _, n2, _) => Int.max (n1, n2) 1069 | DCookie (n1, _, n2, _) => Int.max (n1, n2)
1056 | DStyle (n1, _, n2) => Int.max (n1, n2) 1070 | DStyle (n1, _, n2) => Int.max (n1, n2)
1057 and maxNameStr (str, _) = 1071 and maxNameStr (str, _) =
1058 case str of 1072 case str of