summaryrefslogtreecommitdiff
path: root/parsing/ast_iterator.ml
diff options
context:
space:
mode:
authorThomas Refis <thomas.refis@gmail.com>2019-09-02 11:43:26 +0100
committerThomas Refis <thomas.refis@gmail.com>2019-09-11 13:44:31 -0400
commit6f492fdbd9c352c0502c118a80d451b8867b1dae (patch)
tree7957c84f5a7425a87a8aaa99f261f18750daec3f /parsing/ast_iterator.ml
parentf814450b605852429613e4ae7f68bac0382e3f1d (diff)
downloadocaml-pr8908.tar.gz
PR#8908: used as a base for other PRs.pr8908
Diffstat (limited to 'parsing/ast_iterator.ml')
-rw-r--r--parsing/ast_iterator.ml16
1 files changed, 10 insertions, 6 deletions
diff --git a/parsing/ast_iterator.ml b/parsing/ast_iterator.ml
index c6806a9bb9..5f016c0089 100644
--- a/parsing/ast_iterator.ml
+++ b/parsing/ast_iterator.ml
@@ -233,6 +233,12 @@ module CT = struct
List.iter (sub.class_type_field sub) pcsig_fields
end
+let iter_functor_param sub = function
+ | Unit -> ()
+ | Named (name, mty) ->
+ iter_loc sub name;
+ sub.module_type sub mty
+
module MT = struct
(* Type expressions for the module language *)
@@ -243,9 +249,8 @@ module MT = struct
| Pmty_ident s -> iter_loc sub s
| Pmty_alias s -> iter_loc sub s
| Pmty_signature sg -> sub.signature sub sg
- | Pmty_functor (s, mt1, mt2) ->
- iter_loc sub s;
- iter_opt (sub.module_type sub) mt1;
+ | Pmty_functor (param, mt2) ->
+ iter_functor_param sub param;
sub.module_type sub mt2
| Pmty_with (mt, l) ->
sub.module_type sub mt;
@@ -298,9 +303,8 @@ module M = struct
match desc with
| Pmod_ident x -> iter_loc sub x
| Pmod_structure str -> sub.structure sub str
- | Pmod_functor (arg, arg_ty, body) ->
- iter_loc sub arg;
- iter_opt (sub.module_type sub) arg_ty;
+ | Pmod_functor (param, body) ->
+ iter_functor_param sub param;
sub.module_expr sub body
| Pmod_apply (m1, m2) ->
sub.module_expr sub m1; sub.module_expr sub m2