comparison src/cjrize.sml @ 1073:b2311dfb3158

Initializers and setval
author Adam Chlipala <adamc@hcoop.net>
date Sun, 13 Dec 2009 14:20:41 -0500
parents 217eb87dde31
children 0657e5adc938
comparison
equal deleted inserted replaced
1072:9001966ae1c8 1073:b2311dfb3158
466 let 466 let
467 val (e, sm) = cifyExp (e, sm) 467 val (e, sm) = cifyExp (e, sm)
468 in 468 in
469 ((L'.ENextval {seq = e, prepared = NONE}, loc), sm) 469 ((L'.ENextval {seq = e, prepared = NONE}, loc), sm)
470 end 470 end
471 | L.ESetval (e1, e2) =>
472 let
473 val (e1, sm) = cifyExp (e1, sm)
474 val (e2, sm) = cifyExp (e2, sm)
475 in
476 ((L'.ESetval {seq = e1, count = e2}, loc), sm)
477 end
471 478
472 | L.EUnurlify (e, t) => 479 | L.EUnurlify (e, t) =>
473 let 480 let
474 val (e, sm) = cifyExp (e, sm) 481 val (e, sm) = cifyExp (e, sm)
475 val (t, sm) = cifyTyp (t, sm) 482 val (t, sm) = cifyTyp (t, sm)
651 end 658 end
652 | L.DDatabase s => (SOME (L'.DDatabase s, loc), NONE, sm) 659 | L.DDatabase s => (SOME (L'.DDatabase s, loc), NONE, sm)
653 | L.DJavaScript s => (SOME (L'.DJavaScript s, loc), NONE, sm) 660 | L.DJavaScript s => (SOME (L'.DJavaScript s, loc), NONE, sm)
654 | L.DCookie args => (SOME (L'.DCookie args, loc), NONE, sm) 661 | L.DCookie args => (SOME (L'.DCookie args, loc), NONE, sm)
655 | L.DStyle args => (SOME (L'.DStyle args, loc), NONE, sm) 662 | L.DStyle args => (SOME (L'.DStyle args, loc), NONE, sm)
663 | L.DInitializer e =>
664 (case #1 e of
665 L.EAbs (_, _, _, e) =>
666 let
667 val (e, sm) = cifyExp (e, sm)
668 in
669 (SOME (L'.DInitializer e, loc), NONE, sm)
670 end
671 | _ => (ErrorMsg.errorAt loc "Initializer has not been fully determined";
672 (NONE, NONE, sm)))
656 673
657 fun cjrize ds = 674 fun cjrize ds =
658 let 675 let
659 val (dsF, ds, ps, sm) = foldl (fn (d, (dsF, ds, ps, sm)) => 676 val (dsF, ds, ps, sm) = foldl (fn (d, (dsF, ds, ps, sm)) =>
660 let 677 let