Skip to content

Commit f79be5a

Browse files
committed
Refactor env.
1 parent e90fdd1 commit f79be5a

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

analysis/src/ProcessCmt.ml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ let impItemsExtent items =
2121
let sigItemsExtent items =
2222
items |> List.map (fun item -> item.Typedtree.sig_loc) |> locsExtent
2323

24-
let addItem ~name ~extent ~stamp ~env ~item attributes exported stamps =
24+
let addItem ~name ~extent ~stamp ~(env : Env.t) ~item attributes exported stamps
25+
=
2526
let declared =
2627
ProcessAttributes.newDeclared ~item
2728
~scope:
@@ -490,7 +491,7 @@ let forCmt ~moduleName ~uri ({cmt_modname; cmt_annots} : Cmt_format.cmt_infos) =
490491
in
491492
let env =
492493
{
493-
scope = extent;
494+
Env.scope = extent;
494495
stamps = Stamps.init ();
495496
modulePath = File (uri, moduleName);
496497
}
@@ -509,7 +510,7 @@ let forCmt ~moduleName ~uri ({cmt_modname; cmt_annots} : Cmt_format.cmt_infos) =
509510
in
510511
let env =
511512
{
512-
scope = sigItemsExtent items;
513+
Env.scope = sigItemsExtent items;
513514
stamps = Stamps.init ();
514515
modulePath = File (uri, moduleName);
515516
}
@@ -519,7 +520,7 @@ let forCmt ~moduleName ~uri ({cmt_modname; cmt_annots} : Cmt_format.cmt_infos) =
519520
| Implementation structure ->
520521
let env =
521522
{
522-
scope = impItemsExtent structure.str_items;
523+
Env.scope = impItemsExtent structure.str_items;
523524
stamps = Stamps.init ();
524525
modulePath = File (uri, moduleName);
525526
}
@@ -529,7 +530,7 @@ let forCmt ~moduleName ~uri ({cmt_modname; cmt_annots} : Cmt_format.cmt_infos) =
529530
| Interface signature ->
530531
let env =
531532
{
532-
scope = sigItemsExtent signature.sig_items;
533+
Env.scope = sigItemsExtent signature.sig_items;
533534
stamps = Stamps.init ();
534535
modulePath = File (uri, moduleName);
535536
}

analysis/src/SharedTypes.ml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
type visibilityPath =
1+
type modulePath =
22
| File of Uri2.t * string
33
| NotVisible
4-
| IncludedModule of Path.t * visibilityPath
5-
| ExportedModule of string * visibilityPath
4+
| IncludedModule of Path.t * modulePath
5+
| ExportedModule of string * modulePath
66

77
type field = {stamp : int; fname : string Location.loc; typ : Types.type_expr}
88

@@ -48,7 +48,7 @@ type 't declared = {
4848
extentLoc : Location.t;
4949
scopeLoc : Location.t;
5050
stamp : int;
51-
modulePath : visibilityPath;
51+
modulePath : modulePath;
5252
isExported : bool;
5353
deprecated : string option;
5454
docstring : string list;
@@ -108,7 +108,9 @@ module Stamps = struct
108108
}
109109
end
110110

111-
type env = {stamps : Stamps.t; modulePath : visibilityPath; scope : Location.t}
111+
module Env = struct
112+
type t = {stamps : Stamps.t; modulePath : modulePath; scope : Location.t}
113+
end
112114

113115
module File = struct
114116
type t = {

0 commit comments

Comments
 (0)