@@ -63,13 +63,16 @@ type mapper = {
63
63
structure_item : mapper -> structure_item -> structure_item ;
64
64
typ : mapper -> core_type -> core_type ;
65
65
type_declaration : mapper -> type_declaration -> type_declaration ;
66
+ (* XXXX *)
67
+ type_declaration_list : mapper -> type_declaration list -> type_declaration list ;
68
+ (* XXXX *)
66
69
type_extension : mapper -> type_extension -> type_extension ;
67
70
type_kind : mapper -> type_kind -> type_kind ;
68
71
value_binding : mapper -> value_binding -> value_binding ;
69
72
(* XXXX *)
70
- value_bindings_rec : mapper -> value_binding list -> value_binding list ;
71
- value_bindings : mapper -> value_binding list -> value_binding list ;
72
- (* XXXXX *)
73
+ value_bindings_rec : mapper -> value_binding list -> value_binding list ;
74
+ value_bindings : mapper -> value_binding list -> value_binding list ;
75
+ (* XXXXX *)
73
76
value_description : mapper -> value_description -> value_description ;
74
77
with_constraint : mapper -> with_constraint -> with_constraint ;
75
78
}
@@ -133,7 +136,9 @@ module T = struct
133
136
?manifest:(map_opt (sub.typ sub) ptype_manifest)
134
137
~loc: (sub.location sub ptype_loc)
135
138
~attrs: (sub.attributes sub ptype_attributes)
136
-
139
+ (* XXXX *)
140
+ let map_type_declaration_list sub l = List. map (sub.type_declaration sub) l
141
+ (* XXXX *)
137
142
let map_type_kind sub = function
138
143
| Ptype_abstract -> Ptype_abstract
139
144
| Ptype_variant l ->
@@ -242,7 +247,7 @@ module MT = struct
242
247
let loc = sub.location sub loc in
243
248
match desc with
244
249
| Psig_value vd -> value ~loc (sub.value_description sub vd)
245
- | Psig_type l -> type_ ~loc (List. map ( sub.type_declaration sub) l)
250
+ | Psig_type l -> type_ ~loc (sub.type_declaration_list sub l)
246
251
| Psig_typext te -> type_extension ~loc (sub.type_extension sub te)
247
252
| Psig_exception ed -> exception_ ~loc (sub.extension_constructor sub ed)
248
253
| Psig_module x -> module_ ~loc (sub.module_declaration sub x)
@@ -288,15 +293,15 @@ module M = struct
288
293
match desc with
289
294
| Pstr_eval (x , attrs ) ->
290
295
eval ~loc ~attrs: (sub.attributes sub attrs) (sub.expr sub x)
291
- | Pstr_value (r , vbs ) ->
292
- (* XXX *)
296
+ | Pstr_value (r , vbs ) ->
297
+ (* XXX *)
293
298
(* value ~loc r (List.map (sub.value_binding sub) vbs) *)
294
- value ~loc r
299
+ value ~loc r
295
300
((if r = Recursive then sub.value_bindings_rec else sub.value_bindings)
296
301
sub vbs)
297
- (* XXX *)
302
+ (* XXX *)
298
303
| Pstr_primitive vd -> primitive ~loc (sub.value_description sub vd)
299
- | Pstr_type l -> type_ ~loc (List. map ( sub.type_declaration sub) l)
304
+ | Pstr_type l -> type_ ~loc (sub.type_declaration_list sub l)
300
305
| Pstr_typext te -> type_extension ~loc (sub.type_extension sub te)
301
306
| Pstr_exception ed -> exception_ ~loc (sub.extension_constructor sub ed)
302
307
| Pstr_module x -> module_ ~loc (sub.module_binding sub x)
@@ -323,16 +328,16 @@ module E = struct
323
328
| Pexp_ident x -> ident ~loc ~attrs (map_loc sub x)
324
329
| Pexp_constant x -> constant ~loc ~attrs x
325
330
| Pexp_let (r , vbs , e ) ->
326
- (* XXXX *)
331
+ (* XXXX *)
327
332
(* let_ ~loc ~attrs r (List.map (sub.value_binding sub) vbs)
328
333
(sub.expr sub e) *)
329
- let_ ~loc ~attrs r
334
+ let_ ~loc ~attrs r
330
335
(
331
- (if r = Recursive then sub.value_bindings_rec else sub.value_bindings)
336
+ (if r = Recursive then sub.value_bindings_rec else sub.value_bindings)
332
337
sub vbs
333
- )
338
+ )
334
339
(sub.expr sub e)
335
- (* XXXX *)
340
+ (* XXXX *)
336
341
| Pexp_fun (lab , def , p , e ) ->
337
342
fun_ ~loc ~attrs lab (map_opt (sub.expr sub) def) (sub.pat sub p)
338
343
(sub.expr sub e)
@@ -445,14 +450,14 @@ module CE = struct
445
450
apply ~loc ~attrs (sub.class_expr sub ce)
446
451
(List. map (map_snd (sub.expr sub)) l)
447
452
| Pcl_let (r , vbs , ce ) ->
448
- (* XXXX *)
453
+ (* XXXX *)
449
454
(* let_ ~loc ~attrs r (List.map (sub.value_binding sub) vbs)
450
455
(sub.class_expr sub ce) *)
451
- let_ ~loc ~attrs r
456
+ let_ ~loc ~attrs r
452
457
((if r = Recursive then sub.value_bindings_rec else sub.value_bindings)
453
458
sub vbs)
454
459
(sub.class_expr sub ce)
455
- (* XXXX *)
460
+ (* XXXX *)
456
461
| Pcl_constraint (ce , ct ) ->
457
462
constraint_ ~loc ~attrs (sub.class_expr sub ce) (sub.class_type sub ct)
458
463
| Pcl_extension x -> extension ~loc ~attrs (sub.extension sub x)
@@ -519,6 +524,7 @@ let default_mapper =
519
524
class_description =
520
525
(fun this -> CE. class_infos this (this.class_type this));
521
526
type_declaration = T. map_type_declaration;
527
+ type_declaration_list = T. map_type_declaration_list;
522
528
type_kind = T. map_type_kind;
523
529
typ = T. map;
524
530
type_extension = T. map_type_extension;
@@ -586,13 +592,13 @@ let default_mapper =
586
592
~attrs: (this.attributes this pincl_attributes)
587
593
);
588
594
589
- value_bindings = (fun this vbs ->
590
- match vbs with
595
+ value_bindings = (fun this vbs ->
596
+ match vbs with
591
597
| [vb] -> [ this.value_binding this vb ]
592
598
| _ -> List. map (this.value_binding this) vbs
593
599
);
594
- value_bindings_rec = (fun this vbs ->
595
- match vbs with
600
+ value_bindings_rec = (fun this vbs ->
601
+ match vbs with
596
602
| [vb] -> [ this.value_binding this vb ]
597
603
| _ -> List. map (this.value_binding this) vbs
598
604
);
@@ -649,4 +655,4 @@ let default_mapper =
649
655
| PTyp x -> PTyp (this.typ this x)
650
656
| PPat (x , g ) -> PPat (this.pat this x, map_opt (this.expr this) g)
651
657
);
652
- }
658
+ }
0 commit comments