diff src/cjr_print.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 78d59cf0a0cc
line wrap: on
line diff
--- a/src/cjr_print.sml	Sun Jul 13 20:07:10 2008 -0400
+++ b/src/cjr_print.sml	Sun Jul 13 20:24:05 2008 -0400
@@ -149,19 +149,22 @@
              space,
              p_exp env e,
              string ";"]
-      | DFun (fx, n, x, dom, ran, e) =>
+      | DFun (fx, n, args, ran, e) =>
         let
-            val env' = E.pushERel env x dom
+            val nargs = length args
+            val env' = foldl (fn ((x, dom), env) => E.pushERel env x dom) env args
         in
             box [string "static",
                  space,
                  p_typ env ran,
                  space,
                  string ("__lwn_" ^ fx ^ "_" ^ Int.toString n),
-                 string "(lw_context ctx, ",
-                 p_typ env dom,
-                 space,
-                 p_rel env' 0,
+                 string "(",
+                 p_list_sep (box [string ",", space]) (fn x => x)
+                            (string "lw_context ctx" :: ListUtil.mapi (fn (i, (_, dom)) =>
+                                                                   box [p_typ env dom,
+                                                                        space,
+                                                                        p_rel env' (nargs - i - 1)]) args),
                  string ")",
                  space,
                  string "{",