@@ -13,7 +13,7 @@ module FunctionName = struct
13
13
end
14
14
15
15
module FunctionArgs = struct
16
- type arg = {label : string ; functionName : FunctionName .t }
16
+ type arg = {label : string ; functionName : FunctionName .t }
17
17
type t = arg list
18
18
19
19
let empty = []
@@ -45,7 +45,7 @@ module FunctionArgs = struct
45
45
end
46
46
47
47
module FunctionCall = struct
48
- type t = {functionName : FunctionName .t ; functionArgs : FunctionArgs .t }
48
+ type t = {functionName : FunctionName .t ; functionArgs : FunctionArgs .t }
49
49
50
50
let substituteName ~sub name =
51
51
match sub |> FunctionArgs. find ~label: name with
@@ -117,7 +117,9 @@ module Stats = struct
117
117
termination = TerminationAnalysisInternal ;
118
118
message =
119
119
Format. asprintf " Cache %s for @{<info>%s@}"
120
- (match hit with true -> " hit" | false -> " miss" )
120
+ (match hit with
121
+ | true -> " hit"
122
+ | false -> " miss" )
121
123
(FunctionCall. toString functionCall);
122
124
})
123
125
@@ -195,7 +197,9 @@ module Progress = struct
195
197
type t = Progress | NoProgress
196
198
197
199
let toString progress =
198
- match progress = Progress with true -> " Progress" | false -> " NoProgress"
200
+ match progress = Progress with
201
+ | true -> " Progress"
202
+ | false -> " NoProgress"
199
203
end
200
204
201
205
module Call = struct
@@ -240,7 +244,9 @@ module Trace = struct
240
244
let none = Toption Rnone
241
245
242
246
let retOptionToString r =
243
- match r = Rsome with true -> " Some" | false -> " None"
247
+ match r = Rsome with
248
+ | true -> " Some"
249
+ | false -> " None"
244
250
245
251
let rec toString trace =
246
252
match trace with
@@ -269,7 +275,7 @@ module Values : sig
269
275
val some : progress :Progress .t -> t
270
276
val toString : t -> string
271
277
end = struct
272
- type t = {none : Progress .t option ; some : Progress .t option }
278
+ type t = {none : Progress .t option ; some : Progress .t option }
273
279
274
280
let getNone {none} = none
275
281
let getSome {some} = some
@@ -279,7 +285,9 @@ end = struct
279
285
| None -> []
280
286
| Some p -> [" some: " ^ Progress. toString p])
281
287
@
282
- match x.none with None -> [] | Some p -> [" none: " ^ Progress. toString p])
288
+ match x.none with
289
+ | None -> []
290
+ | Some p -> [" none: " ^ Progress. toString p])
283
291
|> String. concat " , "
284
292
285
293
let none ~progress = {none = Some progress; some = None }
@@ -301,7 +309,7 @@ end = struct
301
309
end
302
310
303
311
module State = struct
304
- type t = {progress : Progress .t ; trace : Trace .t ; valuesOpt : Values .t option }
312
+ type t = {progress : Progress .t ; trace : Trace .t ; valuesOpt : Values .t option }
305
313
306
314
let toString {progress; trace; valuesOpt} =
307
315
let progressStr =
@@ -340,9 +348,13 @@ module State = struct
340
348
let valuesOpt =
341
349
match (s1.valuesOpt, s2.valuesOpt) with
342
350
| None , valuesOpt -> (
343
- match s1.progress = Progress with true -> valuesOpt | false -> None )
351
+ match s1.progress = Progress with
352
+ | true -> valuesOpt
353
+ | false -> None )
344
354
| valuesOpt , None -> (
345
- match s2.progress = Progress with true -> valuesOpt | false -> None )
355
+ match s2.progress = Progress with
356
+ | true -> valuesOpt
357
+ | false -> None )
346
358
| Some values1 , Some values2 -> Some (Values. nd values1 values2)
347
359
in
348
360
{progress; trace; valuesOpt}
@@ -376,10 +388,10 @@ module Command = struct
376
388
| Nothing
377
389
| Sequence of t list
378
390
| SwitchOption of {
379
- functionCall : FunctionCall .t ;
380
- loc : Location .t ;
381
- some : t ;
382
- none : t ;
391
+ functionCall : FunctionCall .t ;
392
+ loc : Location .t ;
393
+ some : t ;
394
+ none : t ;
383
395
}
384
396
| UnorderedSequence of t list
385
397
@@ -418,7 +430,9 @@ module Command = struct
418
430
| Sequence cs1 :: cs2 -> loop acc (cs1 @ cs2)
419
431
| c :: cs -> loop (c :: acc) cs
420
432
in
421
- match loop [] commands with [c] -> c | cs -> Sequence cs
433
+ match loop [] commands with
434
+ | [c] -> c
435
+ | cs -> Sequence cs
422
436
423
437
let ( +++ ) c1 c2 = sequence [c1; c2]
424
438
@@ -432,15 +446,17 @@ end
432
446
433
447
module Kind = struct
434
448
type t = entry list
435
- and entry = {label : string ; k : t }
449
+ and entry = {label : string ; k : t }
436
450
437
451
let empty = ([] : t )
438
452
439
453
let hasLabel ~label (k : t ) =
440
454
k |> List. exists (fun entry -> entry.label = label)
441
455
442
456
let rec entryToString {label; k} =
443
- match k = [] with true -> label | false -> label ^ " :" ^ (k |> toString)
457
+ match k = [] with
458
+ | true -> label
459
+ | false -> label ^ " :" ^ (k |> toString)
444
460
445
461
and toString (kind : t ) =
446
462
match kind = [] with
456
472
457
473
module FunctionTable = struct
458
474
type functionDefinition = {
459
- mutable body : Command .t option ;
460
- mutable kind : Kind .t ;
475
+ mutable body : Command .t option ;
476
+ mutable kind : Kind .t ;
461
477
}
462
478
463
479
type t = (FunctionName .t , functionDefinition ) Hashtbl .t
@@ -528,7 +544,9 @@ module FindFunctionsCalled = struct
528
544
529
545
let findCallees (expression : Typedtree.expression ) =
530
546
let isFunction =
531
- match expression.exp_desc with Texp_function _ -> true | _ -> false
547
+ match expression.exp_desc with
548
+ | Texp_function _ -> true
549
+ | _ -> false
532
550
in
533
551
let callees = ref StringSet. empty in
534
552
let traverseExpr = traverseExpr ~callees in
@@ -703,10 +721,10 @@ end
703
721
704
722
module Compile = struct
705
723
type ctx = {
706
- currentFunctionName : FunctionName .t ;
707
- functionTable : FunctionTable .t ;
708
- innerRecursiveFunctions : (FunctionName .t , FunctionName .t ) Hashtbl .t ;
709
- isProgressFunction : Path .t -> bool ;
724
+ currentFunctionName : FunctionName .t ;
725
+ functionTable : FunctionTable .t ;
726
+ innerRecursiveFunctions : (FunctionName .t , FunctionName .t ) Hashtbl .t ;
727
+ isProgressFunction : Path .t -> bool ;
710
728
}
711
729
712
730
let rec expression ~ctx (expr : Typedtree.expression ) =
@@ -765,7 +783,9 @@ module Compile = struct
765
783
| _ -> false )
766
784
in
767
785
let argOpt =
768
- match argOpt with Some (_ , Some e ) -> Some e | _ -> None
786
+ match argOpt with
787
+ | Some (_ , Some e ) -> Some e
788
+ | _ -> None
769
789
in
770
790
let functionArg () =
771
791
match
@@ -993,7 +1013,9 @@ module Compile = struct
993
1013
assert false
994
1014
995
1015
and expressionOpt ~ctx eOpt =
996
- match eOpt with None -> Command. nothing | Some e -> e |> expression ~ctx
1016
+ match eOpt with
1017
+ | None -> Command. nothing
1018
+ | Some e -> e |> expression ~ctx
997
1019
998
1020
and evalArgs ~args ~ctx command =
999
1021
(* Don't assume any evaluation order on the arguments *)
@@ -1013,8 +1035,8 @@ module Compile = struct
1013
1035
end
1014
1036
1015
1037
module CallStack = struct
1016
- type frame = {frameNumber : int ; pos : Lexing .position }
1017
- type t = {tbl : (FunctionCall .t , frame ) Hashtbl .t ; mutable size : int }
1038
+ type frame = {frameNumber : int ; pos : Lexing .position }
1039
+ type t = {tbl : (FunctionCall .t , frame ) Hashtbl .t ; mutable size : int }
1018
1040
1019
1041
let create () = {tbl = Hashtbl. create 1 ; size = 0 }
1020
1042
0 commit comments