Skip to content

Commit be52429

Browse files
committed
delay command line ppx
1 parent 47c76e9 commit be52429

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

jscomp/core/js_implementation.ml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ let after_parsing_sig ppf outputprefix ast =
103103

104104
let interface ppf fname outputprefix =
105105
Compmisc.init_path false;
106-
Pparse_driver.parse_interface ~tool_name:Js_config.tool_name ppf fname
106+
Pparse_driver.parse_interface ppf fname
107+
|> Cmd_ppx_apply.apply_rewriters ~restore:false ~tool_name:Js_config.tool_name Mli
107108
|> Ppx_entry.rewrite_signature
108109
|> print_if_pipe ppf Clflags.dump_parsetree Printast.interface
109110
|> print_if_pipe ppf Clflags.dump_source Pprintast.signature
@@ -200,8 +201,9 @@ let after_parsing_impl ppf outputprefix (ast : Parsetree.structure) =
200201
process_with_gentype (outputprefix ^ ".cmt")
201202
end
202203
let implementation ppf fname outputprefix =
203-
Compmisc.init_path false;
204-
Pparse_driver.parse_implementation ~tool_name:Js_config.tool_name ppf fname
204+
Compmisc.init_path false;
205+
Pparse_driver.parse_implementation ppf fname
206+
|> Cmd_ppx_apply.apply_rewriters ~restore:false ~tool_name:Js_config.tool_name Ml
205207
|> Ppx_entry.rewrite_implementation
206208
|> print_if_pipe ppf Clflags.dump_parsetree Printast.implementation
207209
|> print_if_pipe ppf Clflags.dump_source Pprintast.structure

jscomp/core/pparse_driver.ml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ let file_aux ppf inputfile (type a) (parse_fun : _ -> a)
7373

7474

7575

76-
let parse_file kind ppf sourcefile =
76+
let parse_file (type a) (kind : a Ml_binary.kind) (ppf : Format.formatter) (sourcefile : string) : a =
7777
Location.set_input_name sourcefile;
7878
let inputfile = preprocess sourcefile in
7979
let ast =
@@ -88,9 +88,9 @@ let parse_file kind ppf sourcefile =
8888

8989

9090

91-
let parse_implementation ppf ~tool_name sourcefile =
92-
Cmd_ppx_apply.apply_rewriters ~restore:false ~tool_name Ml (parse_file
91+
let parse_implementation ppf sourcefile =
92+
(parse_file
9393
Ml ppf sourcefile)
94-
let parse_interface ppf ~tool_name sourcefile =
95-
Cmd_ppx_apply.apply_rewriters ~restore:false ~tool_name Mli (parse_file
96-
Mli ppf sourcefile)
94+
95+
let parse_interface ppf sourcefile =
96+
parse_file Mli ppf sourcefile

jscomp/core/pparse_driver.mli

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22

33
val parse_implementation:
44
Format.formatter ->
5-
tool_name:string ->
65
string -> Parsetree.structure
76

87

98
val parse_interface:
109
Format.formatter ->
11-
tool_name:string ->
10+
1211
string -> Parsetree.signature

0 commit comments

Comments
 (0)