comparison src/cjrize.sml @ 121:91027db5a07c

Multiple arguments to web functions
author Adam Chlipala <adamc@hcoop.net>
date Sun, 13 Jul 2008 20:24:05 -0400
parents 6230bdd122e7
children 76a4d69719d8
comparison
equal deleted inserted replaced
120:6230bdd122e7 121:91027db5a07c
163 L.DVal (x, n, t, e, _) => 163 L.DVal (x, n, t, e, _) =>
164 let 164 let
165 val (t, sm) = cifyTyp (t, sm) 165 val (t, sm) = cifyTyp (t, sm)
166 166
167 val (d, sm) = case #1 t of 167 val (d, sm) = case #1 t of
168 L'.TFun (dom, ran) => 168 L'.TFun _ =>
169 (case #1 e of 169 let
170 L.EAbs (ax, _, _, e) => 170 fun unravel (tAll as (t, _), eAll as (e, _)) =
171 let 171 case (t, e) of
172 val (e, sm) = cifyExp (e, sm) 172 (L'.TFun (dom, ran), L.EAbs (ax, _, _, e)) =>
173 in 173 let
174 (L'.DFun (x, n, ax, dom, ran, e), sm) 174 val (args, t, e) = unravel (ran, e)
175 end 175 in
176 | _ => (ErrorMsg.errorAt loc "Function isn't explicit at code generation"; 176 ((ax, dom) :: args, t, e)
177 (L'.DVal ("", 0, t, (L'.EPrim (Prim.Int 0), ErrorMsg.dummySpan)), sm))) 177 end
178 | (L'.TFun _, _) =>
179 (ErrorMsg.errorAt loc "Function isn't explicit at code generation";
180 ([], tAll, eAll))
181 | _ => ([], tAll, eAll)
182
183 val (args, ran, e) = unravel (t, e)
184 val (e, sm) = cifyExp (e, sm)
185 in
186 (L'.DFun (x, n, args, ran, e), sm)
187 end
188
178 | _ => 189 | _ =>
179 let 190 let
180 val (e, sm) = cifyExp (e, sm) 191 val (e, sm) = cifyExp (e, sm)
181 in 192 in
182 (L'.DVal (x, n, t, e), sm) 193 (L'.DVal (x, n, t, e), sm)