comparison src/core_util.sml @ 705:e6706a1df013

Track uniqueness sets in table types
author Adam Chlipala <adamc@hcoop.net>
date Tue, 07 Apr 2009 14:11:32 -0400
parents 70cbdcf5989b
children d8217b4cb617
comparison
equal deleted inserted replaced
704:70cbdcf5989b 705:e6706a1df013
931 S.map2 (ListUtil.mapfold (mfvi ctx) vis, 931 S.map2 (ListUtil.mapfold (mfvi ctx) vis,
932 fn vis' => 932 fn vis' =>
933 (DValRec vis', loc)) 933 (DValRec vis', loc))
934 end 934 end
935 | DExport _ => S.return2 dAll 935 | DExport _ => S.return2 dAll
936 | DTable (x, n, c, s, e) => 936 | DTable (x, n, c, s, e, cc) =>
937 S.bind2 (mfc ctx c, 937 S.bind2 (mfc ctx c,
938 fn c' => 938 fn c' =>
939 S.map2 (mfe ctx e, 939 S.bind2 (mfe ctx e,
940 fn e' => 940 fn e' =>
941 (DTable (x, n, c', s, e'), loc))) 941 S.map2 (mfc ctx cc,
942 fn cc' =>
943 (DTable (x, n, c', s, e', cc'), loc))))
942 | DSequence _ => S.return2 dAll 944 | DSequence _ => S.return2 dAll
943 | DDatabase _ => S.return2 dAll 945 | DDatabase _ => S.return2 dAll
944 | DCookie (x, n, c, s) => 946 | DCookie (x, n, c, s) =>
945 S.map2 (mfc ctx c, 947 S.map2 (mfc ctx c,
946 fn c' => 948 fn c' =>
1058 | DVal (x, n, t, e, s) => bind (ctx, NamedE (x, n, t, SOME e, s)) 1060 | DVal (x, n, t, e, s) => bind (ctx, NamedE (x, n, t, SOME e, s))
1059 | DValRec vis => 1061 | DValRec vis =>
1060 foldl (fn ((x, n, t, e, s), ctx) => bind (ctx, NamedE (x, n, t, NONE, s))) 1062 foldl (fn ((x, n, t, e, s), ctx) => bind (ctx, NamedE (x, n, t, NONE, s)))
1061 ctx vis 1063 ctx vis
1062 | DExport _ => ctx 1064 | DExport _ => ctx
1063 | DTable (x, n, c, s, _) => 1065 | DTable (x, n, c, s, _, cc) =>
1064 let 1066 let
1065 val t = (CApp ((CFfi ("Basis", "sql_table"), #2 d'), c), #2 d') 1067 val loc = #2 d'
1068 val ct = (CFfi ("Basis", "sql_table"), loc)
1069 val ct = (CApp (ct, c), loc)
1070 val ct = (CApp (ct, cc), loc)
1066 in 1071 in
1067 bind (ctx, NamedE (x, n, t, NONE, s)) 1072 bind (ctx, NamedE (x, n, ct, NONE, s))
1068 end 1073 end
1069 | DSequence (x, n, s) => 1074 | DSequence (x, n, s) =>
1070 let 1075 let
1071 val t = (CFfi ("Basis", "sql_sequence"), #2 d') 1076 val t = (CFfi ("Basis", "sql_sequence"), #2 d')
1072 in 1077 in
1134 foldl (fn ((_, n', _), m) => Int.max (n', m)) 1139 foldl (fn ((_, n', _), m) => Int.max (n', m))
1135 (Int.max (n, count)) ns 1140 (Int.max (n, count)) ns
1136 | DVal (_, n, _, _, _) => Int.max (n, count) 1141 | DVal (_, n, _, _, _) => Int.max (n, count)
1137 | DValRec vis => foldl (fn ((_, n, _, _, _), count) => Int.max (n, count)) count vis 1142 | DValRec vis => foldl (fn ((_, n, _, _, _), count) => Int.max (n, count)) count vis
1138 | DExport _ => count 1143 | DExport _ => count
1139 | DTable (_, n, _, _, _) => Int.max (n, count) 1144 | DTable (_, n, _, _, _, _) => Int.max (n, count)
1140 | DSequence (_, n, _) => Int.max (n, count) 1145 | DSequence (_, n, _) => Int.max (n, count)
1141 | DDatabase _ => count 1146 | DDatabase _ => count
1142 | DCookie (_, n, _, _) => Int.max (n, count)) 0 1147 | DCookie (_, n, _, _) => Int.max (n, count)) 0
1143 1148
1144 end 1149 end