@@ -57,7 +57,7 @@ ocaml-elpi.ppx: no program specified. Supported options:
57
57
let query =
58
58
let open Query in
59
59
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
61
61
if !typecheck then begin
62
62
if not @@ Compile.static_check ~checker:Elpi.Builtin.(default_checker ()) query then begin
63
63
exit 1
@@ -77,13 +77,16 @@ let erase_loc =
77
77
object
78
78
inherit [State.t] Ast_traverse.fold_map
79
79
method! location _ (st : State.t) = Ocaml_ast_for_elpi.dummy_location, st
80
+ method! location_stack l (st : State.t) = [], st
80
81
end
81
82
;;
82
83
83
84
let expression_quotation ~depth state _loc s =
84
85
let e = Ppxlib.Parse.expression (Lexing.from_string s) in
85
86
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
87
90
assert(gls = []);
88
91
state, x
89
92
@@ -93,7 +96,9 @@ let () = Quotation.set_default_quotation expression_quotation
93
96
let pattern_quotation ~depth state _loc s =
94
97
let e = Ppxlib.Parse.pattern (Lexing.from_string s) in
95
98
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
97
102
assert(gls = []);
98
103
state, x
99
104
@@ -102,7 +107,9 @@ let () = Quotation.register_named_quotation ~name:"pat" pattern_quotation
102
107
let type_quotation ~depth state _loc s =
103
108
let e = Ppxlib.Parse.core_type (Lexing.from_string s) in
104
109
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
106
113
assert(gls = []);
107
114
state, x
108
115
@@ -113,7 +120,9 @@ let stri_quotation ~depth state _loc s =
113
120
match e with
114
121
| Ptop_def [e] ->
115
122
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
117
126
assert(gls = []);
118
127
state, x
119
128
| Ptop_def _ ->
@@ -128,7 +137,9 @@ let sigi_quotation ~depth state _loc s =
128
137
match e with
129
138
| [e] ->
130
139
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
132
143
assert(gls = []);
133
144
state, x
134
145
| _ ->
@@ -139,7 +150,9 @@ let () = Quotation.register_named_quotation ~name:"sigi" stri_quotation
139
150
let structure_quotation ~depth state _loc s =
140
151
let e = Ppxlib.Parse.implementation (Lexing.from_string s) in
141
152
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
143
156
assert(gls = []);
144
157
state, x
145
158
@@ -148,7 +161,9 @@ let () = Quotation.register_named_quotation ~name:"str" structure_quotation
148
161
let signature_quotation ~depth state _loc s =
149
162
let e = Ppxlib.Parse.interface (Lexing.from_string s) in
150
163
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
152
167
assert(gls = []);
153
168
state, x
154
169
@@ -166,7 +181,7 @@ let arg_typecheck t =
166
181
match Driver.Cookies.get t " typecheck" Ast_pattern.(__) with
167
182
| Some _ -> typecheck := true
168
183
| _ -> ()
169
-
184
+
170
185
let arg_debug t =
171
186
match Driver.Cookies.get t " debug" Ast_pattern.(__) with
172
187
| Some _ -> debug := true
0 commit comments