Skip to content

Commit cabf2d7

Browse files
damiendoligezwhitequark
authored andcommitted
fix for 4.07: Ident.t is now an abstract type
1 parent 6362bc6 commit cabf2d7

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/ppx_import.cppo.ml

+13-13
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ let locate_sig ~loc lid =
4848
List.fold_left (fun sig_items path_item ->
4949
let rec loop sig_items =
5050
match sig_items with
51-
| Sig_module ({ name }, { md_type = Mty_signature sig_items }, _) :: _
52-
when name = path_item ->
51+
| Sig_module (id, { md_type = Mty_signature sig_items }, _) :: _
52+
when Ident.name id = path_item ->
5353
sig_items
54-
| Sig_modtype ({ name }, { mtd_type = Some (Mty_signature sig_items) }) :: _
55-
when name = path_item ->
54+
| Sig_modtype (id, { mtd_type = Some (Mty_signature sig_items) }) :: _
55+
when Ident.name id = path_item ->
5656
sig_items
5757
| _ :: sig_items ->
5858
loop sig_items
@@ -77,18 +77,18 @@ let locate_tsig_item f ~loc sig_items lid =
7777
let locate_ttype_decl =
7878
locate_tsig_item (fun elem ->
7979
function
80-
| Sig_type ({ name }, type_decl, _) when name = elem -> Some type_decl
80+
| Sig_type (id, type_decl, _) when Ident.name id = elem -> Some type_decl
8181
| _ -> None)
8282

8383
let locate_tmodtype_decl =
8484
locate_tsig_item (fun elem ->
8585
function
86-
| Sig_modtype ({ name }, type_decl) when name = elem -> Some type_decl
86+
| Sig_modtype (id, type_decl) when Ident.name id = elem -> Some type_decl
8787
| _ -> None)
8888

8989
let rec longident_of_path path =
9090
match path with
91-
| Path.Pident { name } -> Lident name
91+
| Path.Pident id -> Lident (Ident.name id)
9292
| Path.Pdot (path, name, _) -> Ldot (longident_of_path path, name)
9393
| Path.Papply (lhs, rhs) -> Lapply (longident_of_path lhs, longident_of_path rhs)
9494

@@ -162,7 +162,7 @@ let ptype_decl_of_ttype_decl ~manifest ~subst ptype_name ttype_decl =
162162
and ptype_kind =
163163
let map_labels =
164164
List.map (fun ld ->
165-
{ pld_name = { txt = ld.ld_id.name; loc = ld.ld_loc };
165+
{ pld_name = { txt = Ident.name ld.ld_id; loc = ld.ld_loc };
166166
pld_mutable = ld.ld_mutable;
167167
pld_type = core_type_of_type_expr ~subst ld.ld_type;
168168
pld_loc = ld.ld_loc;
@@ -184,7 +184,7 @@ let ptype_decl_of_ttype_decl ~manifest ~subst ptype_name ttype_decl =
184184
#endif
185185
in
186186
Ptype_variant (constrs |> List.map (fun cd ->
187-
{ pcd_name = { txt = cd.cd_id.name; loc = cd.cd_loc };
187+
{ pcd_name = { txt = Ident.name cd.cd_id; loc = cd.cd_loc };
188188
pcd_args = map_args cd.cd_args;
189189
pcd_res = (match cd.cd_res with Some x -> Some (core_type_of_type_expr ~subst x)
190190
| None -> None);
@@ -275,8 +275,8 @@ let rec psig_of_tsig ~subst ?(trec=[]) tsig =
275275
let psig_desc = Psig_type(Recursive, trec) in
276276
#endif
277277
{ psig_desc; psig_loc = Location.none } :: psig_of_tsig ~subst tsig
278-
| Sig_type ({ name }, ttype_decl, rec_flag) :: rest ->
279-
let ptype_decl = ptype_decl_of_ttype_decl ~manifest:None ~subst (Location.mknoloc name) ttype_decl in
278+
| Sig_type (id, ttype_decl, rec_flag) :: rest ->
279+
let ptype_decl = ptype_decl_of_ttype_decl ~manifest:None ~subst (Location.mknoloc (Ident.name id)) ttype_decl in
280280
begin match rec_flag with
281281
| Trec_not ->
282282
#if OCAML_VERSION < (4, 03, 0)
@@ -288,7 +288,7 @@ let rec psig_of_tsig ~subst ?(trec=[]) tsig =
288288
| Trec_first | Trec_next ->
289289
psig_of_tsig ~subst ~trec:(ptype_decl :: trec) rest
290290
end
291-
| Sig_value ({ name }, { val_type; val_kind; val_loc; val_attributes }) :: rest ->
291+
| Sig_value (id, { val_type; val_kind; val_loc; val_attributes }) :: rest ->
292292
let pval_prim =
293293
match val_kind with
294294
| Val_reg -> []
@@ -304,7 +304,7 @@ let rec psig_of_tsig ~subst ?(trec=[]) tsig =
304304
| _ -> assert false
305305
in
306306
{ psig_desc = Psig_value {
307-
pval_name = Location.mknoloc name; pval_loc = val_loc;
307+
pval_name = Location.mknoloc (Ident.name id); pval_loc = val_loc;
308308
pval_attributes = val_attributes;
309309
pval_prim; pval_type = core_type_of_type_expr ~subst val_type; };
310310
psig_loc = val_loc } ::

0 commit comments

Comments
 (0)