summaryrefslogtreecommitdiffstats
path: root/otherlibs/labltk/compiler
diff options
context:
space:
mode:
authorJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2000-04-14 09:46:08 +0000
committerJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2000-04-14 09:46:08 +0000
commit515f99114e9d82af2adfa2d200c6970480897787 (patch)
tree331ebc1703fc52a0b8b9dcfc72a56ee61dd8a347 /otherlibs/labltk/compiler
parent43ea4c20e60aa9f50519b78f48b3b15d59feb255 (diff)
Ordre des parametres plus naturel
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@3086 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs/labltk/compiler')
-rw-r--r--otherlibs/labltk/compiler/compile.ml10
-rw-r--r--otherlibs/labltk/compiler/intf.ml4
2 files changed, 9 insertions, 5 deletions
diff --git a/otherlibs/labltk/compiler/compile.ml b/otherlibs/labltk/compiler/compile.ml
index daa935fd3..f9dbeed70 100644
--- a/otherlibs/labltk/compiler/compile.ml
+++ b/otherlibs/labltk/compiler/compile.ml
@@ -653,6 +653,8 @@ let write_function ~w def =
in
replace_args ~u:[] ~l:[] ~o:[] (List.rev (variables @ variables2))
in
+ let has_opts = (ov <> [] || co <> "") in
+ if not has_opts then List.iter uv ~f:(fun x -> w " "; w x);
List.iter (lv@ov) ~f:(fun (l, v) -> w " "; w (labelstring l); w v);
if co <> "" then begin
if lv = [] && ov = [] then w (" ?" ^ lbl ^ ":eta");
@@ -660,12 +662,12 @@ let write_function ~w def =
w (co ^ "_optionals");
if lv = [] && ov = [] then w (" ?" ^ lbl ^ ":eta");
w " (fun opts";
- if uv = [] then w " ()"
- else List.iter uv ~f:(fun x -> w " "; w x);
+ if uv = [] then w " ()" else
+ if has_opts then List.iter uv ~f:(fun x -> w " "; w x);
w " ->\n"
end else begin
- List.iter uv ~f:(fun x -> w " "; w x);
- if (ov <> [] || lv = []) && uv = [] then w " ()";
+ if (ov <> [] || lv = []) && uv = [] then w " ()" else
+ if has_opts then List.iter uv ~f:(fun x -> w " "; w x);
w " =\n"
end;
begin match def.result with
diff --git a/otherlibs/labltk/compiler/intf.ml b/otherlibs/labltk/compiler/intf.ml
index 87e1eed85..634e0a315 100644
--- a/otherlibs/labltk/compiler/intf.ml
+++ b/otherlibs/labltk/compiler/intf.ml
@@ -72,7 +72,9 @@ let write_function_type ~w def =
replace_args ~u:[] ~l:[] ~o:[] (List.rev tys)
in
let counter = ref 0 in
- List.iter (ls @ os @ us) ~f:
+ let params =
+ if os = [] then us @ ls else ls @ os @ us in
+ List.iter params ~f:
begin fun (l, t) ->
if l <> "" then w (l ^ ":");
w (ppMLtype t ~counter);