Skip to content

Commit cd1d0a9

Browse files
committed
indentation friendly
1 parent 25b10d8 commit cd1d0a9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+10098
-10106
lines changed

Diff for: jscomp/bspp/parser.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ type token =
118118
| WHILE
119119
| WITH
120120
| COMMENT of (string * Location.t)
121-
#if HAS_DOCSTRINGS then
121+
#if HAS_DOCSTRINGS
122122
| DOCSTRING of (Docstrings.docstring)
123123
#end
124124
| EOL

Diff for: jscomp/build_tests/ocamlgraph/libx/bitv.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ let to_int64_us _ = failwith "todo"
595595
let of_int64_s _ = failwith "todo"
596596
let to_int64_s _ = failwith "todo"
597597

598-
#if 0 then
598+
#if 0
599599
(* [Nativeint] *)
600600
let select_of f32 f64 = match Sys.word_size with
601601
| 32 -> (fun i -> f32 (Nativeint.to_int32 i))

Diff for: jscomp/common/js_config.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ let cross_module_inline = ref false
4040
let diagnose = ref false
4141
let get_diagnose () =
4242
!diagnose
43-
#if undefined BS_RELEASE_BUILD then
43+
#if undefined BS_RELEASE_BUILD
4444
|| Sys.getenv_opt "RES_DEBUG_FILE" <> None
4545
#end
4646

Diff for: jscomp/core/bs_cmi_load.ml

+2-3
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@
2222
* along with this program; if not, write to the Free Software
2323
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
2424

25-
#if
26-
BS_RELEASE_BUILD
25+
#if BS_RELEASE_BUILD
2726
(*true *)
28-
then
27+
2928

3029
let load_cmi ~unit_name : Env.Persistent_signature.t option =
3130
match Config_util.find_opt (unit_name ^".cmi") with

