garde les memes noms, mais espaces differents

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@3200 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Jacques Garrigue 2000-06-12 14:22:37 +00:00
parent bbb09e97c2
commit 5a5f0fe989
3 changed files with 15 additions and 3 deletions

View File

@ -355,15 +355,23 @@ let toploop_ident = Ident.create_persistent "Toploop"
let toploop_getvalue_pos = 0 (* position of getvalue in module Toploop *)
let toploop_setvalue_pos = 1 (* position of setvalue in module Toploop *)
let aliased_idents = Hashtbl.create 17
let set_toplevel_name = Hashtbl.add aliased_idents
let toplevel_name id =
try Hashtbl.find aliased_idents id
with Not_found -> Ident.name id
let toploop_getvalue id =
Lapply(Lprim(Pfield toploop_getvalue_pos,
[Lprim(Pgetglobal toploop_ident, [])]),
[Lconst(Const_base(Const_string (Ident.unique_name id)))])
[Lconst(Const_base(Const_string (toplevel_name id)))])
let toploop_setvalue id lam =
Lapply(Lprim(Pfield toploop_setvalue_pos,
[Lprim(Pgetglobal toploop_ident, [])]),
[Lconst(Const_base(Const_string (Ident.unique_name id))); lam])
[Lconst(Const_base(Const_string (toplevel_name id))); lam])
let toploop_setvalue_id id = toploop_setvalue id (Lvar id)
@ -395,6 +403,9 @@ let transl_toplevel_item = function
lambda_unit
| Tstr_class cl_list ->
let ids = List.map (fun (i, _, _, _) -> i) cl_list in
List.iter
(fun id -> set_toplevel_name id (Ident.name id ^ "(c)"))
ids;
Lletrec(List.map
(fun (id, arity, meths, cl) ->
(id, transl_class ids id arity meths cl))

View File

@ -22,5 +22,6 @@ val transl_implementation: string -> structure * module_coercion -> lambda
val transl_store_implementation:
string -> structure * module_coercion -> int * lambda
val transl_toplevel_definition: structure -> lambda
val toplevel_name: Ident.t -> string
val primitive_declarations: string list ref

View File

@ -91,7 +91,7 @@ let pr_item env ppf = function
| _ ->
fprintf ppf "@[<2>%a =@ %a@]"
(Printtyp.value_description id) decl
(print_value env (getvalue (Ident.unique_name id)))
(print_value env (getvalue (Translmod.toplevel_name id)))
decl.val_type
end;
rem