1- open Typedtree
21open SharedTypes
32
43let addItem ~(name : string Location.loc ) ~extent ~stamp ~(env : Env.t ) ~item
@@ -123,12 +122,12 @@ and forTypeModule env moduleType =
123122
124123let getModuleTypePath mod_desc =
125124 match mod_desc with
126- | Tmty_ident (path , _ ) | Tmty_alias (path , _ ) -> Some path
125+ | Typedtree. Tmty_ident (path , _ ) | Tmty_alias (path , _ ) -> Some path
127126 | Tmty_signature _ | Tmty_functor _ | Tmty_with _ | Tmty_typeof _ -> None
128127
129128let forTypeDeclaration ~env ~(exported : Exported.t )
130129 {
131- typ_id;
130+ Typedtree. typ_id;
132131 typ_loc;
133132 typ_name = name ;
134133 typ_attributes;
@@ -147,9 +146,10 @@ let forTypeDeclaration ~env ~(exported : Exported.t)
147146 | Ttype_abstract -> (
148147 match typ_manifest with
149148 | Some {ctyp_desc = Ttyp_constr (path , _lident , args )} ->
150- Abstract (Some (path, args |> List. map (fun t -> t.ctyp_type)))
149+ Abstract
150+ (Some (path, args |> List. map (fun t -> t.Typedtree. ctyp_type)))
151151 | Some {ctyp_desc = Ttyp_tuple items } ->
152- Tuple (items |> List. map (fun t -> t.ctyp_type))
152+ Tuple (items |> List. map (fun t -> t.Typedtree. ctyp_type))
153153 (* TODO dig *)
154154 | _ -> Abstract None )
155155 | Ttype_open -> Open
@@ -159,7 +159,7 @@ let forTypeDeclaration ~env ~(exported : Exported.t)
159159 |> List. map
160160 (fun
161161 {
162- cd_id;
162+ Typedtree. cd_id;
163163 cd_name = cname ;
164164 cd_args;
165165 cd_res;
@@ -176,7 +176,8 @@ let forTypeDeclaration ~env ~(exported : Exported.t)
176176 (match cd_args with
177177 | Cstr_tuple args ->
178178 args
179- |> List. map (fun t -> (t.ctyp_type, t.ctyp_loc))
179+ |> List. map (fun t ->
180+ (t.Typedtree. ctyp_type, t.ctyp_loc))
180181 (* TODO(406) *)
181182 | Cstr_record _ -> [] );
182183 res =
@@ -197,7 +198,9 @@ let forTypeDeclaration ~env ~(exported : Exported.t)
197198 Record
198199 (fields
199200 |> List. map
200- (fun {ld_id; ld_name = fname ; ld_type = {ctyp_type} } ->
201+ (fun
202+ {Typedtree. ld_id; ld_name = fname ; ld_type = {ctyp_type} }
203+ ->
201204 let fstamp = Ident. binding_time ld_id in
202205 {stamp = fstamp; fname; typ = ctyp_type})));
203206 }
@@ -281,7 +284,7 @@ let forSignature ~env sigItems =
281284 in
282285 {Module. docstring; exported; items}
283286
284- let forTreeModuleType ~env {mty_desc} =
287+ let forTreeModuleType ~env {Typedtree. mty_desc} =
285288 match mty_desc with
286289 | Tmty_ident _ -> None
287290 | Tmty_signature {sig_items} ->
@@ -291,7 +294,7 @@ let forTreeModuleType ~env {mty_desc} =
291294
292295let rec getModulePath mod_desc =
293296 match mod_desc with
294- | Tmod_ident (path , _lident ) -> Some path
297+ | Typedtree. Tmod_ident (path , _lident ) -> Some path
295298 | Tmod_structure _ -> None
296299 | Tmod_functor (_ident , _argName , _maybeType , _resultExpr ) -> None
297300 | Tmod_apply (functor_ , _arg , _coercion ) -> getModulePath functor_.mod_desc
@@ -300,11 +303,11 @@ let rec getModulePath mod_desc =
300303 getModulePath expr.mod_desc
301304
302305let rec forStructureItem ~env ~(exported : Exported.t ) item =
303- match item.str_desc with
306+ match item.Typedtree. str_desc with
304307 | Tstr_value (_isRec , bindings ) ->
305308 let items = ref [] in
306309 let rec handlePattern attributes pat =
307- match pat.pat_desc with
310+ match pat.Typedtree. pat_desc with
308311 | Tpat_var (ident, name)
309312 | Tpat_alias (_ , ident , name ) (* let x : t = ... * ) ->
310313 let item = pat.pat_type in
@@ -327,7 +330,8 @@ let rec forStructureItem ~env ~(exported : Exported.t) item =
327330 | Tpat_variant (_ , None , _ ) | Tpat_any | Tpat_constant _ -> ()
328331 in
329332 List. iter
330- (fun {vb_pat; vb_attributes} -> handlePattern vb_attributes vb_pat)
333+ (fun {Typedtree. vb_pat; vb_attributes} ->
334+ handlePattern vb_attributes vb_pat)
331335 bindings;
332336 ! items
333337 | Tstr_module
@@ -819,7 +823,7 @@ let rec addForLongident ~env ~extra top (path : Path.t) (txt : Longident.t) loc
819823
820824let rec handle_module_expr ~env ~extra expr =
821825 match expr with
822- | Tmod_constraint (expr , _ , _ , _ ) ->
826+ | Typedtree. Tmod_constraint (expr , _ , _ , _ ) ->
823827 handle_module_expr ~env ~extra expr.mod_desc
824828 | Tmod_ident (path , {txt; loc} ) ->
825829 if not (lidIsComplex txt) then
@@ -833,7 +837,7 @@ let rec handle_module_expr ~env ~extra expr =
833837 | _ -> ()
834838
835839let structure_item ~env ~extra (iter : Tast_iterator.iterator ) item =
836- (match item.str_desc with
840+ (match item.Typedtree. str_desc with
837841 | Tstr_include {incl_mod = expr } ->
838842 handle_module_expr ~env ~extra expr.mod_desc
839843 | Tstr_module {mb_expr} -> handle_module_expr ~env ~extra mb_expr.mod_desc
@@ -846,7 +850,7 @@ let structure_item ~env ~extra (iter : Tast_iterator.iterator) item =
846850
847851let signature_item ~(file : File.t ) ~extra (iter : Tast_iterator.iterator ) item
848852 =
849- (match item.sig_desc with
853+ (match item.Typedtree. sig_desc with
850854 | Tsig_value {val_id; val_loc; val_name = name ; val_desc; val_attributes} ->
851855 let stamp = Ident. binding_time val_id in
852856 if Stamps. findValue file.stamps stamp = None then (
@@ -903,7 +907,8 @@ let expr ~env ~(extra : extra) (iter : Tast_iterator.iterator)
903907 (expression.exp_extra
904908 |> List. iter (fun (e , eloc , _ ) ->
905909 match e with
906- | Texp_open (_ , _path , _ident , _ ) -> Hashtbl. add extra.opens eloc ()
910+ | Typedtree. Texp_open (_ , _path , _ident , _ ) ->
911+ Hashtbl. add extra.opens eloc ()
907912 | _ -> () );
908913 match expression.exp_desc with
909914 | Texp_ident (path , {txt; loc} , _ ) ->
@@ -915,7 +920,7 @@ let expr ~env ~(extra : extra) (iter : Tast_iterator.iterator)
915920 (fields |> Array. to_list
916921 |> Utils. filterMap (fun (desc , item ) ->
917922 match item with
918- | Overridden (loc , _ ) -> Some (loc, desc, () )
923+ | Typedtree. Overridden (loc , _ ) -> Some (loc, desc, () )
919924 | _ -> None ))
920925 | Texp_constant constant ->
921926 addLocItem extra expression.exp_loc (Constant constant)
0 commit comments