Skip to content

Commit a4a9b25

Browse files
committed
add value_bindings to Ast_mapper
1 parent f428980 commit a4a9b25

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

compiler/ml/ast_mapper.ml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ type mapper = {
5757
type_extension: mapper -> type_extension -> type_extension;
5858
type_kind: mapper -> type_kind -> type_kind;
5959
value_binding: mapper -> value_binding -> value_binding;
60+
value_bindings: mapper -> value_binding list -> value_binding list;
6061
value_description: mapper -> value_description -> value_description;
6162
with_constraint: mapper -> with_constraint -> with_constraint;
6263
}
@@ -247,7 +248,7 @@ module M = struct
247248
match desc with
248249
| Pstr_eval (x, attrs) ->
249250
eval ~loc ~attrs:(sub.attributes sub attrs) (sub.expr sub x)
250-
| Pstr_value (r, vbs) -> value ~loc r (List.map (sub.value_binding sub) vbs)
251+
| Pstr_value (r, vbs) -> value ~loc r (sub.value_bindings sub vbs)
251252
| Pstr_primitive vd -> primitive ~loc (sub.value_description sub vd)
252253
| Pstr_type (rf, l) -> type_ ~loc rf (List.map (sub.type_declaration sub) l)
253254
| Pstr_typext te -> type_extension ~loc (sub.type_extension sub te)
@@ -285,7 +286,7 @@ module E = struct
285286
| Pexp_ident x -> ident ~loc ~attrs (map_loc sub x)
286287
| Pexp_constant x -> constant ~loc ~attrs x
287288
| Pexp_let (r, vbs, e) ->
288-
let_ ~loc ~attrs r (List.map (sub.value_binding sub) vbs) (sub.expr sub e)
289+
let_ ~loc ~attrs r (sub.value_bindings sub vbs) (sub.expr sub e)
289290
| Pexp_fun {arg_label = lab; default = def; lhs = p; rhs = e; arity; async}
290291
->
291292
fun_ ~loc ~attrs ~arity ~async lab
@@ -473,6 +474,7 @@ let default_mapper =
473474
Vb.mk (this.pat this pvb_pat) (this.expr this pvb_expr)
474475
~loc:(this.location this pvb_loc)
475476
~attrs:(this.attributes this pvb_attributes));
477+
value_bindings = (fun this l -> List.map (this.value_binding this) l);
476478
constructor_declaration =
477479
(fun this {pcd_name; pcd_args; pcd_res; pcd_loc; pcd_attributes} ->
478480
Type.constructor (map_loc this pcd_name)

compiler/ml/ast_mapper.mli

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ type mapper = {
8585
type_extension: mapper -> type_extension -> type_extension;
8686
type_kind: mapper -> type_kind -> type_kind;
8787
value_binding: mapper -> value_binding -> value_binding;
88+
value_bindings: mapper -> value_binding list -> value_binding list;
8889
value_description: mapper -> value_description -> value_description;
8990
with_constraint: mapper -> with_constraint -> with_constraint;
9091
}

0 commit comments

Comments
 (0)