Skip to content

Commit 865f29b

Browse files
committed
Remove command line processing.
1 parent 2fed4e8 commit 865f29b

File tree

5 files changed

+16
-122
lines changed

5 files changed

+16
-122
lines changed

jscomp/core/js_implementation.ml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,9 @@ let output_deps_set name set =
4141
set;
4242
output_string stdout "\n"
4343

44-
let process_with_gentype filename =
45-
match !Clflags.bs_gentype with
46-
| false -> ()
47-
| true ->
48-
GenType.executeCliCommand
49-
~printUsageAndExit:(fun () -> ())
50-
(Add (filename ^ ":" ^ !Location.input_name))
44+
let process_with_gentype cmt_file =
45+
if !Clflags.bs_gentype then
46+
GenType.processCmt cmt_file
5147

5248
let after_parsing_sig ppf outputprefix ast =
5349
Ast_config.iter_on_bs_config_sigi ast;

jscomp/gentype/GenType.ml

Lines changed: 5 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,5 @@
1-
let version = Version.version
2-
3-
type cliCommand = Add of string | NoOp
4-
5-
let executeCliCommand ~printUsageAndExit cliCommand =
6-
match cliCommand with
7-
| Add s ->
8-
Log_.Color.forceColor := true;
9-
let splitColon = Str.split (Str.regexp ":") s in
10-
let cmt, mlast =
11-
match splitColon with
12-
| cmt :: rest ->
13-
let mlast = rest |> String.concat "" in
14-
(cmt, mlast)
15-
| _ -> assert false
16-
in
17-
let config = Paths.readConfig ~namespace:(cmt |> Paths.findNameSpace) in
18-
if !Debug.basic then Log_.item "Add %s %s\n" cmt mlast;
19-
cmt |> GenTypeMain.processCmtFile ~config;
20-
exit 0
21-
| NoOp -> printUsageAndExit ()
22-
23-
let cli () =
24-
let cliCommand = ref NoOp in
25-
let usage = "genType version " ^ version in
26-
let versionAndExit () =
27-
print_endline usage;
28-
exit 0
29-
in
30-
let rec printUsageAndExit () =
31-
Arg.usage speclist usage;
32-
exit 0
33-
and setCliCommand command =
34-
if !cliCommand <> NoOp then printUsageAndExit ();
35-
cliCommand := command
36-
and setAdd s = Add s |> setCliCommand
37-
and speclist =
38-
[
39-
("-cmt-add", Arg.String setAdd, "compile a .cmt[i] file");
40-
("-version", Arg.Unit versionAndExit, "show version information and exit");
41-
("--version", Arg.Unit versionAndExit, "show version information and exit");
42-
]
43-
in
44-
let anonArg s = print_endline s
45-
in
46-
Arg.parse speclist anonArg usage;
47-
executeCliCommand ~printUsageAndExit !cliCommand
1+
let processCmt cmt =
2+
Log_.Color.forceColor := true;
3+
let config = Paths.readConfig ~namespace:(cmt |> Paths.findNameSpace) in
4+
if !Debug.basic then Log_.item "Add %s\n" cmt;
5+
cmt |> GenTypeMain.processCmtFile ~config

jscomp/gentype/Version.ml

Lines changed: 0 additions & 4 deletions
This file was deleted.

lib/4.06.1/whole_compiler.ml

Lines changed: 8 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -241928,66 +241928,15 @@ let processCmtFile ~config cmt =
241928241928
outputFile |> GeneratedFiles.logFileAction NoMatch;
241929241929
if Sys.file_exists outputFile then Unix.unlink outputFile)
241930241930

