@@ -135,9 +135,8 @@ and should_resolve : Paths.Path.t -> bool =
135
135
(* | `Resolved p -> should_reresolve (p :> Paths.Path.Resolved.t) *)
136
136
(* | _ -> true *)
137
137
138
- let type_path :
139
- ?report_errors :bool -> Env.t -> Paths.Path.Type.t -> Paths.Path.Type.t =
140
- fun ?(report_errors = true ) env p ->
138
+ let type_path : Env.t -> Paths.Path.Type.t -> Paths.Path.Type.t =
139
+ fun env p ->
141
140
if not (should_resolve (p :> Paths.Path.t )) then p
142
141
else
143
142
let cp = Component.Of_Lang. (type_path (empty () ) p) in
@@ -151,13 +150,11 @@ let type_path :
151
150
let result = Tools. reresolve_type env p' in
152
151
`Resolved Lang_of. (Path. resolved_type (empty () ) result)
153
152
| Error e ->
154
- if report_errors then
155
- Errors. report ~what: (`Type_path cp) ~tools_error: e `Lookup ;
153
+ Errors. report ~what: (`Type_path cp) ~tools_error: e `Lookup ;
156
154
p)
157
155
158
- let value_path :
159
- ?report_errors :bool -> Env.t -> Paths.Path.Value.t -> Paths.Path.Value.t =
160
- fun ?(report_errors = true ) env p ->
156
+ let value_path : Env.t -> Paths.Path.Value.t -> Paths.Path.Value.t =
157
+ fun env p ->
161
158
if not (should_resolve (p :> Paths.Path.t )) then p
162
159
else
163
160
let cp = Component.Of_Lang. (value_path (empty () ) p) in
@@ -171,16 +168,12 @@ let value_path :
171
168
let result = Tools. reresolve_value env p' in
172
169
`Resolved Lang_of. (Path. resolved_value (empty () ) result)
173
170
| Error e ->
174
- if report_errors then
175
- Errors. report ~what: (`Value_path cp) ~tools_error: e `Lookup ;
171
+ Errors. report ~what: (`Value_path cp) ~tools_error: e `Lookup ;
176
172
p)
177
173
178
174
let constructor_path :
179
- ?report_errors :bool ->
180
- Env. t ->
181
- Paths.Path.Constructor. t ->
182
- Paths.Path.Constructor. t =
183
- fun ?(report_errors = true ) env p ->
175
+ Env. t -> Paths.Path.Constructor. t -> Paths.Path.Constructor. t =
176
+ fun env p ->
184
177
(* if not (should_resolve (p : Paths.Path.Constructor.t :> Paths.Path.t)) then p *)
185
178
(* else *)
186
179
if not (should_resolve_constructor p) then p
@@ -196,16 +189,12 @@ let constructor_path :
196
189
let result = Tools. reresolve_constructor env p' in
197
190
`Resolved Lang_of. (Path. resolved_constructor (empty () ) result)
198
191
| Error e ->
199
- if report_errors then
200
- Errors. report ~what: (`Constructor_path cp) ~tools_error: e `Lookup ;
192
+ Errors. report ~what: (`Constructor_path cp) ~tools_error: e `Lookup ;
201
193
p)
202
194
203
- let class_type_path :
204
- ?report_errors :bool ->
205
- Env. t ->
206
- Paths.Path.ClassType. t ->
207
- Paths.Path.ClassType. t =
208
- fun ?(report_errors = true ) env p ->
195
+ let class_type_path : Env. t -> Paths.Path.ClassType. t -> Paths.Path.ClassType. t
196
+ =
197
+ fun env p ->
209
198
if not (should_resolve (p :> Paths.Path.t )) then p
210
199
else
211
200
let cp = Component.Of_Lang. (class_type_path (empty () ) p) in
@@ -219,16 +208,12 @@ let class_type_path :
219
208
let result = Tools. reresolve_class_type env p' in
220
209
`Resolved Lang_of. (Path. resolved_class_type (empty () ) result)
221
210
| Error e ->
222
- if report_errors then
223
- Errors. report ~what: (`Class_type_path cp) ~tools_error: e `Lookup ;
211
+ Errors. report ~what: (`Class_type_path cp) ~tools_error: e `Lookup ;
224
212
p)
225
213
226
214
and module_type_path :
227
- ?report_errors :bool ->
228
- Env. t ->
229
- Paths.Path.ModuleType. t ->
230
- Paths.Path.ModuleType. t =
231
- fun ?(report_errors = true ) env p ->
215
+ Env. t -> Paths.Path.ModuleType. t -> Paths.Path.ModuleType. t =
216
+ fun env p ->
232
217
if not (should_resolve (p :> Paths.Path.t )) then p
233
218
else
234
219
let cp = Component.Of_Lang. (module_type_path (empty () ) p) in
@@ -242,13 +227,11 @@ and module_type_path :
242
227
let result = Tools. reresolve_module_type env p' in
243
228
`Resolved Lang_of. (Path. resolved_module_type (empty () ) result)
244
229
| Error e ->
245
- if report_errors then
246
- Errors. report ~what: (`Module_type_path cp) ~tools_error: e `Resolve ;
230
+ Errors. report ~what: (`Module_type_path cp) ~tools_error: e `Resolve ;
247
231
p)
248
232
249
- and module_path :
250
- ?report_errors :bool -> Env.t -> Paths.Path.Module.t -> Paths.Path.Module.t =
251
- fun ?(report_errors = true ) env p ->
233
+ and module_path : Env.t -> Paths.Path.Module.t -> Paths.Path.Module.t =
234
+ fun env p ->
252
235
if not (should_resolve (p :> Paths.Path.t )) then p
253
236
else
254
237
let cp = Component.Of_Lang. (module_path (empty () ) p) in
@@ -263,8 +246,7 @@ and module_path :
263
246
`Resolved Lang_of. (Path. resolved_module (empty () ) result)
264
247
| Error _ when is_forward p -> p
265
248
| Error e ->
266
- if report_errors then
267
- Errors. report ~what: (`Module_path cp) ~tools_error: e `Resolve ;
249
+ Errors. report ~what: (`Module_path cp) ~tools_error: e `Resolve ;
268
250
p)
269
251
270
252
let rec comment_inline_element :
@@ -415,106 +397,6 @@ and open_ env parent = function
415
397
| { Odoc_model__Lang.Open. doc; _ } as open_ ->
416
398
{ open_ with doc = comment_docs env parent doc }
417
399
418
- module Build_env = struct
419
- let rec unit env t =
420
- let open Compilation_unit in
421
- match t.content with
422
- | Module sg ->
423
- let env = signature env sg in
424
- env
425
- | Pack _ -> env
426
-
427
- and signature env s =
428
- let env = Env. open_signature s env in
429
- signature_items env s.items
430
-
431
- and simple_expansion : Env.t -> ModuleType.simple_expansion -> Env.t =
432
- fun env m ->
433
- match m with
434
- | Signature sg -> signature env sg
435
- | Functor (arg , sg ) ->
436
- let env = Env. add_functor_parameter arg env in
437
- let env = functor_argument env arg in
438
- simple_expansion env sg
439
-
440
- and functor_argument env a =
441
- match a with
442
- | FunctorParameter. Unit -> env
443
- | Named arg -> functor_parameter_parameter env arg
444
-
445
- and functor_parameter_parameter : Env. t -> FunctorParameter. parameter -> Env. t
446
- =
447
- fun env a -> module_type_expr env a.expr
448
-
449
- and module_type_expr : Env.t -> ModuleType.expr -> Env.t =
450
- fun env expr ->
451
- let open ModuleType in
452
- match expr with
453
- | Signature s -> signature env s
454
- | Path { p_path = _ ; p_expansion = Some p_expansion } ->
455
- simple_expansion env p_expansion
456
- | Path { p_path = _ ; p_expansion = None } -> env
457
- | With _ -> env
458
- | Functor (arg , res ) ->
459
- let env = functor_argument env arg in
460
- let env = Env. add_functor_parameter arg env in
461
- let env = module_type_expr env res in
462
- env
463
- | TypeOf { t_expansion = None ; _ } -> env
464
- | TypeOf { t_expansion = Some exp ; _ } -> simple_expansion env exp
465
-
466
- and signature_items : Env.t -> Signature.item list -> Env.t =
467
- fun env s ->
468
- let open Signature in
469
- List. fold_left
470
- (fun env item ->
471
- match item with
472
- | Module (_ , m ) -> module_ env m
473
- | ModuleSubstitution m -> Env. open_module_substitution m env
474
- | Type _ -> env
475
- | TypeSubstitution t -> Env. open_type_substitution t env
476
- | ModuleType mt -> module_type env mt
477
- | ModuleTypeSubstitution mts ->
478
- let env = Env. open_module_type_substitution mts env in
479
- module_type_substitution env mts
480
- | Value _ -> env
481
- | Comment _ -> env
482
- | TypExt _ -> env
483
- | Exception _ -> env
484
- | Class _ -> env
485
- | ClassType _ -> env
486
- | Include i -> include_ env i
487
- | Open _ -> env)
488
- env s
489
-
490
- and module_type_substitution : Env.t -> ModuleTypeSubstitution.t -> Env.t =
491
- fun env m -> module_type_expr env m.manifest
492
-
493
- and include_ : Env.t -> Include.t -> Env.t =
494
- fun env i ->
495
- let open Include in
496
- signature_items env i.expansion.content.items
497
-
498
- and module_type : Env.t -> ModuleType.t -> Env.t =
499
- fun env m ->
500
- match m.expr with None -> env | Some expr -> module_type_expr env expr
501
-
502
- and module_ : Env.t -> Module.t -> Env.t =
503
- fun env m ->
504
- let open Module in
505
- let env = module_decl env m.type_ in
506
- match m.type_ with
507
- | Alias (`Resolved _ , Some exp ) -> simple_expansion env exp
508
- | Alias _ | ModuleType _ -> env
509
-
510
- and module_decl : Env.t -> Module.decl -> Env.t =
511
- fun env decl ->
512
- let open Module in
513
- match decl with
514
- | ModuleType expr -> module_type_expr env expr
515
- | Alias (_ , None) -> env
516
- | Alias (_ , Some e ) -> simple_expansion env e
517
- end
518
400
let rec unit env t =
519
401
let open Compilation_unit in
520
402
let content =
@@ -527,7 +409,6 @@ let rec unit env t =
527
409
| Pack _ as p -> p
528
410
in
529
411
let source_info =
530
- let env = Build_env. unit env t in
531
412
let open Source_info in
532
413
match t.source_info with
533
414
| Some inf ->
@@ -554,32 +435,30 @@ let rec unit env t =
554
435
Value
555
436
(jump_to v
556
437
(Shape_tools. lookup_value_path env)
557
- (value_path ~report_errors: false env))
438
+ (value_path env))
558
439
| Module v ->
559
440
Module
560
441
(jump_to v
561
442
(Shape_tools. lookup_module_path env)
562
- (module_path ~report_errors: false env))
443
+ (module_path env))
563
444
| ModuleType v ->
564
445
ModuleType
565
446
(jump_to v
566
447
(Shape_tools. lookup_module_type_path env)
567
- (module_type_path ~report_errors: false env))
448
+ (module_type_path env))
568
449
| Type v ->
569
450
Type
570
451
(jump_to v
571
452
(Shape_tools. lookup_type_path env)
572
- (type_path ~report_errors: false env))
453
+ (type_path env))
573
454
| Constructor v ->
574
455
Constructor
575
- (jump_to v
576
- (fun _ -> None )
577
- (constructor_path ~report_errors: false env))
456
+ (jump_to v (fun _ -> None ) (constructor_path env))
578
457
| ClassType v ->
579
458
ClassType
580
459
(jump_to v
581
460
(Shape_tools. lookup_class_type_path env)
582
- (class_type_path ~report_errors: false env))
461
+ (class_type_path env))
583
462
| i -> i
584
463
in
585
464
(info, pos))
0 commit comments