@@ -39,9 +39,7 @@ let error_of_exn e =
39
39
| Some `Already_displayed
40
40
| None -> None
41
41
42
- type react_ppx_version = V2 | V3
43
-
44
- let implementation ?prefix ~use_super_errors ?(react_ppx_version =V3 ) impl str : Js.Unsafe.obj =
42
+ let implementation ~use_super_errors impl str : Js.Unsafe.obj =
45
43
let modulename = " Test" in
46
44
(* let env = !Toploop.toplevel_env in *)
47
45
(* Compmisc.init_path false; *)
@@ -56,17 +54,10 @@ let implementation ?prefix ~use_super_errors ?(react_ppx_version=V3) impl str :
56
54
Lazy. force Super_main. setup ;
57
55
end ;
58
56
59
-
60
-
61
57
try
62
- let code = match prefix with
63
- | None -> str
64
- | Some (prefix ) -> prefix ^ str in
65
- let ast = impl (Lexing. from_string code) in
66
- let ast = match react_ppx_version with
67
- | V2 -> Reactjs_jsx_ppx_v2. rewrite_implementation ast
68
- | V3 -> Reactjs_jsx_ppx_v3. rewrite_implementation ast in
69
- let ast = Bs_builtin_ppx. rewrite_implementation ast in
58
+ Js_config. jsx_version := 3 ; (* default *)
59
+ let ast = impl (Lexing. from_string str) in
60
+ let ast = Ppx_entry. rewrite_implementation ast in
70
61
let typed_tree =
71
62
let (a,b,_,signature) = Typemod. type_implementation_more modulename modulename modulename env ast in
72
63
(* finalenv := c ; *)
@@ -108,11 +99,8 @@ let implementation ?prefix ~use_super_errors ?(react_ppx_version=V3) impl str :
108
99
end
109
100
110
101
111
- let compile ~use_super_errors ?react_ppx_version impl =
112
- implementation ~use_super_errors ?react_ppx_version impl
113
-
114
- let shake_compile ~prefix ~use_super_errors ?react_ppx_version impl =
115
- implementation ~prefix ~use_super_errors ?react_ppx_version impl
102
+ let compile ~use_super_errors impl =
103
+ implementation ~use_super_errors impl
116
104
117
105
(* let load_module cmi_path cmi_content cmj_name cmj_content =
118
106
Js.create_file cmi_path cmi_content;
@@ -137,38 +125,19 @@ module Converter = Refmt_api.Migrate_parsetree.Convert(Refmt_api.Migrate_parsetr
137
125
let reason_parse lexbuf =
138
126
Refmt_api.Reason_toolchain.RE. implementation lexbuf |> Converter. copy_structure;;
139
127
140
- let make_compiler ~name ~ prefix impl =
128
+ let make_compiler ~name impl =
141
129
export name
142
130
(Js.Unsafe. (obj
143
131
[|" compile" ,
144
132
inject @@
145
133
Js. wrap_meth_callback
146
134
(fun _ code ->
147
135
(compile impl ~use_super_errors: false (Js. to_string code)));
148
- " shake_compile" ,
149
- inject @@
150
- Js. wrap_meth_callback
151
- (fun _ code ->
152
- (shake_compile impl ~use_super_errors: false ~prefix (Js. to_string code)));
153
136
" compile_super_errors" ,
154
137
inject @@
155
138
Js. wrap_meth_callback
156
139
(fun _ code ->
157
140
(compile impl ~use_super_errors: true (Js. to_string code)));
158
- " compile_super_errors_ppx_v2" ,
159
- inject @@
160
- Js. wrap_meth_callback
161
- (fun _ code ->
162
- (compile impl ~use_super_errors: true ~react_ppx_version: V2 (Js. to_string code)));
163
- " compile_super_errors_ppx_v3" ,
164
- inject @@
165
- Js. wrap_meth_callback
166
- (fun _ code ->
167
- (compile impl ~use_super_errors: true ~react_ppx_version: V3 (Js. to_string code)));
168
- " shake_compile_super_errors" ,
169
- inject @@
170
- Js. wrap_meth_callback
171
- (fun _ code -> (shake_compile impl ~use_super_errors: true ~prefix (Js. to_string code)));
172
141
" version" , Js.Unsafe. inject (Js. string (match name with | "reason" -> Refmt_api. version | _ -> Bs_version. version));
173
142
(* "load_module",
174
143
inject @@
@@ -181,8 +150,8 @@ let make_compiler ~name ~prefix impl=
181
150
load_module cmi_path cmi_content (Js.to_string cmj_name) cmj_bytestring); *)
182
151
|]))
183
152
184
- let () = make_compiler ~name: " ocaml" ~prefix: " [@@@bs.config {no_export}] \n #1 \" repl.ml \"\n " Parse. implementation
185
- let () = make_compiler ~name: " reason" ~prefix: " [@bs.config {no_export: no_export}]; \n #1 \" repl.re \" ; \n " reason_parse
153
+ let () = make_compiler ~name: " ocaml" Parse. implementation
154
+ let () = make_compiler ~name: " reason" reason_parse
186
155
187
156
(* local variables: *)
188
157
(* compile-command: "ocamlbuild -use-ocamlfind -pkg compiler-libs -no-hygiene driver.cmo" *)
0 commit comments