@@ -249,17 +249,7 @@ let rec forSignatureItem ~env ~(exported : Exported.t)
249
249
decl |> forTypeDeclaration ~env ~exported ~rec Status)
250
250
| Tsig_module
251
251
{md_id; md_attributes; md_loc; md_name = name; md_type = {mty_type}} ->
252
- let item =
253
- let env =
254
- {
255
- env with
256
- modulePath =
257
- ExportedModule
258
- {name = name.txt; modulePath = env.modulePath; isType = false };
259
- }
260
- in
261
- forTypeModule env mty_type
262
- in
252
+ let item = forTypeModule (env |> Env. addModule ~name: name.txt) mty_type in
263
253
let declared =
264
254
addDeclared ~item ~name ~extent: md_loc ~stamp: (Ident. binding_time md_id)
265
255
~env md_attributes
@@ -384,14 +374,7 @@ let rec forStructureItem ~env ~(exported : Exported.t) item =
384
374
mtd_type = Some {mty_type = modType};
385
375
mtd_loc;
386
376
} ->
387
- let env =
388
- {
389
- env with
390
- modulePath =
391
- ExportedModule
392
- {name = name.txt; modulePath = env.modulePath; isType = true };
393
- }
394
- in
377
+ let env = env |> Env. addModuleType ~name: name.txt in
395
378
let modTypeItem = forTypeModule env modType in
396
379
let declared =
397
380
addDeclared ~item: modTypeItem ~name ~extent: mtd_loc
@@ -439,14 +422,7 @@ and forModule env mod_desc moduleName =
439
422
match mod_desc with
440
423
| Tmod_ident (path , _lident ) -> Ident path
441
424
| Tmod_structure structure ->
442
- let env =
443
- {
444
- env with
445
- modulePath =
446
- ExportedModule
447
- {name = moduleName; modulePath = env.modulePath; isType = false };
448
- }
449
- in
425
+ let env = env |> Env. addModule ~name: moduleName in
450
426
let contents = forStructure ~env structure.str_items in
451
427
Structure contents
452
428
| Tmod_functor (ident , argName , maybeType , resultExpr ) ->
@@ -466,26 +442,12 @@ and forModule env mod_desc moduleName =
466
442
| Tmod_apply (functor_ , _arg , _coercion ) ->
467
443
forModule env functor_.mod_desc moduleName
468
444
| Tmod_unpack (_expr , moduleType ) ->
469
- let env =
470
- {
471
- env with
472
- modulePath =
473
- ExportedModule
474
- {name = moduleName; modulePath = env.modulePath; isType = false };
475
- }
476
- in
445
+ let env = env |> Env. addModule ~name: moduleName in
477
446
forTypeModule env moduleType
478
447
| Tmod_constraint (expr , typ , _constraint , _coercion ) ->
479
448
(* TODO do this better I think *)
480
449
let modKind = forModule env expr.mod_desc moduleName in
481
- let env =
482
- {
483
- env with
484
- modulePath =
485
- ExportedModule
486
- {name = moduleName; modulePath = env.modulePath; isType = false };
487
- }
488
- in
450
+ let env = env |> Env. addModule ~name: moduleName in
489
451
let modTypeKind = forTypeModule env typ in
490
452
Constraint (modKind, modTypeKind)
491
453
0 commit comments