diff options
-rw-r--r-- | library/library.ml | 9 | ||||
-rw-r--r-- | library/library.mli | 2 | ||||
-rw-r--r-- | toplevel/vernac.ml | 2 | ||||
-rw-r--r-- | toplevel/vernacentries.ml | 2 |
4 files changed, 8 insertions, 7 deletions
diff --git a/library/library.ml b/library/library.ml index 6839bdb9c..a493be013 100644 --- a/library/library.ml +++ b/library/library.ml @@ -128,15 +128,16 @@ let segment_iter f = let open_objects decls = segment_iter open_object decls -let rec open_module s = +let rec open_module force s = let m = find_module s in - if not m.module_opened then begin - List.iter (fun (m,_,exp) -> if exp then open_module m) m.module_deps; + if force or not m.module_opened then begin + List.iter (fun (m,_,exp) -> if exp then open_module force m) m.module_deps; open_objects m.module_declarations; Nametab.open_module_contents (make_qualid [] s); m.module_opened <- true end +let import_module = open_module true (*s [load_module s] loads the module [s] from the disk, and [find_module s] returns the module of name [s], loading it if necessary. @@ -190,7 +191,7 @@ let load_module s = function let cache_require (_,(name,file,export)) = let m = load_module_from name file in if export then m.module_exported <- true; - open_module name + open_module false name let (in_require, _) = declare_object diff --git a/library/library.mli b/library/library.mli index 2f9ee2500..f937e30ab 100644 --- a/library/library.mli +++ b/library/library.mli @@ -14,7 +14,7 @@ open Libobject vernacular command [Require]. *) val load_module : string -> string option -> unit -val open_module : string -> unit +val import_module : string -> unit val module_is_loaded : string -> bool val module_is_opened : string -> bool diff --git a/toplevel/vernac.ml b/toplevel/vernac.ml index 735724aed..35a1eb494 100644 --- a/toplevel/vernac.ml +++ b/toplevel/vernac.ml @@ -125,7 +125,7 @@ and raw_load_vernac_file verbosely s = let _ = read_vernac_file verbosely s in () and raw_compile_module verbosely only_spec mname file = - Library.open_module mname; + Library.import_module mname; (* ??? *) let lfname = read_vernac_file verbosely file in let base = Filename.chop_suffix lfname ".v" in Pfedit.check_no_pending_proofs (); diff --git a/toplevel/vernacentries.ml b/toplevel/vernacentries.ml index 9b11040d2..7f3485e4e 100644 --- a/toplevel/vernacentries.ml +++ b/toplevel/vernacentries.ml @@ -329,7 +329,7 @@ let _ = (function | [VARG_IDENTIFIER id] -> fun () -> - without_mes_ambig Library.open_module (string_of_id id) + without_mes_ambig Library.import_module (string_of_id id) | _ -> bad_vernac_args "ImportModule") let _ = |