241931-
end
241932-
module Version
241933-
= struct
241934-
#1 "Version.ml"
241935-
241936-
(* CREATED BY genType/scripts/bump_version_module.js *)
241937-
(* DO NOT MODIFY BY HAND, WILL BE AUTOMATICALLY UPDATED BY npm version *)
241938-
let version = "4.4.0";
241939-
241940241931
end
241941241932
module GenType
241942241933
= struct
241943241934
#1 "GenType.ml"
241944-
let version = Version.version
241945-
241946-
type cliCommand = Add of string | NoOp
241947-
241948-
let executeCliCommand ~printUsageAndExit cliCommand =
241949-
match cliCommand with
241950-
| Add s ->
241951-
Log_.Color.forceColor := true;
241952-
let splitColon = Str.split (Str.regexp ":") s in
241953-
let cmt, mlast =
241954-
match splitColon with
241955-
| cmt :: rest ->
241956-
let mlast = rest |> String.concat "" in
241957-
(cmt, mlast)
241958-
| _ -> assert false
241959-
in
241960-
let config = Paths.readConfig ~namespace:(cmt |> Paths.findNameSpace) in
241961-
if !Debug.basic then Log_.item "Add %s %s\n" cmt mlast;
241962-
cmt |> GenTypeMain.processCmtFile ~config;
241963-
exit 0
241964-
| NoOp -> printUsageAndExit ()
241965-
241966-
let cli () =
241967-
let cliCommand = ref NoOp in
241968-
let usage = "genType version " ^ version in
241969-
let versionAndExit () =
241970-
print_endline usage;
241971-
exit 0
241972-
in
241973-
let rec printUsageAndExit () =
241974-
Arg.usage speclist usage;
241975-
exit 0
241976-
and setCliCommand command =
241977-
if !cliCommand <> NoOp then printUsageAndExit ();
241978-
cliCommand := command
241979-
and setAdd s = Add s |> setCliCommand
241980-
and speclist =
241981-
[
241982-
("-cmt-add", Arg.String setAdd, "compile a .cmt[i] file");
241983-
("-version", Arg.Unit versionAndExit, "show version information and exit");
241984-
("--version", Arg.Unit versionAndExit, "show version information and exit");
241985-
]
241986-
in
241987-
let anonArg s = print_endline s
241988-
in
241989-
Arg.parse speclist anonArg usage;
241990-
executeCliCommand ~printUsageAndExit !cliCommand
241935+
let processCmt cmt =
241936+
Log_.Color.forceColor := true;
241937+
let config = Paths.readConfig ~namespace:(cmt |> Paths.findNameSpace) in
241938+
if !Debug.basic then Log_.item "Add %s\n" cmt;
241939+
cmt |> GenTypeMain.processCmtFile ~config
241991241940

241992241941
end
241993241942
module Includeclass : sig
@@ -291711,13 +291660,9 @@ let output_deps_set name set =
291711291660
set;
291712291661
output_string stdout "\n"
291713291662

291714-
let process_with_gentype filename =
291715-
match !Clflags.bs_gentype with
291716-
| false -> ()
291717-
| true ->
291718-
GenType.executeCliCommand
291719-
~printUsageAndExit:(fun () -> ())
291720-
(Add (filename ^ ":" ^ !Location.input_name))
291663+
let process_with_gentype cmt_file =
291664+
if !Clflags.bs_gentype then
291665+
GenType.processCmt cmt_file
291721291666

291722291667
let after_parsing_sig ppf outputprefix ast =
291723291668
Ast_config.iter_on_bs_config_sigi ast;

lib/4.06.1/whole_compiler.ml.d

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,6 @@
472472
../lib/4.06.1/whole_compiler.ml: ./gentype/TypeEnv.ml
473473
../lib/4.06.1/whole_compiler.ml: ./gentype/TypeEnv.mli
474474
../lib/4.06.1/whole_compiler.ml: ./gentype/TypeVars.ml
475-
../lib/4.06.1/whole_compiler.ml: ./gentype/Version.ml
476475
../lib/4.06.1/whole_compiler.ml: ./js_parser/comment_attachment.ml
477476
../lib/4.06.1/whole_compiler.ml: ./js_parser/declaration_parser.ml
478477
../lib/4.06.1/whole_compiler.ml: ./js_parser/enum_common.ml

0 commit comments

Comments
 (0)