Skip to content

Commit 1b5e389

Browse files
authored
Remove verbose syntax in pickling code (#18372)
1 parent 88f8041 commit 1b5e389

File tree

1 file changed

+104
-86
lines changed

1 file changed

+104
-86
lines changed

src/Compiler/TypedTree/TypedTreePickle.fs

Lines changed: 104 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,9 @@ let u_byteB st =
364364

365365
type unpickler<'T> = ReaderState -> 'T
366366

367-
let u_bool st = let b = u_byte st in (b = 1)
367+
let u_bool st =
368+
let b = u_byte st
369+
b = 1
368370

369371
/// Unpickle an uncompressed integer from the main stream
370372
let prim_u_int32 st =
@@ -465,21 +467,21 @@ let u_used_space1 f st =
465467
None
466468

467469
let inline u_tup2 p1 p2 (st: ReaderState) =
468-
let a = p1 st in
469-
let b = p2 st in
470+
let a = p1 st
471+
let b = p2 st
470472
(a, b)
471473

472474
let inline u_tup3 p1 p2 p3 (st: ReaderState) =
473-
let a = p1 st in
474-
let b = p2 st in
475-
let c = p3 st in
475+
let a = p1 st
476+
let b = p2 st
477+
let c = p3 st
476478
(a, b, c)
477479

478480
let inline u_tup4 p1 p2 p3 p4 (st: ReaderState) =
479-
let a = p1 st in
480-
let b = p2 st in
481-
let c = p3 st in
482-
let d = p4 st in
481+
let a = p1 st
482+
let b = p2 st
483+
let c = p3 st
484+
let d = p4 st
483485
(a, b, c, d)
484486

485487
let inline u_tup5 p1 p2 p3 p4 p5 (st: ReaderState) =
@@ -491,71 +493,71 @@ let inline u_tup5 p1 p2 p3 p4 p5 (st: ReaderState) =
491493
(a, b, c, d, e)
492494

493495
let inline u_tup6 p1 p2 p3 p4 p5 p6 (st: ReaderState) =
494-
let a = p1 st in
495-
let b = p2 st in
496-
let c = p3 st in
497-
let d = p4 st in
498-
let e = p5 st in
499-
let f = p6 st in
496+
let a = p1 st
497+
let b = p2 st
498+
let c = p3 st
499+
let d = p4 st
500+
let e = p5 st
501+
let f = p6 st
500502
(a, b, c, d, e, f)
501503

502504
let inline u_tup8 p1 p2 p3 p4 p5 p6 p7 p8 (st: ReaderState) =
503-
let a = p1 st in
504-
let b = p2 st in
505-
let c = p3 st in
506-
let d = p4 st in
507-
let e = p5 st in
508-
let f = p6 st in
509-
let x7 = p7 st in
510-
let x8 = p8 st in
505+
let a = p1 st
506+
let b = p2 st
507+
let c = p3 st
508+
let d = p4 st
509+
let e = p5 st
510+
let f = p6 st
511+
let x7 = p7 st
512+
let x8 = p8 st
511513
(a, b, c, d, e, f, x7, x8)
512514

513515
let inline u_tup9 p1 p2 p3 p4 p5 p6 p7 p8 p9 (st: ReaderState) =
514-
let a = p1 st in
515-
let b = p2 st in
516-
let c = p3 st in
517-
let d = p4 st in
518-
let e = p5 st in
519-
let f = p6 st in
520-
let x7 = p7 st in
521-
let x8 = p8 st in
522-
let x9 = p9 st in
516+
let a = p1 st
517+
let b = p2 st
518+
let c = p3 st
519+
let d = p4 st
520+
let e = p5 st
521+
let f = p6 st
522+
let x7 = p7 st
523+
let x8 = p8 st
524+
let x9 = p9 st
523525
(a, b, c, d, e, f, x7, x8, x9)
524526

525527
let inline u_tup13 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 (st: ReaderState) =
526-
let a = p1 st in
527-
let b = p2 st in
528-
let c = p3 st in
529-
let d = p4 st in
530-
let e = p5 st in
531-
let f = p6 st in
532-
let x7 = p7 st in
533-
let x8 = p8 st in
534-
let x9 = p9 st in
535-
let x10 = p10 st in
536-
let x11 = p11 st in
537-
let x12 = p12 st in
538-
let x13 = p13 st in
528+
let a = p1 st
529+
let b = p2 st
530+
let c = p3 st
531+
let d = p4 st
532+
let e = p5 st
533+
let f = p6 st
534+
let x7 = p7 st
535+
let x8 = p8 st
536+
let x9 = p9 st
537+
let x10 = p10 st
538+
let x11 = p11 st
539+
let x12 = p12 st
540+
let x13 = p13 st
539541
(a, b, c, d, e, f, x7, x8, x9, x10, x11, x12, x13)
540542

541543
let inline u_tup17 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 p17 (st: ReaderState) =
542-
let a = p1 st in
543-
let b = p2 st in
544-
let c = p3 st in
545-
let d = p4 st in
546-
let e = p5 st in
547-
let f = p6 st in
548-
let x7 = p7 st in
549-
let x8 = p8 st in
550-
let x9 = p9 st in
551-
let x10 = p10 st in
552-
let x11 = p11 st in
553-
let x12 = p12 st in
554-
let x13 = p13 st in
555-
let x14 = p14 st in
556-
let x15 = p15 st in
557-
let x16 = p16 st in
558-
let x17 = p17 st in
544+
let a = p1 st
545+
let b = p2 st
546+
let c = p3 st
547+
let d = p4 st
548+
let e = p5 st
549+
let f = p6 st
550+
let x7 = p7 st
551+
let x8 = p8 st
552+
let x9 = p9 st
553+
let x10 = p10 st
554+
let x11 = p11 st
555+
let x12 = p12 st
556+
let x13 = p13 st
557+
let x14 = p14 st
558+
let x15 = p15 st
559+
let x16 = p16 st
560+
let x17 = p17 st
559561
(a, b, c, d, e, f, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17)
560562

561563
//---------------------------------------------------------------------------
@@ -1305,10 +1307,12 @@ let u_ILHasThis st =
13051307
| _ -> ufailwith st "u_ILHasThis"
13061308

13071309
let u_ILCallConv st =
1308-
let a, b = u_tup2 u_ILHasThis u_ILBasicCallConv st in Callconv(a, b)
1310+
let a, b = u_tup2 u_ILHasThis u_ILBasicCallConv st
1311+
Callconv(a, b)
13091312

13101313
let u_ILTypeRef st =
1311-
let a, b, c = u_tup3 u_ILScopeRef u_strings u_string st in ILTypeRef.Create(a, b, c)
1314+
let a, b, c = u_tup3 u_ILScopeRef u_strings u_string st
1315+
ILTypeRef.Create(a, b, c)
13121316

13131317
let u_ILArrayShape =
13141318
u_wrap (ILArrayShape) (u_list (u_tup2 (u_option u_int32) (u_option u_int32)))
@@ -1341,7 +1345,8 @@ and u_ILCallSig =
13411345
(u_tup3 u_ILCallConv u_ILTypes u_ILType)
13421346

13431347
and u_ILTypeSpec st =
1344-
let a, b = u_tup2 u_ILTypeRef u_ILTypes st in ILTypeSpec.Create(a, b)
1348+
let a, b = u_tup2 u_ILTypeRef u_ILTypes st
1349+
ILTypeSpec.Create(a, b)
13451350

13461351
let p_ILMethodRef (x: ILMethodRef) st =
13471352
p_tup6
@@ -1884,22 +1889,22 @@ let p_xmldoc (doc: XmlDoc) st =
18841889
p_array p_string doc.UnprocessedLines st
18851890

18861891
let u_pos st =
1887-
let a = u_int st in
1888-
let b = u_int st in
1892+
let a = u_int st
1893+
let b = u_int st
18891894
mkPos a b
18901895

18911896
let u_range st =
1892-
let a = u_string st in
1893-
let b = u_pos st in
1894-
let c = u_pos st in
1897+
let a = u_string st
1898+
let b = u_pos st
1899+
let c = u_pos st
18951900
mkRange a b c
18961901

18971902
// Most ranges (e.g. on optimization expressions) can be elided from stored data
18981903
let u_dummy_range: range unpickler = fun _st -> range0
18991904

19001905
let u_ident st =
1901-
let a = u_string st in
1902-
let b = u_range st in
1906+
let a = u_string st
1907+
let b = u_range st
19031908
ident (a, b)
19041909

19051910
let u_xmldoc st = XmlDoc(u_array u_string st, range0)
@@ -1935,10 +1940,12 @@ let u_tcref st =
19351940
| _ -> ufailwith st "u_item_ref"
19361941

19371942
let u_ucref st =
1938-
let a, b = u_tup2 u_tcref u_string st in UnionCaseRef(a, b)
1943+
let a, b = u_tup2 u_tcref u_string st
1944+
UnionCaseRef(a, b)
19391945

19401946
let u_rfref st =
1941-
let a, b = u_tup2 u_tcref u_string st in RecdFieldRef(a, b)
1947+
let a, b = u_tup2 u_tcref u_string st
1948+
RecdFieldRef(a, b)
19421949

19431950
let u_tpref st = u_local_item_ref st.itypars st
19441951

@@ -2236,20 +2243,29 @@ let p_measure_expr unt st =
22362243
p_normalized_measure (normalizeMeasure st.oglobals unt) st
22372244

22382245
let u_rational st =
2239-
let a, b = u_tup2 u_int32 u_int32 st in DivRational (intToRational a) (intToRational b)
2246+
let a, b = u_tup2 u_int32 u_int32 st
2247+
DivRational (intToRational a) (intToRational b)
22402248

22412249
let rec u_measure_expr st =
22422250
let tag = u_byte st
22432251

22442252
match tag with
2245-
| 0 -> let a = u_tcref st in Measure.Const(a, range0)
2246-
| 1 -> let a = u_measure_expr st in Measure.Inv a
2247-
| 2 -> let a, b = u_tup2 u_measure_expr u_measure_expr st in Measure.Prod(a, b, range0)
2248-
| 3 -> let a = u_tpref st in Measure.Var(a)
2253+
| 0 ->
2254+
let a = u_tcref st
2255+
Measure.Const(a, range0)
2256+
| 1 ->
2257+
let a = u_measure_expr st
2258+
Measure.Inv a
2259+
| 2 ->
2260+
let a, b = u_tup2 u_measure_expr u_measure_expr st
2261+
Measure.Prod(a, b, range0)
2262+
| 3 ->
2263+
let a = u_tpref st
2264+
Measure.Var(a)
22492265
| 4 -> Measure.One(range0)
22502266
| 5 ->
2251-
let a = u_measure_expr st in
2252-
let b = u_rational st in
2267+
let a = u_measure_expr st
2268+
let b = u_rational st
22532269
Measure.RationalPower(a, b)
22542270
| _ -> ufailwith st "u_measure_expr"
22552271

@@ -3451,7 +3467,8 @@ and u_dtree st =
34513467
| _ -> ufailwith st "u_dtree"
34523468

34533469
and u_dtree_case st =
3454-
let a, b = u_tup2 u_dtree_discrim u_dtree st in (TCase(a, b))
3470+
let a, b = u_tup2 u_dtree_discrim u_dtree st
3471+
TCase(a, b)
34553472

34563473
and u_dtree_discrim st =
34573474
let tag = u_byte st
@@ -3465,11 +3482,12 @@ and u_dtree_discrim st =
34653482
| _ -> ufailwith st "u_dtree_discrim"
34663483

34673484
and u_target st =
3468-
let a, b = u_tup2 u_Vals u_expr st in (TTarget(a, b, None))
3485+
let a, b = u_tup2 u_Vals u_expr st
3486+
TTarget(a, b, None)
34693487

34703488
and u_bind st =
3471-
let a = u_Val st in
3472-
let b = u_expr st in
3489+
let a = u_Val st
3490+
let b = u_expr st
34733491
TBind(a, b, DebugPointAtBinding.NoneAtSticky)
34743492

34753493
and u_lval_op_kind st =

0 commit comments

Comments
 (0)