comparison src/corify.sml @ 813:7b380e2b9e68

Corify FFI datatypes properly; eliminate nested JavaScript markers
author Adam Chlipala <adamc@hcoop.net>
date Sun, 17 May 2009 13:25:57 -0400
parents 61a1f5c5ae2c
children e46227efcbba
comparison
equal deleted inserted replaced
812:2fbd1ac2f04b 813:7b380e2b9e68
822 822
823 val (dts, (ds', st, cmap, conmap)) = 823 val (dts, (ds', st, cmap, conmap)) =
824 ListUtil.foldlMap 824 ListUtil.foldlMap
825 (fn ((x, n, xs, xnts), (ds', st, cmap, conmap)) => 825 (fn ((x, n, xs, xnts), (ds', st, cmap, conmap)) =>
826 let 826 let
827 val k' = foldl (fn (_, k') => (L'.KArrow (k, k'), loc))
828 k xs
829
827 val dk = ElabUtil.classifyDatatype xnts 830 val dk = ElabUtil.classifyDatatype xnts
828 val (st, n') = St.bindCon st x n 831 val (st, n') = St.bindCon st x n
829 val (xnts, (ds', st, cmap, conmap)) = 832 val (xnts, (ds', st, cmap, conmap)) =
830 ListUtil.foldlMap 833 ListUtil.foldlMap
831 (fn ((x', n, to), (ds', st, cmap, conmap)) => 834 (fn ((x', n, to), (ds', st, cmap, conmap)) =>
883 (x, xs, to, dk)) 886 (x, xs, to, dk))
884 in 887 in
885 ((x', n, to), 888 ((x', n, to),
886 (d :: ds', st, cmap, conmap)) 889 (d :: ds', st, cmap, conmap))
887 end) (ds', st, cmap, conmap) xnts 890 end) (ds', st, cmap, conmap) xnts
891
892 val d = (L'.DCon (x, n', k', (L'.CFfi (m, x), loc)), loc)
888 in 893 in
889 ((x, n', xs, xnts), (ds', st, cmap, conmap)) 894 ((x, n', xs, xnts), (d :: ds', st, cmap, conmap))
890 end) 895 end)
891 ([], st, cmap, conmap) dts 896 ([], st, cmap, conmap) dts
892 in 897 in
893 (ds' @ (L'.DDatatype dts, loc) :: ds, 898 (List.revAppend (ds', ds),
894 cmap, 899 cmap,
895 conmap, 900 conmap,
896 st, 901 st,
897 trans) 902 trans)
898 end 903 end