Skip to content

Commit 92e3484

Browse files
committed
remove unused code
1 parent 643f360 commit 92e3484

File tree

3 files changed

+4
-92
lines changed

3 files changed

+4
-92
lines changed

jscomp/bsb_helper/bsb_helper_arg.ml

Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,15 @@ type usage_msg = string
55
type anon_fun = (string -> unit)
66

77
type spec =
8-
| Unit of (unit -> unit)
98
| Set of bool ref
109
| String of (string -> unit)
1110
| Set_string of string ref
12-
| Int of (int -> unit)
13-
| Set_int of int ref
1411

1512
exception Bad of string
16-
(* exception Help of string *)
13+
1714

1815
type error =
1916
| Unknown of string
20-
| Wrong of string * string * string (* option, actual, expected *)
2117
| Missing of string
2218
| Message of string
2319

@@ -68,15 +64,6 @@ let stop_raise progname (error : error) speclist errmsg =
6864
Ext_buffer.add_string b " option '";
6965
Ext_buffer.add_string b s;
7066
Ext_buffer.add_string b "' needs an argument.\n"
71-
| Wrong (opt, arg, expected) ->
72-
Ext_buffer.add_string_char b progname ':';
73-
Ext_buffer.add_string b " wrong argument '";
74-
Ext_buffer.add_string b arg;
75-
Ext_buffer.add_string b "'; option '";
76-
Ext_buffer.add_string b opt;
77-
Ext_buffer.add_string b "' expects ";
78-
Ext_buffer.add_string b expected;
79-
Ext_buffer.add_string b ".\n"
8067
| Message s ->
8168
Ext_buffer.add_string_char b progname ':';
8269
Ext_buffer.add_char_string b ' ' s;
@@ -100,31 +87,14 @@ let parse_exn (speclist : t) anonfun errmsg =
10087
| None -> stop_raise (Unknown s)
10188
in
10289
begin try
103-
let treat_action = function
104-
| Unit f -> f ();
90+
let treat_action spec = match spec with
10591
| Set r -> r := true;
10692
| String f when !current + 1 < l ->
10793
f argv.(!current + 1);
10894
incr current;
10995
| Set_string r when !current + 1 < l ->
11096
r := argv.(!current + 1);
11197
incr current;
112-
| Int f when !current + 1 < l ->
113-
let arg = argv.(!current + 1) in
114-
begin match int_of_string arg with
115-
| i -> f i
116-
| exception _
117-
->
118-
raise (Stop (Wrong (s, arg, "an integer")))
119-
end;
120-
incr current;
121-
| Set_int r when !current + 1 < l ->
122-
let arg = argv.(!current + 1) in
123-
r := (try int_of_string arg
124-
with _ ->
125-
raise (Stop (Wrong (s, arg, "an integer")))
126-
);
127-
incr current;
12898
| _ -> raise (Stop (Missing s))
12999
in
130100
treat_action action
@@ -140,14 +110,3 @@ let parse_exn (speclist : t) anonfun errmsg =
140110
;;
141111

142112

143-
144-
(* let parse l f msg =
145-
try
146-
parse_exn l f msg;
147-
with
148-
| Bad msg ->
149-
output_string stderr msg ; exit 2;
150-
| Help msg ->
151-
output_string stdout msg; exit 0;
152-
;;
153-
*)

jscomp/bsb_helper/bsb_helper_arg.mli

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,9 @@
22

33

44
type spec =
5-
| Unit of (unit -> unit)
65
| Set of bool ref
76
| String of (string -> unit)
87
| Set_string of string ref
9-
| Int of (int -> unit)
10-
| Set_int of int ref
118

129
type key = string
1310
type doc = string

lib/4.06.1/bsb_helper.ml

Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1612,12 +1612,9 @@ module Bsb_helper_arg : sig
16121612

16131613

16141614
type spec =
1615-
| Unit of (unit -> unit)
16161615
| Set of bool ref
16171616
| String of (string -> unit)
16181617
| Set_string of string ref
1619-
| Int of (int -> unit)
1620-
| Set_int of int ref
16211618

16221619
type key = string
16231620
type doc = string
@@ -1639,19 +1636,15 @@ type usage_msg = string
16391636
type anon_fun = (string -> unit)
16401637

16411638
type spec =
1642-
| Unit of (unit -> unit)
16431639
| Set of bool ref
16441640
| String of (string -> unit)
16451641
| Set_string of string ref
1646-
| Int of (int -> unit)
1647-
| Set_int of int ref
16481642

16491643
exception Bad of string
1650-
(* exception Help of string *)
1644+
16511645

16521646
type error =
16531647
| Unknown of string
1654-
| Wrong of string * string * string (* option, actual, expected *)
16551648
| Missing of string
16561649
| Message of string
16571650

@@ -1702,15 +1695,6 @@ let stop_raise progname (error : error) speclist errmsg =
17021695
Ext_buffer.add_string b " option '";
17031696
Ext_buffer.add_string b s;
17041697
Ext_buffer.add_string b "' needs an argument.\n"
1705-
| Wrong (opt, arg, expected) ->
1706-
Ext_buffer.add_string_char b progname ':';
1707-
Ext_buffer.add_string b " wrong argument '";
1708-
Ext_buffer.add_string b arg;
1709-
Ext_buffer.add_string b "'; option '";
1710-
Ext_buffer.add_string b opt;
1711-
Ext_buffer.add_string b "' expects ";
1712-
Ext_buffer.add_string b expected;
1713-
Ext_buffer.add_string b ".\n"
17141698
| Message s ->
17151699
Ext_buffer.add_string_char b progname ':';
17161700
Ext_buffer.add_char_string b ' ' s;
@@ -1734,31 +1718,14 @@ let parse_exn (speclist : t) anonfun errmsg =
17341718
| None -> stop_raise (Unknown s)
17351719
in
17361720
begin try
1737-
let treat_action = function
1738-
| Unit f -> f ();
1721+
let treat_action spec = match spec with
17391722
| Set r -> r := true;
17401723
| String f when !current + 1 < l ->
17411724
f argv.(!current + 1);
17421725
incr current;
17431726
| Set_string r when !current + 1 < l ->
17441727
r := argv.(!current + 1);
17451728
incr current;
1746-
| Int f when !current + 1 < l ->
1747-
let arg = argv.(!current + 1) in
1748-
begin match int_of_string arg with
1749-
| i -> f i
1750-
| exception _
1751-
->
1752-
raise (Stop (Wrong (s, arg, "an integer")))
1753-
end;
1754-
incr current;
1755-
| Set_int r when !current + 1 < l ->
1756-
let arg = argv.(!current + 1) in
1757-
r := (try int_of_string arg
1758-
with _ ->
1759-
raise (Stop (Wrong (s, arg, "an integer")))
1760-
);
1761-
incr current;
17621729
| _ -> raise (Stop (Missing s))
17631730
in
17641731
treat_action action
@@ -1775,17 +1742,6 @@ let parse_exn (speclist : t) anonfun errmsg =
17751742

17761743

17771744

1778-
(* let parse l f msg =
1779-
try
1780-
parse_exn l f msg;
1781-
with
1782-
| Bad msg ->
1783-
output_string stderr msg ; exit 2;
1784-
| Help msg ->
1785-
output_string stdout msg; exit 0;
1786-
;;
1787-
*)
1788-
17891745
end
17901746
module Ext_pervasives : sig
17911747
#1 "ext_pervasives.mli"

0 commit comments

Comments
 (0)