@@ -90,17 +90,7 @@ let of_packages ~output_dir ~linked_dir ~index_dir (pkgs : Packages.t list) :
90
90
let output_file = Fpath. (index_dir / pkg.name / Odoc. index_filename) in
91
91
{ pkg_args; output_file; json = false ; search_dir = pkg.pkg_dir }
92
92
in
93
- let rec build_deps deps =
94
- List. filter_map
95
- (fun (_name , hash ) ->
96
- match Util.StringMap. find_opt hash hashtable with
97
- | None -> None
98
- | Some (pkg , lib , mod_ ) ->
99
- let result = of_intf mod_.m_hidden pkg lib mod_.m_intf in
100
- Hashtbl. add cache mod_.m_intf.mif_hash result;
101
- Some result)
102
- deps
103
- and make_unit ~rel_dir ~input_file ~prefix ~pkg ~include_dirs : _ unit =
93
+ let make_unit ~kind ~rel_dir ~input_file ~prefix ~pkg ~include_dirs : _ unit =
104
94
let ( // ) = Fpath. ( // ) in
105
95
let ( / ) = Fpath. ( / ) in
106
96
let filename = input_file |> Fpath. rem_ext |> Fpath. basename in
@@ -118,9 +108,20 @@ let of_packages ~output_dir ~linked_dir ~index_dir (pkgs : Packages.t list) :
118
108
odoc_file;
119
109
odocl_file;
120
110
include_dirs;
121
- kind = () ;
111
+ kind;
122
112
index = index_of pkg;
123
113
}
114
+ in
115
+ let rec build_deps deps =
116
+ List. filter_map
117
+ (fun (_name , hash ) ->
118
+ match Util.StringMap. find_opt hash hashtable with
119
+ | None -> None
120
+ | Some (pkg , lib , mod_ ) ->
121
+ let result = of_intf mod_.m_hidden pkg lib mod_.m_intf in
122
+ Hashtbl. add cache mod_.m_intf.mif_hash result;
123
+ Some result)
124
+ deps
124
125
and of_intf hidden pkg libname (intf : Packages.intf ) : intf unit =
125
126
match Hashtbl. find_opt cache intf.mif_hash with
126
127
| Some unit -> unit
@@ -133,11 +134,8 @@ let of_packages ~output_dir ~linked_dir ~index_dir (pkgs : Packages.t list) :
133
134
let kind = `Intf { hidden; hash = intf.mif_hash; deps } in
134
135
(include_dirs, kind)
135
136
in
136
- let unit =
137
- make_unit ~rel_dir ~prefix: " " ~input_file: intf.mif_path ~pkg
138
- ~include_dirs
139
- in
140
- { unit with kind }
137
+ make_unit ~kind ~rel_dir ~prefix: " " ~input_file: intf.mif_path ~pkg
138
+ ~include_dirs
141
139
in
142
140
let of_impl pkg libname (impl : Packages.impl ) : impl unit option =
143
141
let open Fpath in
@@ -157,10 +155,9 @@ let of_packages ~output_dir ~linked_dir ~index_dir (pkgs : Packages.t list) :
157
155
`Impl { src_id; src_path }
158
156
in
159
157
let unit =
160
- make_unit ~rel_dir ~input_file: impl.mip_path ~pkg ~include_dirs
158
+ make_unit ~kind ~ rel_dir ~input_file: impl.mip_path ~pkg ~include_dirs
161
159
~prefix: " impl-"
162
160
in
163
- let unit = { unit with kind } in
164
161
Some unit
165
162
in
166
163
@@ -191,9 +188,9 @@ let of_packages ~output_dir ~linked_dir ~index_dir (pkgs : Packages.t list) :
191
188
let include_dirs = (output_dir // rel_dir) :: include_dirs in
192
189
let kind = `Mld in
193
190
let unit =
194
- make_unit ~rel_dir ~input_file: mld_path ~pkg ~include_dirs ~prefix: " page-"
191
+ make_unit ~kind ~rel_dir ~input_file: mld_path ~pkg ~include_dirs
192
+ ~prefix: " page-"
195
193
in
196
- let unit = { unit with kind } in
197
194
[ unit ]
198
195
in
199
196
let of_package (pkg : Packages.t ) : t list =
0 commit comments