aboutsummaryrefslogtreecommitdiff
path: root/checker/declarations.ml
diff options
context:
space:
mode:
authorMaxime Dénès2017-09-07 12:46:12 +0200
committerMaxime Dénès2017-09-07 12:46:12 +0200
commit7034b1188bba2c41de87ce980f5ecfab9d2220f3 (patch)
treec2e66295f871471bdd6f0070ea843246abc90338 /checker/declarations.ml
parent084ef41c98d52078f85831c940d0a073a4ccdb7a (diff)
parent37b81fe10d2da12180d96d931ba2b76370e1eea5 (diff)
Merge PR #931: Parametrize module body
Diffstat (limited to 'checker/declarations.ml')
-rw-r--r--checker/declarations.ml18
1 files changed, 12 insertions, 6 deletions
diff --git a/checker/declarations.ml b/checker/declarations.ml
index 093d999a34..884a1ef18c 100644
--- a/checker/declarations.ml
+++ b/checker/declarations.ml
@@ -583,24 +583,30 @@ let rec subst_expr sub = function
| MEwith (me,wd)-> MEwith (subst_expr sub me, subst_with_body sub wd)
let rec subst_expression sub me =
- functor_map (subst_module sub) (subst_expr sub) me
+ functor_map (subst_module_type sub) (subst_expr sub) me
and subst_signature sub sign =
- functor_map (subst_module sub) (subst_structure sub) sign
+ functor_map (subst_module_type sub) (subst_structure sub) sign
and subst_structure sub struc =
let subst_body = function
| SFBconst cb -> SFBconst (subst_const_body sub cb)
| SFBmind mib -> SFBmind (subst_mind sub mib)
| SFBmodule mb -> SFBmodule (subst_module sub mb)
- | SFBmodtype mtb -> SFBmodtype (subst_module sub mtb)
+ | SFBmodtype mtb -> SFBmodtype (subst_module_type sub mtb)
in
List.map (fun (l,b) -> (l,subst_body b)) struc
-and subst_module sub mb =
+and subst_body : 'a. (_ -> 'a -> 'a) -> _ -> 'a generic_module_body -> 'a generic_module_body =
+ fun subst_impl sub mb ->
{ mb with
mod_mp = subst_mp sub mb.mod_mp;
- mod_expr =
- implem_map (subst_signature sub) (subst_expression sub) mb.mod_expr;
+ mod_expr = subst_impl sub mb.mod_expr;
mod_type = subst_signature sub mb.mod_type;
mod_type_alg = Option.smartmap (subst_expression sub) mb.mod_type_alg }
+
+and subst_module sub mb =
+ subst_body (fun sub e -> implem_map (subst_signature sub) (subst_expression sub) e) sub mb
+
+and subst_module_type sub mb =
+ subst_body (fun _ () -> ()) sub mb