This commit is contained in:
ZAN DoYe 2019-12-12 17:01:21 +08:00
parent 5ca427f2d2
commit 0b37fd0de8
2 changed files with 10 additions and 20 deletions

View File

@ -428,8 +428,7 @@ let add_names_of_type decl acc =
let path_of_mty_alias = function
| Mty_alias path -> path
| _ -> assert false
#else
#if OCAML_VERSION >= (4, 04, 0)
#elif OCAML_VERSION >= (4, 04, 0)
let path_of_mty_alias = function
| Mty_alias (_, path) -> path
| _ -> assert false
@ -438,7 +437,6 @@ let path_of_mty_alias = function
| Mty_alias path -> path
| _ -> assert false
#endif
#endif
let rec names_of_module_type = function
| Mty_signature decls ->
@ -592,20 +590,16 @@ let list_global_names () =
#if OCAML_VERSION >= (4, 10, 0)
| Env.Env_copy_types summary ->
loop acc summary
#else
#if OCAML_VERSION >= (4, 06, 0)
#elif OCAML_VERSION >= (4, 06, 0)
| Env.Env_copy_types (summary, _) ->
loop acc summary
#endif
#endif
#if OCAML_VERSION >= (4, 08, 0)
| Env.Env_open(summary, path) ->
#else
#if OCAML_VERSION >= (4, 07, 0)
#elif OCAML_VERSION >= (4, 07, 0)
| Env.Env_open(summary, _, path) ->
#else
| Env.Env_open(summary, path) ->
#endif
#endif
match try Some (Path_map.find path !local_names_by_path) with Not_found -> None with
| Some names ->
@ -671,12 +665,10 @@ let list_global_fields () =
#if OCAML_VERSION >= (4, 10, 0)
| Env.Env_copy_types summary ->
loop acc summary
#else
#if OCAML_VERSION >= (4, 06, 0)
#elif OCAML_VERSION >= (4, 06, 0)
| Env.Env_copy_types (summary, _) ->
loop acc summary
#endif
#endif
#if OCAML_VERSION >= (4, 07, 0)
#if OCAML_VERSION >= (4, 08, 0)
| Env.Env_open(summary, path) ->

View File

@ -485,15 +485,13 @@ let rewrite_rules = [
#if OCAML_VERSION >= (4, 10, 0)
let lookup_type longident env =
Env.find_type_by_name longident env
#else
#if OCAML_VERSION >= (4, 04, 0)
#elif OCAML_VERSION >= (4, 04, 0)
let lookup_type longident env =
let path = Env.lookup_type longident env in
(path, Env.find_type path env)
#else
let lookup_type = Env.lookup_type
#endif
#endif
let rule_path rule =
match rule.path_to_rewrite with