@@ -25,9 +25,7 @@ open Internal.Utilities
2525
2626let logging = false
2727
28- let _ =
29- if logging then
30- dprintn " * warning: Il.logging is on"
28+ let _ = if logging then dprintn " * warning: Il.logging is on"
3129
3230let int_order = LanguagePrimitives.FastGenericComparer< int>
3331
@@ -70,19 +68,13 @@ let memoizeNamespaceRightTable =
7068let memoizeNamespacePartTable = ConcurrentDictionary< string, string>()
7169
7270let splitNameAt ( nm : string ) idx =
73- if idx < 0 then
74- failwith " splitNameAt: idx < 0"
71+ if idx < 0 then failwith " splitNameAt: idx < 0"
7572
7673 let last = nm.Length - 1
7774
78- if idx > last then
79- failwith " splitNameAt: idx > last"
75+ if idx > last then failwith " splitNameAt: idx > last"
8076
81- ( nm.Substring( 0 , idx)),
82- ( if idx < last then
83- nm.Substring( idx + 1 , last - idx)
84- else
85- " " )
77+ ( nm.Substring( 0 , idx)), ( if idx < last then nm.Substring( idx + 1 , last - idx) else " " )
8678
8779let rec splitNamespaceAux ( nm : string ) =
8880 match nm.IndexOf '.' with
@@ -218,14 +210,10 @@ module SHA1 =
218210 let inline (>>>&) ( x : int ) ( y : int ) = int32 ( uint32 x >>> y)
219211
220212 let f ( t , b , c , d ) =
221- if t < 20 then
222- ( b &&& c) ||| ((~~~ b) &&& d)
223- elif t < 40 then
224- b ^^^ c ^^^ d
225- elif t < 60 then
226- ( b &&& c) ||| ( b &&& d) ||| ( c &&& d)
227- else
228- b ^^^ c ^^^ d
213+ if t < 20 then ( b &&& c) ||| ((~~~ b) &&& d)
214+ elif t < 40 then b ^^^ c ^^^ d
215+ elif t < 60 then ( b &&& c) ||| ( b &&& d) ||| ( c &&& d)
216+ else b ^^^ c ^^^ d
229217
230218 [<Literal>]
231219 let k0to19 = 0x5A827999
@@ -563,8 +551,7 @@ type ILAssemblyRef(data) =
563551 addC ( convDigit ( int32 v / 16 ))
564552 addC ( convDigit ( int32 v % 16 ))
565553 // retargetable can be true only for system assemblies that definitely have Version
566- if aref.Retargetable then
567- add " , Retargetable=Yes"
554+ if aref.Retargetable then add " , Retargetable=Yes"
568555
569556 b.ToString()
570557
@@ -773,17 +760,9 @@ type ILTypeRef =
773760 else
774761 y.ApproxId
775762
776- let xScope =
777- if isPrimaryX then
778- primaryScopeRef
779- else
780- x.Scope
763+ let xScope = if isPrimaryX then primaryScopeRef else x.Scope
781764
782- let yScope =
783- if isPrimaryY then
784- primaryScopeRef
785- else
786- y.Scope
765+ let yScope = if isPrimaryY then primaryScopeRef else y.Scope
787766
788767 ( xApproxId = yApproxId)
789768 && ( xScope = yScope)
@@ -806,10 +785,7 @@ type ILTypeRef =
806785 else
807786 let c = compare x.Name y.Name
808787
809- if c <> 0 then
810- c
811- else
812- compare x.Enclosing y.Enclosing
788+ if c <> 0 then c else compare x.Enclosing y.Enclosing
813789
814790 member tref.FullName = String.concat " ." ( tref.Enclosing @ [ tref.Name ])
815791
@@ -883,11 +859,7 @@ and [<StructuralEquality; StructuralComparison; StructuredFormatDisplay("{DebugT
883859 && ( x.GenericArgs = y.GenericArgs)
884860
885861 override x.ToString () =
886- x.TypeRef.ToString()
887- + if isNil x.GenericArgs then
888- " "
889- else
890- " <...>"
862+ x.TypeRef.ToString() + if isNil x.GenericArgs then " " else " <...>"
891863
892864and [<RequireQualifiedAccess; StructuralEquality; StructuralComparison; StructuredFormatDisplay("{DebugText}")>] ILType =
893865 | Void
@@ -1859,20 +1831,13 @@ type ILGenericParameterDefs = ILGenericParameterDef list
18591831let memberAccessOfFlags flags =
18601832 let f = ( flags &&& 0x00000007 )
18611833
1862- if f = 0x00000001 then
1863- ILMemberAccess.Private
1864- elif f = 0x00000006 then
1865- ILMemberAccess.Public
1866- elif f = 0x00000004 then
1867- ILMemberAccess.Family
1868- elif f = 0x00000002 then
1869- ILMemberAccess.FamilyAndAssembly
1870- elif f = 0x00000005 then
1871- ILMemberAccess.FamilyOrAssembly
1872- elif f = 0x00000003 then
1873- ILMemberAccess.Assembly
1874- else
1875- ILMemberAccess.CompilerControlled
1834+ if f = 0x00000001 then ILMemberAccess.Private
1835+ elif f = 0x00000006 then ILMemberAccess.Public
1836+ elif f = 0x00000004 then ILMemberAccess.Family
1837+ elif f = 0x00000002 then ILMemberAccess.FamilyAndAssembly
1838+ elif f = 0x00000005 then ILMemberAccess.FamilyOrAssembly
1839+ elif f = 0x00000003 then ILMemberAccess.Assembly
1840+ else ILMemberAccess.CompilerControlled
18761841
18771842let convertMemberAccess ( ilMemberAccess : ILMemberAccess ) =
18781843 match ilMemberAccess with
@@ -2509,12 +2474,9 @@ let typeAccessOfFlags flags =
25092474let typeEncodingOfFlags flags =
25102475 let f = ( flags &&& 0x00030000 )
25112476
2512- if f = 0x00020000 then
2513- ILDefaultPInvokeEncoding.Auto
2514- elif f = 0x00010000 then
2515- ILDefaultPInvokeEncoding.Unicode
2516- else
2517- ILDefaultPInvokeEncoding.Ansi
2477+ if f = 0x00020000 then ILDefaultPInvokeEncoding.Auto
2478+ elif f = 0x00010000 then ILDefaultPInvokeEncoding.Unicode
2479+ else ILDefaultPInvokeEncoding.Ansi
25182480
25192481[<RequireQualifiedAccess>]
25202482type ILTypeDefKind =
@@ -3613,32 +3575,20 @@ and rescopeILType scoref ty =
36133575 | ILType.Boxed cr1 ->
36143576 let cr2 = rescopeILTypeSpec scoref cr1
36153577
3616- if cr1 === cr2 then
3617- ty
3618- else
3619- mkILBoxedType cr2
3578+ if cr1 === cr2 then ty else mkILBoxedType cr2
36203579 | ILType.Array ( s, ety1) ->
36213580 let ety2 = rescopeILType scoref ety1
36223581
3623- if ety1 === ety2 then
3624- ty
3625- else
3626- ILType.Array( s, ety2)
3582+ if ety1 === ety2 then ty else ILType.Array( s, ety2)
36273583 | ILType.Value cr1 ->
36283584 let cr2 = rescopeILTypeSpec scoref cr1
36293585
3630- if cr1 === cr2 then
3631- ty
3632- else
3633- ILType.Value cr2
3586+ if cr1 === cr2 then ty else ILType.Value cr2
36343587 | ILType.Modified ( b, tref, ty) -> ILType.Modified( b, rescopeILTypeRef scoref tref, rescopeILType scoref ty)
36353588 | x -> x
36363589
36373590and rescopeILTypes scoref i =
3638- if isNil i then
3639- i
3640- else
3641- List.mapq ( rescopeILType scoref) i
3591+ if isNil i then i else List.mapq ( rescopeILType scoref) i
36423592
36433593and rescopeILCallSig scoref csig =
36443594 mkILCallSig ( csig.CallingConv, rescopeILTypes scoref csig.ArgTypes, rescopeILType scoref csig.ReturnType)
@@ -3933,13 +3883,7 @@ let prependInstrsToCode (instrs: ILInstr list) (c2: ILCode) =
39333883 let dict = Dictionary.newWithSize c2.Labels.Count
39343884
39353885 for kvp in c2.Labels do
3936- dict.Add(
3937- kvp.Key,
3938- if kvp.Value = 0 then
3939- 0
3940- else
3941- kvp.Value + n
3942- )
3886+ dict.Add( kvp.Key, ( if kvp.Value = 0 then 0 else kvp.Value + n))
39433887
39443888 dict
39453889
@@ -4013,22 +3957,10 @@ let mkILField (isStatic, nm, ty, init: ILFieldInit option, at: byte[] option, ac
40133957 fieldType = ty,
40143958 attributes =
40153959 ( convertFieldAccess access
4016- ||| ( if isStatic then
4017- FieldAttributes.Static
4018- else
4019- enum 0 )
4020- ||| ( if isLiteral then
4021- FieldAttributes.Literal
4022- else
4023- enum 0 )
4024- ||| ( if init.IsSome then
4025- FieldAttributes.HasDefault
4026- else
4027- enum 0 )
4028- ||| ( if at.IsSome then
4029- FieldAttributes.HasFieldRVA
4030- else
4031- enum 0 )),
3960+ ||| ( if isStatic then FieldAttributes.Static else enum 0 )
3961+ ||| ( if isLiteral then FieldAttributes.Literal else enum 0 )
3962+ ||| ( if init.IsSome then FieldAttributes.HasDefault else enum 0 )
3963+ ||| ( if at.IsSome then FieldAttributes.HasFieldRVA else enum 0 )),
40323964 literalValue = init,
40333965 data = at,
40343966 offset = None,
@@ -4362,12 +4294,7 @@ let mkCtorMethSpecForDelegate (ilg: ILGlobals) (ty: ILType, useUIntPtr) =
43624294 let argTys =
43634295 [
43644296 rescopeILType scoref ilg.typ_ Object
4365- rescopeILType
4366- scoref
4367- ( if useUIntPtr then
4368- ilg.typ_ UIntPtr
4369- else
4370- ilg.typ_ IntPtr)
4297+ rescopeILType scoref ( if useUIntPtr then ilg.typ_ UIntPtr else ilg.typ_ IntPtr)
43714298 ]
43724299
43734300 mkILInstanceMethSpecInTy ( ty, " .ctor" , argTys, ILType.Void, emptyILGenericArgsList)
@@ -5143,8 +5070,8 @@ let decodeILAttribData (ca: ILAttribute) =
51435070 try
51445071 let parser = ILTypeSigParser n
51455072 parser.ParseTypeSpec(), sigptr
5146- with
5147- | exn -> failwith ( sprintf " decodeILAttribData: error parsing type in custom attribute blob: %s " exn.Message)
5073+ with exn ->
5074+ failwith ( sprintf " decodeILAttribData: error parsing type in custom attribute blob: %s " exn.Message)
51485075 | ILType.Boxed tspec when tspec.Name = " System.Object" ->
51495076 let et , sigptr = sigptr_ get_ u8 bytes sigptr
51505077
@@ -5605,10 +5532,7 @@ and unscopeILType ty =
56055532 | x -> x
56065533
56075534and unscopeILTypes i =
5608- if List.isEmpty i then
5609- i
5610- else
5611- List.map unscopeILType i
5535+ if List.isEmpty i then i else List.map unscopeILType i
56125536
56135537and unscopeILCallSig csig =
56145538 mkILCallSig ( csig.CallingConv, unscopeILTypes csig.ArgTypes, unscopeILType csig.ReturnType)
0 commit comments