Skip to content

Commit

Permalink
Add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Leshchinskiy committed Oct 4, 2023
1 parent 2a2895c commit 80d33f0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ocaml/typing/printtyp.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2161,6 +2161,10 @@ and tree_of_signature ?abbrev = function
| sg ->
Abbrev.deeper abbrev (fun () ->
wrap_env (fun env -> env)(fun sg ->
(* Make sure that we expand the current signature up to 'abbrev.width' before
expanding it's components: 'max_items' is the number of items we should print
in the current signature and 'abbrev.width' will then be the remaining number
of items. This isn't quite breadth-first but very simple to implement. *)
let max_items, trimmed = Abbrev.items abbrev sg in
let tree_groups = tree_of_signature_rec ?abbrev ?max_items !printing_env sg in
let items = List.concat_map (fun (_env,l) -> List.map snd l) tree_groups in
Expand All @@ -2170,6 +2174,7 @@ and tree_of_signature ?abbrev = function

and tree_of_signature_rec ?abbrev ?max_items env' sg =
let structured = List.of_seq (Signature_group.seq sg) in
(* Don't descent into more than 'max_items' elements to save time. *)
let collect_trees_of_rec_group max_items group =
match max_items with
| Some n when n <= 0 -> (max_items, (!printing_env, []))
Expand Down

0 comments on commit 80d33f0

Please sign in to comment.