From 24ac9812d3e2364d55365ef92066b1b4ffa2fec9 Mon Sep 17 00:00:00 2001 From: Alain Frisch Date: Thu, 9 Sep 2010 17:55:58 +0000 Subject: Adapt Camlp4. git-svn-id: http://caml.inria.fr/svn/ocaml/branches/fstclassmod_parametrized@10676 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02 --- camlp4/Camlp4/Struct/Camlp4Ast2OCamlAst.ml | 15 +++++---------- camlp4/boot/Camlp4.ml | 2 +- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/camlp4/Camlp4/Struct/Camlp4Ast2OCamlAst.ml b/camlp4/Camlp4/Struct/Camlp4Ast2OCamlAst.ml index 020a7e0c2e..af66d64a4e 100644 --- a/camlp4/Camlp4/Struct/Camlp4Ast2OCamlAst.ml +++ b/camlp4/Camlp4/Struct/Camlp4Ast2OCamlAst.ml @@ -204,6 +204,8 @@ module Make (Ast : Sig.Camlp4Ast) = struct | <:ctyp< '$s$ >> -> [s] | _ -> assert False ]; + value mkwithc_forward = ref (fun _ -> assert False); + value rec ctyp = fun [ TyId loc i -> @@ -282,19 +284,10 @@ module Make (Ast : Sig.Camlp4Ast) = struct [mkfield loc (Pfield lab (mkpolytype (ctyp t))) :: acc] | _ -> assert False ] - and package_type_constraints wc acc = - match wc with - [ <:with_constr<>> -> acc - | <:with_constr< type $lid:id$ = $ct$ >> -> - [(id, ctyp ct) :: acc] - | <:with_constr< $wc1$ and $wc2$ >> -> - package_type_constraints wc1 (package_type_constraints wc2 acc) - | _ -> error (loc_of_with_constr wc) "unexpected `with constraint' for a package type" ] - and package_type : module_type -> package_type = fun [ <:module_type< $id:i$ with $wc$ >> -> - (long_uident i, package_type_constraints wc []) + (long_uident i, mkwithc_forward.val wc []) | <:module_type< $id:i$ >> -> (long_uident i, []) | mt -> error (loc_of_module_type mt) "unexpected package type" ] ; @@ -423,6 +416,8 @@ module Make (Ast : Sig.Camlp4Ast) = struct | <:with_constr@loc< $anti:_$ >> -> error loc "bad with constraint (antiquotation)" ]; + mkwithc_forward.val := mkwithc; + value rec patt_fa al = fun [ PaApp _ f a -> patt_fa [a :: al] f diff --git a/camlp4/boot/Camlp4.ml b/camlp4/boot/Camlp4.ml index 92daa282d8..ba3672e87e 100644 --- a/camlp4/boot/Camlp4.ml +++ b/camlp4/boot/Camlp4.ml @@ -14483,7 +14483,7 @@ module Struct = and package_type : module_type -> package_type = function | Ast.MtWit (_, (Ast.MtId (_, i)), wc) -> - ((long_uident i), (package_type_constraints wc [])) + assert false | Ast.MtId (_, i) -> ((long_uident i), []) | mt -> error (loc_of_module_type mt) "unexpected package type" -- cgit v1.2.1