@@ -57,7 +57,7 @@ ocaml-elpi.ppx: no program specified. Supported options:
5757 let query =
5858 let open Query in
5959 compile program (Ast.Loc.initial " ppx") @@
60- Query { predicate = " map.structure"; arguments = D (structure,s,(Q (structure," Result ",N ))) } in
60+ CQuery ( " map.structure", DC (structure,s,(QC (structure," Result ",NC ))),new ctx_for_structure [],RawData.no_constraints) in
6161 if !typecheck then begin
6262 if not @@ Compile.static_check ~checker:Elpi.Builtin.(default_checker ()) query then begin
6363 exit 1
@@ -77,13 +77,16 @@ let erase_loc =
7777 object
7878 inherit [State.t] Ast_traverse.fold_map
7979 method! location _ (st : State.t) = Ocaml_ast_for_elpi.dummy_location, st
80+ method! location_stack l (st : State.t) = [], st
8081 end
8182;;
8283
8384let expression_quotation ~depth state _loc s =
8485 let e = Ppxlib.Parse.expression (Lexing.from_string s) in
8586 let e, state = erase_loc#expression e state in
86- let state, x, gls = (expression).Conversion.embed ~depth state e in
87+ let ctx = new ctx_for_expression [] state in
88+ let csts = RawData.no_constraints in
89+ let state, x, gls = (expression).ContextualConversion.embed ~depth ctx csts state e in
8790 assert(gls = []);
8891 state, x
8992
@@ -93,7 +96,9 @@ let () = Quotation.set_default_quotation expression_quotation
9396let pattern_quotation ~depth state _loc s =
9497 let e = Ppxlib.Parse.pattern (Lexing.from_string s) in
9598 let e, state = erase_loc#pattern e state in
96- let state, x, gls = (pattern).Conversion.embed ~depth state e in
99+ let ctx = new ctx_for_pattern [] state in
100+ let csts = RawData.no_constraints in
101+ let state, x, gls = (pattern).ContextualConversion.embed ~depth ctx csts state e in
97102 assert(gls = []);
98103 state, x
99104
@@ -102,7 +107,9 @@ let () = Quotation.register_named_quotation ~name:"pat" pattern_quotation
102107let type_quotation ~depth state _loc s =
103108 let e = Ppxlib.Parse.core_type (Lexing.from_string s) in
104109 let e, state = erase_loc#core_type e state in
105- let state, x, gls = (core_type).Conversion.embed ~depth state e in
110+ let ctx = new ctx_for_core_type [] state in
111+ let csts = RawData.no_constraints in
112+ let state, x, gls = (core_type).ContextualConversion.embed ~depth ctx csts state e in
106113 assert(gls = []);
107114 state, x
108115
@@ -113,7 +120,9 @@ let stri_quotation ~depth state _loc s =
113120 match e with
114121 | Ptop_def [e] ->
115122 let e, state = erase_loc#structure_item e state in
116- let state, x, gls = (structure_item).Conversion.embed ~depth state e in
123+ let ctx = new ctx_for_structure_item [] state in
124+ let csts = RawData.no_constraints in
125+ let state, x, gls = (structure_item).ContextualConversion.embed ~depth ctx csts state e in
117126 assert(gls = []);
118127 state, x
119128 | Ptop_def _ ->
@@ -128,7 +137,9 @@ let sigi_quotation ~depth state _loc s =
128137 match e with
129138 | [e] ->
130139 let e, state = erase_loc#signature_item e state in
131- let state, x, gls = (signature_item).Conversion.embed ~depth state e in
140+ let ctx = new ctx_for_signature_item [] state in
141+ let csts = RawData.no_constraints in
142+ let state, x, gls = (signature_item).ContextualConversion.embed ~depth ctx csts state e in
132143 assert(gls = []);
133144 state, x
134145 | _ ->
@@ -139,7 +150,9 @@ let () = Quotation.register_named_quotation ~name:"sigi" stri_quotation
139150let structure_quotation ~depth state _loc s =
140151 let e = Ppxlib.Parse.implementation (Lexing.from_string s) in
141152 let e, state = erase_loc#structure e state in
142- let state, x, gls = (structure).Conversion.embed ~depth state e in
153+ let ctx = new ctx_for_structure [] state in
154+ let csts = RawData.no_constraints in
155+ let state, x, gls = (structure).ContextualConversion.embed ~depth ctx csts state e in
143156 assert(gls = []);
144157 state, x
145158
@@ -148,7 +161,9 @@ let () = Quotation.register_named_quotation ~name:"str" structure_quotation
148161let signature_quotation ~depth state _loc s =
149162 let e = Ppxlib.Parse.interface (Lexing.from_string s) in
150163 let e, state = erase_loc#signature e state in
151- let state, x, gls = (signature).Conversion.embed ~depth state e in
164+ let ctx = new ctx_for_signature [] state in
165+ let csts = RawData.no_constraints in
166+ let state, x, gls = (signature).ContextualConversion.embed ~depth ctx csts state e in
152167 assert(gls = []);
153168 state, x
154169
@@ -166,7 +181,7 @@ let arg_typecheck t =
166181 match Driver.Cookies.get t " typecheck" Ast_pattern.(__) with
167182 | Some _ -> typecheck := true
168183 | _ -> ()
169-
184+
170185let arg_debug t =
171186 match Driver.Cookies.get t " debug" Ast_pattern.(__) with
172187 | Some _ -> debug := true
0 commit comments