Skip to content

Commit dd7059f

Browse files
committed
add value_bindings to Ast_iterator as well
1 parent 17709f7 commit dd7059f

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

compiler/ml/ast_iterator.ml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ type iterator = {
5353
type_extension: iterator -> type_extension -> unit;
5454
type_kind: iterator -> type_kind -> unit;
5555
value_binding: iterator -> value_binding -> unit;
56+
value_bindings: iterator -> value_binding list -> unit;
5657
value_description: iterator -> value_description -> unit;
5758
with_constraint: iterator -> with_constraint -> unit;
5859
}
@@ -250,7 +251,7 @@ module M = struct
250251
| Pstr_eval (x, attrs) ->
251252
sub.expr sub x;
252253
sub.attributes sub attrs
253-
| Pstr_value (_r, vbs) -> List.iter (sub.value_binding sub) vbs
254+
| Pstr_value (_r, vbs) -> sub.value_bindings sub vbs
254255
| Pstr_primitive vd -> sub.value_description sub vd
255256
| Pstr_type (_rf, l) -> List.iter (sub.type_declaration sub) l
256257
| Pstr_typext te -> sub.type_extension sub te
@@ -287,7 +288,7 @@ module E = struct
287288
| Pexp_ident x -> iter_loc sub x
288289
| Pexp_constant _ -> ()
289290
| Pexp_let (_r, vbs, e) ->
290-
List.iter (sub.value_binding sub) vbs;
291+
sub.value_bindings sub vbs;
291292
sub.expr sub e
292293
| Pexp_fun {default = def; lhs = p; rhs = e} ->
293294
iter_opt (sub.expr sub) def;
@@ -487,6 +488,7 @@ let default_iterator =
487488
this.expr this pvb_expr;
488489
this.location this pvb_loc;
489490
this.attributes this pvb_attributes);
491+
value_bindings = (fun this l -> List.iter (this.value_binding this) l);
490492
constructor_declaration =
491493
(fun this {pcd_name; pcd_args; pcd_res; pcd_loc; pcd_attributes} ->
492494
iter_loc this pcd_name;

compiler/ml/ast_iterator.mli

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ type iterator = {
5151
type_extension: iterator -> type_extension -> unit;
5252
type_kind: iterator -> type_kind -> unit;
5353
value_binding: iterator -> value_binding -> unit;
54+
value_bindings: iterator -> value_binding list -> unit;
5455
value_description: iterator -> value_description -> unit;
5556
with_constraint: iterator -> with_constraint -> unit;
5657
}

0 commit comments

Comments
 (0)