diff options
author | Runhang Li <rli@twitter.com> | 2018-04-08 01:51:15 -0700 |
---|---|---|
committer | Thomas Refis <thomas.refis@gmail.com> | 2018-11-26 16:20:37 +0000 |
commit | 97329f30edcf94f98621a200c33e332cef2761e4 (patch) | |
tree | 68e53c84e414e38836fb95f95ce9341725c47c40 /parsing/parsetree.mli | |
parent | 6dc171e38779d232fc429ebf03432743bd14f2de (diff) | |
download | ocaml-97329f30edcf94f98621a200c33e332cef2761e4.tar.gz |
Extend `open` to arbritrary module expressions in structures and to
applicative module paths in signatures
Diffstat (limited to 'parsing/parsetree.mli')
-rw-r--r-- | parsing/parsetree.mli | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/parsing/parsetree.mli b/parsing/parsetree.mli index 797f849947..6828771f91 100644 --- a/parsing/parsetree.mli +++ b/parsing/parsetree.mli @@ -368,7 +368,7 @@ and expression_desc = (module ME : S) is represented as Pexp_constraint(Pexp_pack, Ptyp_package S) *) - | Pexp_open of override_flag * Longident.t loc * expression + | Pexp_open of open_declaration * expression (* M.(E) let open M in E let! open M in E *) @@ -535,7 +535,7 @@ and class_type_desc = *) | Pcty_extension of extension (* [%id] *) - | Pcty_open of override_flag * Longident.t loc * class_type + | Pcty_open of open_description * class_type (* let open M in CT *) and class_signature = @@ -627,7 +627,7 @@ and class_expr_desc = (* (CE : CT) *) | Pcl_extension of extension (* [%id] *) - | Pcl_open of override_flag * Longident.t loc * class_expr + | Pcl_open of open_description * class_expr (* let open M in CE *) @@ -777,9 +777,9 @@ and module_type_declaration = S (abstract module type declaration, pmtd_type = None) *) -and open_description = +and 'a open_infos = { - popen_lid: Longident.t loc; + popen_expr: 'a; popen_override: override_flag; popen_loc: Location.t; popen_attributes: attributes; @@ -789,6 +789,15 @@ and open_description = open X - popen_override = Fresh *) +and open_description = Longident.t loc open_infos +(* open M.N + open M(N).O *) + +and open_declaration = module_expr open_infos +(* open M.N + open M(N).O + open struct ... end *) + and 'a include_infos = { pincl_mod: 'a; @@ -871,7 +880,7 @@ and structure_item_desc = (* module rec X1 = ME1 and ... and Xn = MEn *) | Pstr_modtype of module_type_declaration (* module type S = MT *) - | Pstr_open of open_description + | Pstr_open of open_declaration (* open X *) | Pstr_class of class_declaration list (* class c1 = ... and ... and cn = ... *) |