Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[odoc] module visibility and entry list #2479

Merged
merged 1 commit into from
Aug 1, 2019
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
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@
- Add action (with-stdin-from <file> <action>) to redirect input from <file>
when performing <action>. (#2487, @nojb)

- Change the automatically generated odoc index to only list public modules.
This only affects unwrapped libraries (#2479, @rgrinberg)

1.11.0 (23/07/2019)
-------------------

Expand Down
29 changes: 15 additions & 14 deletions src/modules.ml
Original file line number Diff line number Diff line change
Expand Up @@ -705,20 +705,21 @@ let rec obj_map
| Some (Imported_from_vlib _ | Impl_of_virtual_module _), _
| _ , Some (Imported_from_vlib _ | Impl_of_virtual_module _) -> assert false)

(* TODO perhaps return only public modules? *)
let entry_modules = function
| Stdlib w -> Stdlib.lib_interface w |> Option.to_list
| Singleton m -> [m]
| Unwrapped m -> Module.Name.Map.values m
| Wrapped m ->
(* we assume this is never called for implementations *)
begin match Wrapped.lib_interface m with
| Some m -> [m]
| None -> [m.alias_module]
end
| Impl i ->
Code_error.raise "entry_modules: not defined for implementations"
["impl", dyn_of_impl i]
let entry_modules t =
List.filter ~f:(fun m -> Module.visibility m = Public) (
match t with
| Stdlib w -> Stdlib.lib_interface w |> Option.to_list
| Singleton m -> [m]
| Unwrapped m -> Module.Name.Map.values m
| Wrapped m ->
(* we assume this is never called for implementations *)
begin match Wrapped.lib_interface m with
| Some m -> [m]
| None -> [m.alias_module]
end
| Impl i ->
Code_error.raise "entry_modules: not defined for implementations"
["impl", dyn_of_impl i])

let virtual_module_names =
fold_no_vlib ~init:Module.Name.Set.empty ~f:(fun m acc ->
Expand Down