Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/lib/uTop.ml
Original file line number Diff line number Diff line change
Expand Up @@ -360,10 +360,15 @@ let check_phrase phrase =
with_default_loc loc
(fun () ->
let punit = (Pat.construct unit None) in
#if OCAML_VERSION >= (5, 5, 0)
let si = Str.module_ ~loc (Mb.mk ~loc (with_loc loc (Some "_")) (Mod.structure (item :: items))) in
let body = (Exp.struct_item ~loc si (Exp.construct unit None)) in
#else

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am wondering if we should have a helper letmodule function to make it clearer than the two branches are the same but for one use point this seems good enough.

let body = (Exp.letmodule ~loc:loc
(with_loc loc (Some "_"))
(Mod.structure (item :: items))
(Exp.construct unit None)) in
#endif
Str.eval (UTop_compat.Exp.fun_ ~loc punit body))
in
let check_phrase = Ptop_def [top_def] in
Expand Down
21 changes: 19 additions & 2 deletions src/lib/uTop_complete.ml
Original file line number Diff line number Diff line change
Expand Up @@ -390,12 +390,16 @@ let add_fields_of_type decl acc =
List.fold_left (fun acc field -> add (field_name field) acc) acc fields
#if OCAML_VERSION >= (5, 2, 0)
| Type_abstract _ ->
#else
#else
| Type_abstract ->
#endif
acc
| Type_open ->
acc
#if OCAML_VERSION >= (5, 5, 0)
| Type_external _ ->
acc
#endif

let add_names_of_type decl acc =
match decl.type_kind with
Expand All @@ -409,12 +413,17 @@ let add_names_of_type decl acc =
List.fold_left (fun acc field -> add (field_name field) acc) acc fields
#if OCAML_VERSION >= (5, 2, 0)
| Type_abstract _ ->
#else
#else
| Type_abstract ->
#endif
acc
| Type_open ->
acc
#if OCAML_VERSION >= (5, 5, 0)
| Type_external _ ->
acc
#endif


let path_of_mty_alias = function
| Mty_alias path -> path
Expand Down Expand Up @@ -527,7 +536,11 @@ let list_global_names () =
loop (add (Ident.name id) acc) summary
| Env.Env_cltype(summary, id, _) ->
loop (add (Ident.name id) acc) summary
#if OCAML_VERSION >= (5, 5, 0)
| Env.Env_not_aliasable(summary, id) ->
#else
| Env.Env_functor_arg(summary, id) ->
#endif
loop (add (Ident.name id) acc) summary
| Env.Env_persistent (summary, id) ->
loop (add (Ident.name id) acc) summary
Expand Down Expand Up @@ -575,7 +588,11 @@ let list_global_fields () =
loop (add (Ident.name id) acc) summary
| Env.Env_module(summary, id, _, _) ->
loop (add (Ident.name id) acc) summary
#if OCAML_VERSION >= (5, 5, 0)
| Env.Env_not_aliasable(summary, id) ->
#else
| Env.Env_functor_arg(summary, id) ->
#endif
loop (add (Ident.name id) acc) summary
| Env.Env_modtype(summary, id, _) ->
loop (add (Ident.name id) acc) summary
Expand Down
6 changes: 5 additions & 1 deletion src/lib/uTop_main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,11 @@ end = struct
| Env.Env_class (s, _, _)
| Env.Env_cltype (s, _, _)
| Env.Env_open (s, _)
| Env.Env_functor_arg (s, _)
#if OCAML_VERSION >= (5, 5, 0)
| Env.Env_not_aliasable(s, _)
#else
| Env.Env_functor_arg(s, _)
#endif
| Env.Env_constraints (s, _) ->
scan_summary last s
in
Expand Down