comparison src/elaborate.sml @ 1073:b2311dfb3158

Initializers and setval
author Adam Chlipala <adamc@hcoop.net>
date Sun, 13 Dec 2009 14:20:41 -0500
parents 26197c957ad6
children d89f98f0b4bb
comparison
equal deleted inserted replaced
1072:9001966ae1c8 1073:b2311dfb3158
2546 [(L'.SgiVal (x, n, (L'.CApp (viewOf (), c), loc)), loc)] 2546 [(L'.SgiVal (x, n, (L'.CApp (viewOf (), c), loc)), loc)]
2547 | L'.DClass (x, n, k, c) => [(L'.SgiClass (x, n, k, c), loc)] 2547 | L'.DClass (x, n, k, c) => [(L'.SgiClass (x, n, k, c), loc)]
2548 | L'.DDatabase _ => [] 2548 | L'.DDatabase _ => []
2549 | L'.DCookie (tn, x, n, c) => [(L'.SgiVal (x, n, (L'.CApp (cookieOf (), c), loc)), loc)] 2549 | L'.DCookie (tn, x, n, c) => [(L'.SgiVal (x, n, (L'.CApp (cookieOf (), c), loc)), loc)]
2550 | L'.DStyle (tn, x, n) => [(L'.SgiVal (x, n, styleOf ()), loc)] 2550 | L'.DStyle (tn, x, n) => [(L'.SgiVal (x, n, styleOf ()), loc)]
2551 | L'.DInitializer _ => []
2551 2552
2552 and subSgn' counterparts env strLoc sgn1 (sgn2 as (_, loc2)) = 2553 and subSgn' counterparts env strLoc sgn1 (sgn2 as (_, loc2)) =
2553 ((*prefaces "subSgn" [("sgn1", p_sgn env sgn1), 2554 ((*prefaces "subSgn" [("sgn1", p_sgn env sgn1),
2554 ("sgn2", p_sgn env sgn2)];*) 2555 ("sgn2", p_sgn env sgn2)];*)
2555 case (#1 (hnormSgn env sgn1), #1 (hnormSgn env sgn2)) of 2556 case (#1 (hnormSgn env sgn1), #1 (hnormSgn env sgn2)) of
3665 | L.DStyle x => 3666 | L.DStyle x =>
3666 let 3667 let
3667 val (env, n) = E.pushENamed env x (styleOf ()) 3668 val (env, n) = E.pushENamed env x (styleOf ())
3668 in 3669 in
3669 ([(L'.DStyle (!basis_r, x, n), loc)], (env, denv, gs)) 3670 ([(L'.DStyle (!basis_r, x, n), loc)], (env, denv, gs))
3671 end
3672 | L.DInitializer e =>
3673 let
3674 val (e', t, gs) = elabExp (env, denv) e
3675 val t' = (L'.CApp ((L'.CModProj (!basis_r, [], "transaction"), loc),
3676 (L'.TRecord (L'.CRecord ((L'.KType, loc), []), loc), loc)), loc)
3677 in
3678 checkCon env e' t t';
3679 ([(L'.DInitializer e', loc)], (env, denv, gs))
3670 end 3680 end
3671 3681
3672 (*val tcs = List.filter (fn TypeClass _ => true | _ => false) (#3 (#2 r))*) 3682 (*val tcs = List.filter (fn TypeClass _ => true | _ => false) (#3 (#2 r))*)
3673 in 3683 in
3674 (*prefaces "/elabDecl" [("d", SourcePrint.p_decl dAll)];*) 3684 (*prefaces "/elabDecl" [("d", SourcePrint.p_decl dAll)];*)