Revu gestion de toplevel_env pour que si on evalue un appel a Topdirs.dir_use, les definitions du fichier charge ne soient pas ignorees
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@4149 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02master
parent
9ec52fbde5
commit
f5ac05c041
|
@ -231,9 +231,12 @@ let print_out_phrase = ref print_phrase
|
|||
let execute_phrase print_outcome ppf phr =
|
||||
match phr with
|
||||
| Ptop_def sstr ->
|
||||
let (str, sg, newenv) = Typemod.type_structure !toplevel_env sstr in
|
||||
let oldenv = !toplevel_env in
|
||||
let (str, sg, newenv) = Typemod.type_structure oldenv sstr in
|
||||
let lam = Translmod.transl_toplevel_definition str in
|
||||
Warnings.check_fatal ();
|
||||
begin try
|
||||
toplevel_env := newenv;
|
||||
let res = load_lambda ppf lam in
|
||||
let out_phr =
|
||||
match res with
|
||||
|
@ -248,6 +251,7 @@ let execute_phrase print_outcome ppf phr =
|
|||
| _ -> Ophr_signature (item_list newenv sg)
|
||||
else Ophr_signature []
|
||||
| Exception exn ->
|
||||
toplevel_env := oldenv;
|
||||
if exn = Out_of_memory then Gc.full_major();
|
||||
let outv =
|
||||
outval_of_value !toplevel_env (Obj.repr exn) Predef.type_exn
|
||||
|
@ -256,10 +260,12 @@ let execute_phrase print_outcome ppf phr =
|
|||
in
|
||||
!print_out_phrase ppf out_phr;
|
||||
begin match out_phr with
|
||||
| Ophr_eval (_, _) | Ophr_signature _ -> toplevel_env := newenv; true
|
||||
| Ophr_eval (_, _) | Ophr_signature _ -> true
|
||||
| Ophr_exception _ -> false
|
||||
end
|
||||
|
||||
with x ->
|
||||
toplevel_env := oldenv; raise x
|
||||
end
|
||||
| Ptop_dir(dir_name, dir_arg) ->
|
||||
try
|
||||
match (Hashtbl.find directive_table dir_name, dir_arg) with
|
||||
|
|
Loading…
Reference in New Issue