Skip to content

Refactor typedtree traverse to use compiler traverse #1031

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

Merged
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
1 change: 1 addition & 0 deletions src/.ocamlformat-ignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ loader/cmt.ml
loader/cmti.ml
loader/doc_attr.ml
loader/implementation.ml
loader/typedtree_traverse.ml
loader/lookup_def.ml
loader/lookup_def.mli
loader/odoc_loader.ml
Expand Down
3 changes: 3 additions & 0 deletions src/loader/ident_env.cppo.ml
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,9 @@ let add_items : Id.Signature.t -> item list -> t -> t = fun parent items env ->
let identifier_of_loc : t -> Location.t -> Odoc_model.Paths.Identifier.t option = fun env loc ->
try Some (LocHashtbl.find env.loc_to_ident loc) with Not_found -> None

let iter_located_identifier : t -> (Location.t -> Odoc_model.Paths.Identifier.t -> unit) -> unit = fun env f ->
LocHashtbl.iter f env.loc_to_ident

let add_signature_tree_items : Paths.Identifier.Signature.t -> Typedtree.signature -> t -> t =
fun parent sg env ->
let items = extract_signature_tree_items false sg.sig_items |> flatten_includes in
Expand Down
6 changes: 5 additions & 1 deletion src/loader/ident_env.cppo.mli
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ module Fragment : sig
val read_type : Longident.t -> Paths.Fragment.Type.t
end

val identifier_of_loc : t -> Location.t -> Odoc_model.Paths.Identifier.t option
val identifier_of_loc : t -> Location.t -> Paths.Identifier.t option
(** Each generated id has its location stored. This allows to get back the id
knowing only the location. This is used to generate links to source from the
resolution of a shape. *)

val iter_located_identifier :
t -> (Location.t -> Paths.Identifier.t -> unit) -> unit
(** Iter on all stored pair [location]-[identifier]. *)
Loading