Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Commit dd2f680

Browse files
committed
remove unneeded jsx stuff from res_multi_printer
1 parent d3dcd85 commit dd2f680

File tree

4 files changed

+3
-63
lines changed

4 files changed

+3
-63
lines changed

.depend

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ src/res_minibuffer.cmi :
4747
src/res_multi_printer.cmx : src/res_printer.cmx src/res_io.cmx \
4848
src/res_driver_reason_binary.cmx src/res_driver_ml_parser.cmx \
4949
src/res_driver.cmx src/res_diagnostics.cmx src/res_ast_conversion.cmx \
50-
src/reactjs_jsx_ppx.cmx src/res_multi_printer.cmi
50+
src/res_multi_printer.cmi
5151
src/res_multi_printer.cmi :
5252
src/res_outcome_printer.cmx : src/res_token.cmx src/res_doc.cmx \
5353
src/res_outcome_printer.cmi

src/res_multi_printer.ml

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -51,40 +51,6 @@ let printMl ~isInterface ~filename =
5151
~comments:parseResult.comments
5252
parseResult.parsetree
5353

54-
(* print files using React JSX ppx to res syntax *)
55-
let printJsx ~isInterface ~filename =
56-
if isInterface then
57-
let parseResult =
58-
Res_driver.parsingEngine.parseInterface ~forPrinter:true ~filename
59-
in
60-
if parseResult.invalid then
61-
begin
62-
Res_diagnostics.printReport parseResult.diagnostics parseResult.source;
63-
exit 1
64-
end
65-
else
66-
let jsxPass = Reactjs_jsx_ppx.rewrite_signature parseResult.parsetree in
67-
Res_printer.printInterface
68-
~width:defaultPrintWidth
69-
~comments:parseResult.comments
70-
jsxPass
71-
else
72-
let parseResult =
73-
Res_driver.parsingEngine.parseImplementation ~forPrinter:true ~filename
74-
in
75-
if parseResult.invalid then
76-
begin
77-
Res_diagnostics.printReport parseResult.diagnostics parseResult.source;
78-
exit 1
79-
end
80-
else
81-
let jsxPass = Reactjs_jsx_ppx.rewrite_implementation parseResult.parsetree in
82-
Res_printer.printImplementation
83-
~width:defaultPrintWidth
84-
~comments:parseResult.comments
85-
jsxPass
86-
[@@raises Invalid_argument, Failure, exit]
87-
8854
(* How does printing Reason to Res work?
8955
* -> open a tempfile
9056
* -> write the source code found in "filename" into the tempfile
@@ -156,8 +122,7 @@ let print language ~input =
156122
len > 0 && String.unsafe_get input (len - 1) = 'i'
157123
in
158124
match language with
159-
| `jsx -> printJsx ~isInterface ~filename:input
160125
| `res -> printRes ~isInterface ~filename:input
161126
| `ml -> printMl ~isInterface ~filename:input
162127
| `refmt path -> printReason ~refmtPath:path ~isInterface ~filename:input
163-
[@@raises Invalid_argument, Failure, Sys_error, exit]
128+
[@@raises Sys_error, exit]

src/res_multi_printer.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
(* Interface to print source code from different languages to res.
22
* Takes a filename called "input" and returns the corresponding formatted res syntax *)
3-
val print: [`jsx | `ml | `res | `refmt of string (* path to refmt *)] -> input: string -> string
3+
val print: [`ml | `res | `refmt of string (* path to refmt *)] -> input: string -> string

tests/res_test.ml

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -126,31 +126,6 @@ let y: float
126126
|}
127127
)
128128

129-
(* test printing of React jsx file *)
130-
let () =
131-
let filename = "./tests/api/resReactJsx.res" in
132-
let prettySource = Res_multi_printer.print `jsx ~input:filename in
133-
assert (
134-
prettySource = {|@bs.obj
135-
external makeProps: (
136-
~msg: 'msg,
137-
~key: string=?,
138-
unit,
139-
) => {
140-
"msg": 'msg,
141-
// test React JSX file
142-
} = ""
143-
144-
let make =
145-
(@warning("-16") ~msg) => {
146-
ReactDOMRe.createDOMElementVariadic("div", [{msg->React.string}])
147-
}
148-
let make = {
149-
let \"ResReactJsx" = (\"Props": {"msg": 'msg}) => make(~msg=\"Props"["msg"])
150-
\"ResReactJsx"
151-
}
152-
|})
153-
154129
let () = print_endline "✅ multi printer api tests"
155130

156131
module OutcomePrinterTests = struct

0 commit comments

Comments
 (0)