Diff for: jscomp/core/bs_conditional_initial.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ let setup_env () =
6161
Lambda.blk_record := Record_attributes_check.blk_record;
6262
Matching.names_from_construct_pattern :=
6363
Matching_polyfill.names_from_construct_pattern;
64-
#if undefined BS_RELEASE_BUILD then
64+
#if undefined BS_RELEASE_BUILD
6565
Printexc.record_backtrace true;
6666
(let root_dir =
6767
Filename.dirname
@@ -76,7 +76,7 @@ let setup_env () =
7676
Lexer.replace_directive_bool "BS" true;
7777
Lexer.replace_directive_bool "JS" true;
7878
Lexer.replace_directive_string "BS_VERSION" Bs_version.version
79-
#if false then
79+
#if false
8080
; Switch.cut := 100 (* tweakable but not very useful *)
8181
#end
8282

Diff for: jscomp/core/js_cmj_load.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ let load_unit_with_file unit_name : Js_cmj_format.cmj_load_info =
5555
| None ->
5656
if !Js_config.no_stdlib then Bs_exception.error (Cmj_not_found unit_name)
5757
else
58-
#if BS_RELEASE_BUILD then
58+
#if BS_RELEASE_BUILD
5959
Js_cmj_load_builtin_unit.load_builin_unit unit_name
6060
#else
6161
Bs_exception.error (Cmj_not_found unit_name)

Diff for: jscomp/core/js_name_of_module_id.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ let string_of_module_id
190190

191191

192192
(* Override it in browser *)
193-
#if BS_BROWSER then
193+
#if BS_BROWSER
194194
let string_of_module_id_in_browser (x : Lam_module_ident.t) =
195195
match x.kind with
196196
| External {name} -> name

Diff for: jscomp/core/js_pass_debug.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727

2828

29-
#if BS_BROWSER || BS_RELEASE_BUILD then
29+
#if BS_BROWSER || BS_RELEASE_BUILD
3030
let dump _ (prog : J.program) =
3131
prog
3232
#else

Diff for: jscomp/core/lam_compile_main.ml

+6-6
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ let no_side_effects (rest : Lam_group.t list) : string option =
108108

109109

110110
let _d = fun s lam ->
111-
#if undefined BS_RELEASE_BUILD then
111+
#if undefined BS_RELEASE_BUILD
112112
Lam_util.dump s lam ;
113113
Ext_log.dwarn ~__POS__ "START CHECKING PASS %s@." s;
114114
ignore @@ Lam_check.check !Location.input_name lam;
@@ -128,7 +128,7 @@ let compile
128128
let export_ident_sets = Set_ident.of_list export_idents in
129129
(* To make toplevel happy - reentrant for js-demo *)
130130
let () =
131-
#if undefined BS_RELEASE_BUILD then
131+
#if undefined BS_RELEASE_BUILD
132132
Ext_list.iter export_idents
133133
(fun id -> Ext_log.dwarn ~__POS__ "export idents: %s/%d" id.name id.stamp) ;
134134
#end
@@ -187,7 +187,7 @@ let compile
187187
|> _d "scc" *)
188188
|> Lam_pass_exits.simplify_exits
189189
|> _d "simplify_lets"
190-
#if undefined BS_RELEASE_BUILD then
190+
#if undefined BS_RELEASE_BUILD
191191
|> (fun lam ->
192192
let () =
193193
Ext_log.dwarn ~__POS__ "Before coercion: %a@." Lam_stats.print meta in
@@ -200,7 +200,7 @@ let compile
200200
Lam_coercion.coerce_and_group_big_lambda meta lam
201201
in
202202

203-
#if undefined BS_RELEASE_BUILD then
203+
#if undefined BS_RELEASE_BUILD
204204
let () =
205205
Ext_log.dwarn ~__POS__ "After coercion: %a@." Lam_stats.print meta ;
206206
if Js_config.get_diagnose () then
@@ -213,15 +213,15 @@ let compile
213213
in
214214
#end
215215
let maybe_pure = no_side_effects groups in
216-
#if undefined BS_RELEASE_BUILD then
216+
#if undefined BS_RELEASE_BUILD
217217
let () = Ext_log.dwarn ~__POS__ "\n@[[TIME:]Pre-compile: %f@]@." (Sys.time () *. 1000.) in
218218
#end
219219
let body =
220220
Ext_list.map groups (fun group -> compile_group meta group)
221221
|> Js_output.concat
222222
|> Js_output.output_as_block
223223
in
224-
#if undefined BS_RELEASE_BUILD then
224+
#if undefined BS_RELEASE_BUILD
225225
let () = Ext_log.dwarn ~__POS__ "\n@[[TIME:]Post-compile: %f@]@." (Sys.time () *. 1000.) in
226226
#end
227227
(* The file is not big at all compared with [cmo] *)

Diff for: jscomp/core/lam_pass_lets_dce.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ let apply_lets occ lambda =
259259

260260
let simplify_lets (lam : Lam.t) : Lam.t =
261261
let occ = Lam_pass_count.collect_occurs lam in
262-
#if undefined BS_RELEASE_BUILD then
262+
#if undefined BS_RELEASE_BUILD
263263
Ext_log.dwarn ~__POS__ "@[%a@]@." Lam_pass_count.pp_occ_tbl occ ;
264264
#end
265265
apply_lets occ lam

Diff for: jscomp/core/lam_util.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ let generate_label ?(name="") () =
211211
incr count;
212212
Printf.sprintf "%s_tailcall_%04d" name !count
213213

214-
#if BS_BROWSER || BS_RELEASE_BUILD then
214+
#if BS_BROWSER || BS_RELEASE_BUILD
215215
let dump ext lam =
216216
()
217217
#else

Diff for: jscomp/ext/ext_string.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ let replace_backward_slash (x : string)=
332332

333333
let empty = ""
334334

335-
#if BS_BROWSER || BS_PACK then
335+
#if BS_BROWSER || BS_PACK
336336
let compare = Bs_hash_stubs.string_length_based_compare
337337
#else
338338
external compare : string -> string -> int = "caml_string_length_based_compare" [@@noalloc];;

Diff for: jscomp/ext/hash_gen.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ end
249249

250250

251251

252-
#if 0 then
252+
#if 0
253253
let rec bucket_length accu = function
254254
| Empty -> accu
255255
| Cons l -> bucket_length (accu + 1) l.next

Diff for: jscomp/ext/hash_set_gen.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ sig
178178
end
179179

180180

181-
#if 0 then
181+
#if 0
182182
let rec bucket_length accu = function
183183
| Empty -> accu
184184
| Cons l -> bucket_length (accu + 1) l.next

Diff for: jscomp/frontend/external_ffi_types.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ let is_bs_primitive s =
263263
String.unsafe_get s 1 = '\149'
264264

265265
let () = Oprint.map_primitive_name :=
266-
#if BS_RELEASE_BUILD then
266+
#if BS_RELEASE_BUILD
267267
(fun s ->
268268
if is_bs_primitive s then "BS:external"
269269
else s )

Diff for: jscomp/main/builtin_cmj_datasets.ml

+8-8
Large diffs are not rendered by default.

Diff for: jscomp/main/js_main.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ let bs_version_string =
211211
" ( Using OCaml:" ^ Config.version ^ " )"
212212

213213
let print_version_string () =
214-
#if undefined BS_RELEASE_BUILD then
214+
#if undefined BS_RELEASE_BUILD
215215
print_string "DEV VERSION: ";
216216
#end
217217
print_endline bs_version_string;
@@ -499,7 +499,7 @@ let _ : unit =
499499
exit 2
500500
| x ->
501501
begin
502-
#if false (* undefined BS_RELEASE_BUILD *) then
502+
#if false (* undefined BS_RELEASE_BUILD *)
503503
Ext_obj.bt ();
504504
#end
505505
Location.report_exception ppf x;

Diff for: jscomp/ounit_tests/ounit_hash_set_tests.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ let suites =
9191

9292
end
9393
;
94-
#if 0 then
94+
#if 0
9595
__LOC__ >:: begin fun _ ->
9696
let v = Ordered_hash_set_string.create 3 in
9797
for i = 0 to 10 do

Diff for: jscomp/ounit_tests/ounit_ordered_hash_set_tests.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ let (=~) = OUnit.assert_equal
77
let suites =
88
__FILE__
99
>::: [
10-
#if 0 then
10+
#if 0
1111
__LOC__ >:: begin fun _ ->
1212
let a = [|"a";"b";"c"|] in
1313
Ordered_hash_set_string.(to_sorted_array (of_array a))

Diff for: jscomp/runtime/caml_io.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ let stderr = {
5353
Js.log (Caml_string_extern.slice s 0 v) (* TODO: change to Js.error*)
5454
else Js.log s
5555
}
56-
#if 0 then
56+
#if 0
5757
type in_channel
5858

5959
let caml_ml_open_descriptor_in (i : int) : in_channel =

Diff for: jscomp/stdlib-406/array.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ external unsafe_set: 'a array -> int -> 'a -> unit = "%array_unsafe_set"
2323
external make: int -> 'a -> 'a array = "caml_make_vect"
2424
external create: int -> 'a -> 'a array = "caml_make_vect"
2525
external unsafe_sub : 'a array -> int -> int -> 'a array = "caml_array_sub"
26-
#if BS then
26+
#if BS
2727
external append_prim : 'a array -> 'a array -> 'a array = "concat"
2828
[@@bs.send]
2929
#else

Diff for: jscomp/stdlib-406/buffer.ml

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type t =
2323

2424
let create n =
2525
let n = if n < 1 then 1 else n in
26-
#if BS then
26+
#if BS
2727
#else
2828
let n = if n > Sys.max_string_length then Sys.max_string_length else n in
2929
#end
@@ -65,7 +65,7 @@ let resize b more =
6565
let len = b.length in
6666
let new_len = ref len in
6767
while b.position + more > !new_len do new_len := 2 * !new_len done;
68-
#if BS then
68+
#if BS
6969
#else
7070
if !new_len > Sys.max_string_length then begin
7171
if b.position + more <= Sys.max_string_length
@@ -198,7 +198,7 @@ let rec add_channel_rec b ic len =
198198

199199
let add_channel b ic len =
200200
if len < 0
201-
#if BS then
201+
#if BS
202202
#else
203203
|| len > Sys.max_string_length
204204
#end

Diff for: jscomp/stdlib-406/callback.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
[@@@bs.config { flags = [|"-bs-no-cross-module-opt" |]}]
1616
(* Registering OCaml values with the C runtime for later callbacks *)
1717

18-
#if BS then
18+
#if BS
1919
let register _ _ = ()
2020
let register_exception _ _ = ()
2121
#else

Diff for: jscomp/stdlib-406/camlinternalFormat.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2785,7 +2785,7 @@ let fmt_ebb_of_string ?legacy_behavior str =
27852785
match str.[str_ind] with
27862786
| '0' .. '9' as c ->
27872787
let new_acc = acc * 10 + (int_of_char c - int_of_char '0') in
2788-
#if BS then
2788+
#if BS
27892789
#else
27902790
if new_acc > Sys.max_string_length then
27912791
failwith_message

Diff for: jscomp/stdlib-406/hashtbl.ml

+13-10
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,14 @@ let flip_ongoing_traversal h =
5454

5555
(* To pick random seeds if requested *)
5656

57-
let randomized_default =
58-
#if BS then false
57+
58+
#if BS
59+
let randomized_default = false
5960
#else
60-
let params =
61-
try Sys.getenv "OCAMLRUNPARAM" with Not_found ->
62-
try Sys.getenv "CAMLRUNPARAM" with Not_found -> "" in
63-
String.contains params 'R'
61+
let params =
62+
try Sys.getenv "OCAMLRUNPARAM" with Not_found ->
63+
try Sys.getenv "CAMLRUNPARAM" with Not_found -> "" in
64+
String.contains params 'R'
6465
#end
6566

6667
let randomized = ref randomized_default
@@ -74,7 +75,7 @@ let prng = lazy (Random.State.make_self_init())
7475

7576
let rec power_2_above x n =
7677
if x >= n then x
77-
#if BS then
78+
#if BS
7879
else if x * 2 < x then x (* overflow *)
7980
#else
8081
else if x * 2 > Sys.max_array_length then x
@@ -127,11 +128,13 @@ let resize indexfun h =
127128
let odata = h.data in
128129
let osize = Array.length odata in
129130
let nsize = osize * 2 in
130-
#if BS then
131-
if nsize >= osize then begin
131+
if
132+
#if BS
133+
nsize >= osize
132134
#else
133-
if nsize < Sys.max_array_length then begin
135+
nsize < Sys.max_array_length
134136
#end
137+
then begin
135138
let ndata = Array.make nsize Empty in
136139
let ndata_tail = Array.make nsize Empty in
137140
let inplace = not (ongoing_traversal h) in

Diff for: jscomp/stdlib-406/lexing.ml

+4-4
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,12 @@ let lex_refill read_fun aux_buffer lexbuf =
109109
space since n <= String.length aux_buffer <= String.length buffer.
110110
Watch out for string length overflow, though. *)
111111
let newlen =
112-
#if BS then
113-
(2 * Bytes.length lexbuf.lex_buffer)
112+
#if BS
113+
(2 * Bytes.length lexbuf.lex_buffer)
114114
#else
115-
min (2 * Bytes.length lexbuf.lex_buffer) Sys.max_string_length
115+
min (2 * Bytes.length lexbuf.lex_buffer) Sys.max_string_length
116116
#end
117-
in
117+
in
118118
if lexbuf.lex_buffer_len - lexbuf.lex_start_pos + n > newlen
119119
then failwith "Lexing.lex_refill: cannot grow buffer";
120120
let newbuf = Bytes.create newlen in

Diff for: jscomp/stdlib-406/parsing.ml

+4-3
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,11 @@ let yyparse tables start lexer lexbuf =
177177
| _ ->
178178
current_lookahead_fun :=
179179
(fun tok ->
180-
#if BS then
181-
if Js.typeof tok <> "number"
180+
if
181+
#if BS
182+
(Js.typeof tok <> "number")
182183
#else
183-
if Obj.is_block tok
184+
(Obj.is_block tok )
184185
#end
185186
then tables.transl_block.(Obj.tag tok) = curr_char
186187
else tables.transl_const.(Obj.magic tok) = curr_char);

0 commit comments

Comments
 (0)