Mercurial > urweb
comparison src/elaborate.sml @ 1254:935a981f4380
Merge
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 06 May 2010 13:57:01 -0400 |
parents | 950d1e540df6 |
children | 79b2bcac6200 |
comparison
equal
deleted
inserted
replaced
1198:b52929351402 | 1254:935a981f4380 |
---|---|
2235 end | 2235 end |
2236 | 2236 |
2237 | L.SgiTable (x, c, pe, ce) => | 2237 | L.SgiTable (x, c, pe, ce) => |
2238 let | 2238 let |
2239 val cstK = (L'.KRecord (L'.KRecord (L'.KUnit, loc), loc), loc) | 2239 val cstK = (L'.KRecord (L'.KRecord (L'.KUnit, loc), loc), loc) |
2240 val x' = x ^ "_hidden_constraints" | |
2241 val (env', hidden_n) = E.pushCNamed env x' cstK NONE | |
2242 val hidden = (L'.CNamed hidden_n, loc) | |
2243 | 2240 |
2244 val (c', ck, gs') = elabCon (env, denv) c | 2241 val (c', ck, gs') = elabCon (env, denv) c |
2245 val pkey = cunif (loc, cstK) | 2242 val pkey = cunif (loc, cstK) |
2246 val visible = cunif (loc, cstK) | 2243 val visible = cunif (loc, cstK) |
2247 val uniques = (L'.CConcat (visible, hidden), loc) | 2244 val (env', ds, uniques) = |
2245 case (#1 pe, #1 ce) of | |
2246 (L.EVar (["Basis"], "no_primary_key", _), L.EVar (["Basis"], "no_constraint", _)) => | |
2247 let | |
2248 val x' = x ^ "_hidden_constraints" | |
2249 val (env', hidden_n) = E.pushCNamed env x' cstK NONE | |
2250 val hidden = (L'.CNamed hidden_n, loc) | |
2251 in | |
2252 (env', [(L'.SgiConAbs (x', hidden_n, cstK), loc)], (L'.CConcat (visible, hidden), loc)) | |
2253 end | |
2254 | _ => (env, [], visible) | |
2248 | 2255 |
2249 val ct = tableOf () | 2256 val ct = tableOf () |
2250 val ct = (L'.CApp (ct, c'), loc) | 2257 val ct = (L'.CApp (ct, c'), loc) |
2251 val ct = (L'.CApp (ct, (L'.CConcat (pkey, uniques), loc)), loc) | 2258 val ct = (L'.CApp (ct, (L'.CConcat (pkey, uniques), loc)), loc) |
2252 | 2259 |
2270 in | 2277 in |
2271 checkKind env c' ck (L'.KRecord (L'.KType, loc), loc); | 2278 checkKind env c' ck (L'.KRecord (L'.KType, loc), loc); |
2272 checkCon env' pe' pet pst; | 2279 checkCon env' pe' pet pst; |
2273 checkCon env' ce' cet cst; | 2280 checkCon env' ce' cet cst; |
2274 | 2281 |
2275 ([(L'.SgiConAbs (x', hidden_n, cstK), loc), | 2282 (ds @ [(L'.SgiVal (x, n, ct), loc)], (env', denv, gs''' @ gs'' @ gs' @ gs)) |
2276 (L'.SgiVal (x, n, ct), loc)], (env', denv, gs''' @ gs'' @ gs' @ gs)) | |
2277 end | 2283 end |
2278 | 2284 |
2279 | L.SgiStr (x, sgn) => | 2285 | L.SgiStr (x, sgn) => |
2280 let | 2286 let |
2281 val (sgn', gs') = elabSgn (env, denv) sgn | 2287 val (sgn', gs') = elabSgn (env, denv) sgn |
2593 | L'.DClass (x, n, k, c) => [(L'.SgiClass (x, n, k, c), loc)] | 2599 | L'.DClass (x, n, k, c) => [(L'.SgiClass (x, n, k, c), loc)] |
2594 | L'.DDatabase _ => [] | 2600 | L'.DDatabase _ => [] |
2595 | L'.DCookie (tn, x, n, c) => [(L'.SgiVal (x, n, (L'.CApp (cookieOf (), c), loc)), loc)] | 2601 | L'.DCookie (tn, x, n, c) => [(L'.SgiVal (x, n, (L'.CApp (cookieOf (), c), loc)), loc)] |
2596 | L'.DStyle (tn, x, n) => [(L'.SgiVal (x, n, styleOf ()), loc)] | 2602 | L'.DStyle (tn, x, n) => [(L'.SgiVal (x, n, styleOf ()), loc)] |
2597 | L'.DTask _ => [] | 2603 | L'.DTask _ => [] |
2604 | L'.DPolicy _ => [] | |
2598 | 2605 |
2599 and subSgn' counterparts env strLoc sgn1 (sgn2 as (_, loc2)) = | 2606 and subSgn' counterparts env strLoc sgn1 (sgn2 as (_, loc2)) = |
2600 ((*prefaces "subSgn" [("sgn1", p_sgn env sgn1), | 2607 ((*prefaces "subSgn" [("sgn1", p_sgn env sgn1), |
2601 ("sgn2", p_sgn env sgn2)];*) | 2608 ("sgn2", p_sgn env sgn2)];*) |
2602 case (#1 (hnormSgn env sgn1), #1 (hnormSgn env sgn2)) of | 2609 case (#1 (hnormSgn env sgn1), #1 (hnormSgn env sgn2)) of |
3726 (L'.TRecord (L'.CRecord ((L'.KType, loc), []), loc), loc)), loc) | 3733 (L'.TRecord (L'.CRecord ((L'.KType, loc), []), loc), loc)), loc) |
3727 in | 3734 in |
3728 checkCon env e1' t1 t1'; | 3735 checkCon env e1' t1 t1'; |
3729 checkCon env e2' t2 t2'; | 3736 checkCon env e2' t2 t2'; |
3730 ([(L'.DTask (e1', e2'), loc)], (env, denv, gs2 @ gs1 @ gs)) | 3737 ([(L'.DTask (e1', e2'), loc)], (env, denv, gs2 @ gs1 @ gs)) |
3738 end | |
3739 | L.DPolicy e1 => | |
3740 let | |
3741 val (e1', t1, gs1) = elabExp (env, denv) e1 | |
3742 | |
3743 val t1' = (L'.CModProj (!basis_r, [], "sql_policy"), loc) | |
3744 in | |
3745 checkCon env e1' t1 t1'; | |
3746 ([(L'.DPolicy e1', loc)], (env, denv, gs1 @ gs)) | |
3731 end | 3747 end |
3732 | 3748 |
3733 (*val tcs = List.filter (fn TypeClass _ => true | _ => false) (#3 (#2 r))*) | 3749 (*val tcs = List.filter (fn TypeClass _ => true | _ => false) (#3 (#2 r))*) |
3734 in | 3750 in |
3735 (*prefaces "/elabDecl" [("d", SourcePrint.p_decl dAll)];*) | 3751 (*prefaces "/elabDecl" [("d", SourcePrint.p_decl dAll)];*) |