@@ -63,13 +63,16 @@ type mapper = {
6363 structure_item : mapper -> structure_item -> structure_item ;
6464 typ : mapper -> core_type -> core_type ;
6565 type_declaration : mapper -> type_declaration -> type_declaration ;
66+ (* XXXX *)
67+ type_declaration_list : mapper -> type_declaration list -> type_declaration list ;
68+ (* XXXX *)
6669 type_extension : mapper -> type_extension -> type_extension ;
6770 type_kind : mapper -> type_kind -> type_kind ;
6871 value_binding : mapper -> value_binding -> value_binding ;
6972(* 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 *)
7376 value_description : mapper -> value_description -> value_description ;
7477 with_constraint : mapper -> with_constraint -> with_constraint ;
7578}
@@ -133,7 +136,9 @@ module T = struct
133136 ?manifest:(map_opt (sub.typ sub) ptype_manifest)
134137 ~loc: (sub.location sub ptype_loc)
135138 ~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 *)
137142 let map_type_kind sub = function
138143 | Ptype_abstract -> Ptype_abstract
139144 | Ptype_variant l ->
@@ -242,7 +247,7 @@ module MT = struct
242247 let loc = sub.location sub loc in
243248 match desc with
244249 | 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)
246251 | Psig_typext te -> type_extension ~loc (sub.type_extension sub te)
247252 | Psig_exception ed -> exception_ ~loc (sub.extension_constructor sub ed)
248253 | Psig_module x -> module_ ~loc (sub.module_declaration sub x)
@@ -288,15 +293,15 @@ module M = struct
288293 match desc with
289294 | Pstr_eval (x , attrs ) ->
290295 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 *)
293298(* value ~loc r (List.map (sub.value_binding sub) vbs) *)
294- value ~loc r
299+ value ~loc r
295300 ((if r = Recursive then sub.value_bindings_rec else sub.value_bindings)
296301 sub vbs)
297- (* XXX *)
302+ (* XXX *)
298303 | 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)
300305 | Pstr_typext te -> type_extension ~loc (sub.type_extension sub te)
301306 | Pstr_exception ed -> exception_ ~loc (sub.extension_constructor sub ed)
302307 | Pstr_module x -> module_ ~loc (sub.module_binding sub x)
@@ -323,16 +328,16 @@ module E = struct
323328 | Pexp_ident x -> ident ~loc ~attrs (map_loc sub x)
324329 | Pexp_constant x -> constant ~loc ~attrs x
325330 | Pexp_let (r , vbs , e ) ->
326- (* XXXX *)
331+ (* XXXX *)
327332 (* let_ ~loc ~attrs r (List.map (sub.value_binding sub) vbs)
328333 (sub.expr sub e) *)
329- let_ ~loc ~attrs r
334+ let_ ~loc ~attrs r
330335 (
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)
332337 sub vbs
333- )
338+ )
334339 (sub.expr sub e)
335- (* XXXX *)
340+ (* XXXX *)
336341 | Pexp_fun (lab , def , p , e ) ->
337342 fun_ ~loc ~attrs lab (map_opt (sub.expr sub) def) (sub.pat sub p)
338343 (sub.expr sub e)
@@ -445,14 +450,14 @@ module CE = struct
445450 apply ~loc ~attrs (sub.class_expr sub ce)
446451 (List. map (map_snd (sub.expr sub)) l)
447452 | Pcl_let (r , vbs , ce ) ->
448- (* XXXX *)
453+ (* XXXX *)
449454 (* let_ ~loc ~attrs r (List.map (sub.value_binding sub) vbs)
450455 (sub.class_expr sub ce) *)
451- let_ ~loc ~attrs r
456+ let_ ~loc ~attrs r
452457 ((if r = Recursive then sub.value_bindings_rec else sub.value_bindings)
453458 sub vbs)
454459 (sub.class_expr sub ce)
455- (* XXXX *)
460+ (* XXXX *)
456461 | Pcl_constraint (ce , ct ) ->
457462 constraint_ ~loc ~attrs (sub.class_expr sub ce) (sub.class_type sub ct)
458463 | Pcl_extension x -> extension ~loc ~attrs (sub.extension sub x)
@@ -519,6 +524,7 @@ let default_mapper =
519524 class_description =
520525 (fun this -> CE. class_infos this (this.class_type this));
521526 type_declaration = T. map_type_declaration;
527+ type_declaration_list = T. map_type_declaration_list;
522528 type_kind = T. map_type_kind;
523529 typ = T. map;
524530 type_extension = T. map_type_extension;
@@ -586,13 +592,13 @@ let default_mapper =
586592 ~attrs: (this.attributes this pincl_attributes)
587593 );
588594
589- value_bindings = (fun this vbs ->
590- match vbs with
595+ value_bindings = (fun this vbs ->
596+ match vbs with
591597 | [vb] -> [ this.value_binding this vb ]
592598 | _ -> List. map (this.value_binding this) vbs
593599 );
594- value_bindings_rec = (fun this vbs ->
595- match vbs with
600+ value_bindings_rec = (fun this vbs ->
601+ match vbs with
596602 | [vb] -> [ this.value_binding this vb ]
597603 | _ -> List. map (this.value_binding this) vbs
598604 );
@@ -649,4 +655,4 @@ let default_mapper =
649655 | PTyp x -> PTyp (this.typ this x)
650656 | PPat (x , g ) -> PPat (this.pat this x, map_opt (this.expr this) g)
651657 );
652- }
658+ }
0 commit comments