diff options
author | Jacques Garrigue <garrigue at math.nagoya-u.ac.jp> | 2001-09-25 09:34:06 +0000 |
---|---|---|
committer | Jacques Garrigue <garrigue at math.nagoya-u.ac.jp> | 2001-09-25 09:34:06 +0000 |
commit | bd3854a4322ba4570c6ee9c27c79549cdc057c7f (patch) | |
tree | 42d56c626c5738c457bc1f27a6a18216e7fce931 /otherlibs | |
parent | 7f46bbe4d05780e4ab61655d334d48ed84b8af96 (diff) | |
download | ocaml-variants303.tar.gz |
enrich variant type syntaxvariants303
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/variants303@3786 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs')
-rw-r--r-- | otherlibs/labltk/browser/main.ml | 1 | ||||
-rw-r--r-- | otherlibs/labltk/browser/searchpos.ml | 11 | ||||
-rw-r--r-- | otherlibs/labltk/compiler/compile.ml | 11 |
3 files changed, 15 insertions, 8 deletions
diff --git a/otherlibs/labltk/browser/main.ml b/otherlibs/labltk/browser/main.ml index 0379060b43..d828122448 100644 --- a/otherlibs/labltk/browser/main.ml +++ b/otherlibs/labltk/browser/main.ml @@ -35,6 +35,7 @@ let _ = "<flags> Enable or disable warnings according to <flags>:\n\ \032 A/a enable/disable all warnings\n\ \032 C/c enable/disable suspicious comment\n\ + \032 D/d enable/disable deprecated features\n\ \032 F/f enable/disable partially applied function\n\ \032 L/l enable/disable labels omitted in application\n\ \032 M/m enable/disable overriden method\n\ diff --git a/otherlibs/labltk/browser/searchpos.ml b/otherlibs/labltk/browser/searchpos.ml index d780385d8a..674864eae5 100644 --- a/otherlibs/labltk/browser/searchpos.ml +++ b/otherlibs/labltk/browser/searchpos.ml @@ -104,8 +104,11 @@ let rec search_pos_type t ~pos ~env = Ptyp_any | Ptyp_var _ -> () | Ptyp_variant(tl, _, _) -> - List.iter tl - ~f:(fun (_,_,tl) -> List.iter tl ~f:(search_pos_type ~pos ~env)) + List.iter tl ~f: + begin function + Rtag (_,_,tl) -> List.iter tl ~f:(search_pos_type ~pos ~env) + | Rinherit st -> search_pos_type ~pos ~env st + end | Ptyp_arrow (_, t1, t2) -> search_pos_type t1 ~pos ~env; search_pos_type t2 ~pos ~env @@ -806,8 +809,10 @@ and search_pos_pat ~pos ~env pat = List.iter l ~f:(fun (_, pat) -> search_pos_pat pat ~pos ~env) | Tpat_array l -> List.iter l ~f:(search_pos_pat ~pos ~env) - | Tpat_or (a, b) -> + | Tpat_or (a, b, None) -> search_pos_pat a ~pos ~env; search_pos_pat b ~pos ~env + | Tpat_or (_, _, Some _) -> + () end; add_found_str (`Exp(`Pat, pat.pat_type)) ~env ~loc:pat.pat_loc end diff --git a/otherlibs/labltk/compiler/compile.ml b/otherlibs/labltk/compiler/compile.ml index ca51bafcf9..91b4c8647e 100644 --- a/otherlibs/labltk/compiler/compile.ml +++ b/otherlibs/labltk/compiler/compile.ml @@ -153,7 +153,7 @@ let ppMLtype ?(any=false) ?(return=false) ?(def=false) ?(counter=ref 0) = with Not_found -> prerr_endline ("ppMLtype " ^ s ^ " ?"); s else if not def && List.length typdef.constructors > 1 then - "#" ^ s + "[< " ^ s ^ "]" else s else s with Not_found -> s @@ -448,8 +448,9 @@ let rec converterCAMLtoTK ~context_widget argname ty = name ^ args | Subtype (s, s') -> let name = "cCAMLtoTK" ^ s' ^ "_" ^ s ^ " " in - let args = if safetype then "(" ^ argname ^ " : #" ^ s' ^ "_" ^ s ^ ")" - else argname + let args = + if safetype then "(" ^ argname ^ " : [< " ^ s' ^ "_" ^ s ^ "])" + else argname in let args = if requires_widget_context s then context_widget ^ " " ^ args @@ -580,8 +581,8 @@ let write_CAMLtoTK ~w ~def:typdef ?safetype:(st = true) name = "dummy" in if st then begin w " : "; - if typdef.variant then w "#"; - w name; w " -> tkArgs " + if typdef.variant then w ("[< " ^ name ^ "]") else w name; + w " -> tkArgs " end; w (" = function"); List.iter constrs |