diff options
| author | Jacques Garrigue <garrigue at math.nagoya-u.ac.jp> | 2013-12-20 06:55:26 +0000 |
|---|---|---|
| committer | Jacques Garrigue <garrigue at math.nagoya-u.ac.jp> | 2013-12-20 06:55:26 +0000 |
| commit | d90b126bd428999d767ef4db4c5d3b05eb27c345 (patch) | |
| tree | 237a045f93257e65ea8b9276d18e79973b5775f7 /typing/env.ml | |
| parent | c20af454f38f13d7dd3b417e293335fcc82e479f (diff) | |
| download | ocaml-module-alias.tar.gz | |
Add -trans-mod option for transparent module dependencies.module-alias
Without that option, dependencies are strict, both for
typing and linking.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/module-alias@14382 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'typing/env.ml')
| -rw-r--r-- | typing/env.ml | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/typing/env.ml b/typing/env.ml index e7d15ca13b..9e7791168c 100644 --- a/typing/env.ml +++ b/typing/env.ml @@ -329,7 +329,7 @@ let read_pers_struct modname filename = ps_flags = flags } in if ps.ps_name <> modname then error (Illegal_renaming(modname, ps.ps_name, filename)); - (*check_consistency filename ps.ps_crcs;*) + if not !Clflags.transparent_modules then check_consistency ps; List.iter (function Rectypes -> if not !Clflags.recursive_types then @@ -486,6 +486,14 @@ let find_module path env = raise Not_found end +let required_globals = ref [] +let reset_required_globals () = required_globals := [] +let get_required_globals () = !required_globals +let add_required_global id = + if Ident.global id && not !Clflags.transparent_modules + && not (List.exists (Ident.same id) !required_globals) + then required_globals := id :: !required_globals + let rec normalize_path lax env path = let path = match path with @@ -496,7 +504,13 @@ let rec normalize_path lax env path = | _ -> path in try match find_module path env with - {md_type=Mty_alias path} -> normalize_path lax env path + {md_type=Mty_alias path1} -> + let path' = normalize_path lax env path1 in + if lax || !Clflags.transparent_modules then path' else + let id = Path.head path in + if Ident.global id && not (Ident.same id (Path.head path')) + then add_required_global id; + path' | _ -> path with Not_found when lax || (match path with Pident id -> not (Ident.persistent id) | _ -> true) -> |
