Skip to content

Commit 87f2119

Browse files
committed
ocamlformat
1 parent c4fa5d4 commit 87f2119

File tree

7 files changed

+36
-42
lines changed

7 files changed

+36
-42
lines changed

compiler/lib/effects.ml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -483,9 +483,8 @@ let cps_instr ~st (instr : instr) : instr =
483483
| Pc (Int a) ->
484484
Let
485485
( x
486-
, Prim
487-
( Extern "caml_alloc_dummy_function"
488-
, [ size; Pc (Int (Int32.succ a)) ] ) )
486+
, Prim (Extern "caml_alloc_dummy_function", [ size; Pc (Int (Int32.succ a)) ])
487+
)
489488
| _ -> assert false)
490489
| Let (x, Apply { f; args; _ }) when not (Var.Set.mem x st.cps_needed) ->
491490
(* At the moment, we turn into CPS any function not called with

compiler/lib/flow.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ let the_def_of info x =
325325
(* If [constant_identical a b = true], then the two values cannot be
326326
distinguished, i.e., they are not different objects (and [caml_js_equals a b
327327
= true]) and if both are floats, they are bitwise equal. *)
328-
let constant_identical ~(target : [`JavaScript | `Wasm]) a b =
328+
let constant_identical ~(target : [ `JavaScript | `Wasm ]) a b =
329329
match a, b, target with
330330
| Int i, Int j, _ -> Int32.equal i j
331331
| Float a, Float b, `JavaScript -> Float.bitwise_equal a b
@@ -347,7 +347,7 @@ let constant_identical ~(target : [`JavaScript | `Wasm]) a b =
347347
| NativeInt _, _, _
348348
| _, NativeInt _, _
349349
| Tuple _, _, _
350-
| _, Tuple _, _-> false
350+
| _, Tuple _, _ -> false
351351

352352
let the_const_of ~target info x =
353353
match x with

compiler/lib/flow.mli

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,16 @@ val get_approx :
5454

5555
val the_def_of : info -> Code.prim_arg -> Code.expr option
5656

57-
val the_const_of : target:[`JavaScript | `Wasm ] -> info -> Code.prim_arg -> Code.constant option
57+
val the_const_of :
58+
target:[ `JavaScript | `Wasm ] -> info -> Code.prim_arg -> Code.constant option
5859

59-
val the_string_of : target:[`JavaScript | `Wasm ] -> info -> Code.prim_arg -> string option
60+
val the_string_of :
61+
target:[ `JavaScript | `Wasm ] -> info -> Code.prim_arg -> string option
6062

61-
val the_native_string_of : target:[`JavaScript | `Wasm ] -> info -> Code.prim_arg -> Code.Native_string.t option
63+
val the_native_string_of :
64+
target:[ `JavaScript | `Wasm ] -> info -> Code.prim_arg -> Code.Native_string.t option
6265

63-
val the_int : target:[`JavaScript | `Wasm ] -> info -> Code.prim_arg -> int32 option
66+
val the_int : target:[ `JavaScript | `Wasm ] -> info -> Code.prim_arg -> int32 option
6467

6568
val update_def : info -> Code.Var.t -> Code.expr -> unit
6669

compiler/lib/ocaml_compiler.ml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,21 @@ let rec constant_of_const ~target c : Code.constant =
2525
| Const_base (Const_int i) ->
2626
Int
2727
(match target with
28-
| `JavaScript -> Int32.of_int_warning_on_overflow i
29-
| `Wasm -> Int31.of_int_warning_on_overflow i)
28+
| `JavaScript -> Int32.of_int_warning_on_overflow i
29+
| `Wasm -> Int31.of_int_warning_on_overflow i)
3030
| Const_base (Const_char c) -> Int (Int32.of_int (Char.code c))
3131
| ((Const_base (Const_string (s, _))) [@if ocaml_version < (4, 11, 0)])
3232
| ((Const_base (Const_string (s, _, _))) [@if ocaml_version >= (4, 11, 0)]) -> String s
3333
| Const_base (Const_float s) -> Float (float_of_string s)
34-
| Const_base (Const_int32 i) ->
35-
(match target with
36-
| `JavaScript -> Int i
37-
| `Wasm -> Int32 i)
34+
| Const_base (Const_int32 i) -> (
35+
match target with
36+
| `JavaScript -> Int i
37+
| `Wasm -> Int32 i)
3838
| Const_base (Const_int64 i) -> Int64 i
39-
| Const_base (Const_nativeint i) ->
40-
(match target with
41-
| `JavaScript -> Int (Int32.of_nativeint_warning_on_overflow i)
42-
| `Wasm -> NativeInt i)
39+
| Const_base (Const_nativeint i) -> (
40+
match target with
41+
| `JavaScript -> Int (Int32.of_nativeint_warning_on_overflow i)
42+
| `Wasm -> NativeInt i)
4343
| Const_immstring s -> String s
4444
| Const_float_array sl ->
4545
let l = List.map ~f:(fun f -> float_of_string f) sl in

compiler/lib/parse_bytecode.ml

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -465,16 +465,16 @@ end = struct
465465
else if tag = Obj.custom_tag
466466
then
467467
match ident_of_custom x with
468-
| Some name when same_ident name ident_32 ->
468+
| Some name when same_ident name ident_32 -> (
469469
let i : int32 = Obj.magic x in
470-
(match target with
471-
| `JavaScript -> Int i
472-
| `Wasm -> Int32 i)
473-
| Some name when same_ident name ident_native ->
470+
match target with
471+
| `JavaScript -> Int i
472+
| `Wasm -> Int32 i)
473+
| Some name when same_ident name ident_native -> (
474474
let i : nativeint = Obj.magic x in
475-
(match target with
476-
| `JavaScript -> Int (Int32.of_nativeint_warning_on_overflow i)
477-
| `Wasm -> NativeInt i)
475+
match target with
476+
| `JavaScript -> Int (Int32.of_nativeint_warning_on_overflow i)
477+
| `Wasm -> NativeInt i)
478478
| Some name when same_ident name ident_64 -> Int64 (Obj.magic x : int64)
479479
| Some name ->
480480
failwith
@@ -493,8 +493,8 @@ end = struct
493493
let i : int = Obj.magic x in
494494
Int
495495
(match target with
496-
| `JavaScript -> Int32.of_int_warning_on_overflow i
497-
| `Wasm -> Int31.of_int_warning_on_overflow i)
496+
| `JavaScript -> Int32.of_int_warning_on_overflow i
497+
| `Wasm -> Int31.of_int_warning_on_overflow i)
498498

499499
let inlined = function
500500
| String _ | NativeString _ -> false
@@ -2385,10 +2385,7 @@ and compile infos pc state instrs =
23852385
(pc + 1)
23862386
state
23872387
(( Let
2388-
( m
2389-
, Prim
2390-
( Extern "caml_get_public_method"
2391-
, [ Pv obj; Pv tag; Pc (Int 0l) ] ) )
2388+
(m, Prim (Extern "caml_get_public_method", [ Pv obj; Pv tag; Pc (Int 0l) ]))
23922389
, loc )
23932390
:: instrs)
23942391
| GETMETHOD ->
@@ -3104,7 +3101,8 @@ let predefined_exceptions ~target =
31043101
(Int
31053102
((* Predefined exceptions are registered in
31063103
Symtable.init with [-index - 1] *)
3107-
Int32.of_int (-index - 1) )))
3104+
Int32.of_int
3105+
(-index - 1))) )
31083106
, noloc )
31093107
; Let (exn, Block (248, [| v_name; v_index |], NotArray, Immutable)), noloc
31103108
; ( Let

compiler/lib/specialize_js.ml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,7 @@ let f_once p =
283283
| "caml_floatarray_unsafe_set" )
284284
, [ _; _; _ ] ) as p) ) ->
285285
let x' = Code.Var.fork x in
286-
let acc =
287-
(Let (x', p), loc) :: (Let (x, Constant (Int 0l)), loc) :: acc
288-
in
286+
let acc = (Let (x', p), loc) :: (Let (x, Constant (Int 0l)), loc) :: acc in
289287
loop acc r
290288
| _ -> loop ((i, loc) :: acc) r)
291289
in

compiler/lib/wasm/wa_generate.ml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -672,11 +672,7 @@ module Generate (Target : Wa_target_sig.S) = struct
672672
if ctx.live.(Var.idx x) = 0
673673
then drop (translate_expr ctx stack_ctx context x e)
674674
else store x (translate_expr ctx stack_ctx context x e)
675-
| Set_field (x, n, Non_float, y) ->
676-
Memory.set_field
677-
(load x)
678-
n
679-
(load y)
675+
| Set_field (x, n, Non_float, y) -> Memory.set_field (load x) n (load y)
680676
| Set_field (x, n, Float, y) ->
681677
Memory.float_array_set
682678
(load x)

0 commit comments

Comments
 (0)