diff options
author | Alain Frisch <alain@frisch.fr> | 2013-03-05 16:50:05 +0000 |
---|---|---|
committer | Alain Frisch <alain@frisch.fr> | 2013-03-05 16:50:05 +0000 |
commit | d32b19008a647596b7d649d41f1a1ec70bca66a0 (patch) | |
tree | 3f0cbd84eaab4869f84b5fa3d1939fce9e014b81 /parsing/ast_mapper.ml | |
parent | e0045d42dd8c8f78be863876909b5337a98cc611 (diff) | |
download | ocaml-d32b19008a647596b7d649d41f1a1ec70bca66a0.tar.gz |
Parse recursive module as standard modules, and check in the type-checker that an explicit type is provided. (Unfinished.)
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13353 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'parsing/ast_mapper.ml')
-rw-r--r-- | parsing/ast_mapper.ml | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/parsing/ast_mapper.ml b/parsing/ast_mapper.ml index e859ea6dfe..97044345f7 100644 --- a/parsing/ast_mapper.ml +++ b/parsing/ast_mapper.ml @@ -256,7 +256,7 @@ module M = struct let type_ ?loc a = mk_item ?loc (Pstr_type a) let exception_ ?loc a = mk_item ?loc (Pstr_exception a) let exn_rebind ?loc ?(attributes = []) a b = mk_item ?loc (Pstr_exn_rebind (a, b, attributes)) - let module_ ?loc a b = mk_item ?loc (Pstr_module (a, b)) + let module_ ?loc a = mk_item ?loc (Pstr_module a) let rec_module ?loc a = mk_item ?loc (Pstr_recmodule a) let modtype ?loc a b = mk_item ?loc (Pstr_modtype (a, b)) let open_ ?loc ?(attributes = []) a = mk_item ?loc (Pstr_open (a, attributes)) @@ -274,8 +274,8 @@ module M = struct | Pstr_type l -> type_ ~loc (List.map (map_tuple (map_loc sub) (sub # type_declaration)) l) | Pstr_exception ed -> exception_ ~loc (sub # exception_declaration ed) | Pstr_exn_rebind (s, lid, attrs) -> exn_rebind ~loc (map_loc sub s) (map_loc sub lid) ~attributes:(map_attributes sub attrs) - | Pstr_module (s, m) -> module_ ~loc (map_loc sub s) (sub # module_expr m) - | Pstr_recmodule l -> rec_module ~loc (List.map (fun (s, mty, me) -> (map_loc sub s, sub # module_type mty, sub # module_expr me)) l) + | Pstr_module x -> module_ ~loc (sub # module_binding x) + | Pstr_recmodule l -> rec_module ~loc (List.map (sub # module_binding) l) | Pstr_modtype (s, mty) -> modtype ~loc (map_loc sub s) (sub # module_type mty) | Pstr_open (lid, attrs) -> open_ ~loc ~attributes:(map_attributes sub attrs) (map_loc sub lid) | Pstr_class l -> class_ ~loc (List.map (sub # class_declaration) l) @@ -539,6 +539,12 @@ class mapper = pmd_type = this # module_type pmd.pmd_type; pmd_attributes = map_attributes this pmd.pmd_attributes; } + method module_binding x = + { + pmb_name = map_loc this x.pmb_name; + pmb_expr = this # module_expr x.pmb_expr; + pmb_attributes = map_attributes this x.pmb_attributes; + } method location l = l |