@@ -75,9 +75,9 @@ type PrimaryAssembly =
7575// --------------------------------------------------------------------
7676
7777let splitNameAt ( nm : string ) idx =
78- if idx< 0 then failwith" splitNameAt: idx < 0" ;
78+ if idx< 0 then failwith" splitNameAt: idx < 0"
7979let last = nm.Length- 1
80- if idx> lastthen failwith" splitNameAt: idx > last" ;
80+ if idx> lastthen failwith" splitNameAt: idx > last"
8181( nm.Substring( 0 , idx)),
8282( if idx< lastthen nm.Substring( idx+ 1 , last- idx) else " " )
8383
@@ -230,9 +230,9 @@ module SHA1 =
230230
231231
232232type SHAStream =
233- { stream: byte [];
234- mutable pos: int ;
235- mutable eof: bool ; }
233+ { stream: byte []
234+ mutable pos: int
235+ mutable eof: bool }
236236
237237let rotLeft32 x n = ( x<<< n) ||| ( x>>>& ( 32 - n))
238238
@@ -443,17 +443,17 @@ type ILAssemblyRef(data) =
443443let b = new System.Text.StringBuilder( 100 )
444444let add ( s : string ) = ( b.Append( s) |> ignore)
445445let addC ( s : char ) = ( b.Append( s) |> ignore)
446- add( aref.Name);
446+ add( aref.Name)
447447match aref.Versionwith
448448| None-> ()
449449| Some( a, b, c, d) ->
450- add" , Version=" ;
450+ add" , Version="
451451 add( string( int a))
452- add" ." ;
452+ add" ."
453453 add( string( int b))
454- add" ." ;
454+ add" ."
455455 add( string( int c))
456- add" ." ;
456+ add" ."
457457 add( string( int d))
458458 add" , Culture="
459459match aref.Localewith
@@ -482,13 +482,13 @@ type ILAssemblyRef(data) =
482482
483483[<StructuralEquality; StructuralComparison>]
484484type ILModuleRef =
485- { name: string ;
486- hasMetadata: bool ;
487- hash: byte [] option ; }
485+ { name: string
486+ hasMetadata: bool
487+ hash: byte [] option }
488488
489489static member Create ( name , hasMetadata , hash ) =
490- { name= name;
491- hasMetadata= hasMetadata;
490+ { name= name
491+ hasMetadata= hasMetadata
492492 hash= hash}
493493
494494member x.Name = x.name
@@ -765,10 +765,12 @@ and [<RequireQualifiedAccess; StructuralEquality; StructuralComparison>]
765765match xwith
766766| ILType.TypeVar_ -> true | _ -> false
767767
768+ override x.ToString () = x.QualifiedName
769+
768770and [<StructuralEquality; StructuralComparison>]
769771ILCallingSignature =
770- { CallingConv: ILCallingConv ;
771- ArgTypes: ILTypes ;
772+ { CallingConv: ILCallingConv
773+ ArgTypes: ILTypes
772774 ReturnType: ILType }
773775
774776and ILGenericArgs = list< ILType>
@@ -938,7 +940,9 @@ type ILAttributeNamedArg = (string * ILType * bool * ILAttribElem)
938940type ILAttribute =
939941{ Method: ILMethodSpec
940942 Data: byte []
941- Elements: ILAttribElem list }
943+ Elements: ILAttribElem list }
944+
945+ override x.ToString () = x.Method.ToString() + " (...)"
942946
943947[<NoEquality; NoComparison; Struct>]
944948type ILAttributes ( array : ILAttribute []) =
@@ -1190,20 +1194,20 @@ type ILCode =
11901194
11911195[<RequireQualifiedAccess; NoComparison; NoEquality>]
11921196type ILLocal =
1193- { Type: ILType ;
1194- IsPinned: bool ;
1197+ { Type: ILType
1198+ IsPinned: bool
11951199 DebugInfo: ( string * int * int ) option }
11961200
11971201type ILLocals = list< ILLocal>
11981202
11991203[<RequireQualifiedAccess; NoEquality; NoComparison>]
12001204type ILMethodBody =
1201- { IsZeroInit: bool ;
1202- MaxStack: int32 ;
1203- NoInlining: bool ;
1204- AggressiveInlining: bool ;
1205- Locals: ILLocals ;
1206- Code: ILCode ;
1205+ { IsZeroInit: bool
1206+ MaxStack: int32
1207+ NoInlining: bool
1208+ AggressiveInlining: bool
1209+ Locals: ILLocals
1210+ Code: ILCode
12071211 SourceMarker: ILSourceMarker option }
12081212
12091213[<RequireQualifiedAccess>]
@@ -2673,16 +2677,16 @@ and rescopeILCallSig scoref csig =
26732677 mkILCallSig( csig.CallingConv, rescopeILTypes scoref csig.ArgTypes, rescopeILType scoref csig.ReturnType)
26742678
26752679let rescopeILMethodRef scoref ( x : ILMethodRef ) =
2676- { mrefParent= rescopeILTypeRef scoref x.DeclaringTypeRef;
2677- mrefCallconv= x.mrefCallconv;
2678- mrefGenericArity= x.mrefGenericArity;
2679- mrefName= x.mrefName;
2680- mrefArgs= rescopeILTypes scoref x.mrefArgs;
2680+ { mrefParent= rescopeILTypeRef scoref x.DeclaringTypeRef
2681+ mrefCallconv= x.mrefCallconv
2682+ mrefGenericArity= x.mrefGenericArity
2683+ mrefName= x.mrefName
2684+ mrefArgs= rescopeILTypes scoref x.mrefArgs
26812685 mrefReturn= rescopeILType scoref x.mrefReturn}
26822686
26832687let rescopeILFieldRef scoref x =
2684- { DeclaringTypeRef= rescopeILTypeRef scoref x.DeclaringTypeRef;
2685- Name= x.Name;
2688+ { DeclaringTypeRef= rescopeILTypeRef scoref x.DeclaringTypeRef
2689+ Name= x.Name
26862690 Type= rescopeILType scoref x.Type}
26872691
26882692// --------------------------------------------------------------------
@@ -2741,8 +2745,8 @@ let mkILReturn ty : ILReturn =
27412745 MetadataIndex= NoMetadataIdx}
27422746
27432747let mkILLocal ty dbgInfo : ILLocal =
2744- { IsPinned= false ;
2745- Type= ty;
2748+ { IsPinned= false
2749+ Type= ty
27462750 DebugInfo= dbgInfo}
27472751
27482752type ILFieldSpec with
@@ -2793,7 +2797,7 @@ let mkILCtor (access, args, impl) =
27932797// --------------------------------------------------------------------
27942798
27952799let mkCallBaseConstructor ( typ , args : ILType list ) =
2796- [ mkLdarg0; ] @
2800+ [ mkLdarg0] @
27972801 List.mapi( fun i _ -> mkLdarg( uint16( i+ 1 ))) args@
27982802[ mkNormalCall( mkILCtorMethSpecForTy( typ, [])) ]
27992803
@@ -2985,7 +2989,7 @@ type ILLocalsAllocator(numPrealloc:int) =
29852989let newLocals = ResizeArray< ILLocal>()
29862990member tmps.AllocLocal loc =
29872991let locn = uint16( numPrealloc+ newLocals.Count)
2988- newLocals.Add loc;
2992+ newLocals.Add loc
29892993 locn
29902994
29912995member tmps.Close () = ResizeArray.toList newLocals
@@ -3051,9 +3055,9 @@ let mkILStorageCtorWithParamNames(tag, preblock, typ, extraParams, flds, access)
30513055( match tagwith Some x-> [ I_ seqpoint x] | None-> []) @
30523056 preblock@
30533057 List.concat( List.mapi( fun n ( _pnm , nm , ty ) ->
3054- [ mkLdarg0;
3055- mkLdarg( uint16( n+ 1 ));
3056- mkNormalStfld( mkILFieldSpecInTy( typ, nm, ty));
3058+ [ mkLdarg0
3059+ mkLdarg( uint16( n+ 1 ))
3060+ mkNormalStfld( mkILFieldSpecInTy( typ, nm, ty))
30573061]) flds)
30583062end , tag))
30593063
@@ -3062,7 +3066,7 @@ let mkILSimpleStorageCtorWithParamNames(tag, base_tspec, typ, extraParams, flds,
30623066match base_ tspecwith
30633067 None-> []
30643068| Some tspec->
3065- ([ mkLdarg0;
3069+ ([ mkLdarg0
30663070 mkNormalCall( mkILCtorMethSpecForTy( mkILBoxedType tspec, [])) ])
30673071 mkILStorageCtorWithParamNames( tag, preblock, typ, extraParams, flds, access)
30683072
@@ -3190,26 +3194,26 @@ let mkILDelegateMethods (access) (ilg: ILGlobals) (iltyp_AsyncCallback, iltyp_IA
31903194 mdef.WithAbstract( false ) .WithHideBySig( true ) .WithRuntime( true )
31913195let ctor = mkILCtor( access, [ mkILParamNamed( " object" , ilg.typ_ Object); mkILParamNamed( " method" , ilg.typ_ IntPtr) ], MethodBody.Abstract)
31923196let ctor = ctor.WithRuntime( true ) .WithHideBySig( true )
3193- [ ctor;
3194- one" Invoke" parms rty;
3195- one" BeginInvoke" ( parms@ [ mkILParamNamed( " callback" , iltyp_ AsyncCallback); mkILParamNamed( " objects" , ilg.typ_ Object) ] ) iltyp_ IAsyncResult;
3196- one" EndInvoke" [ mkILParamNamed( " result" , iltyp_ IAsyncResult)] rty; ]
3197+ [ ctor
3198+ one" Invoke" parms rty
3199+ one" BeginInvoke" ( parms@ [ mkILParamNamed( " callback" , iltyp_ AsyncCallback); mkILParamNamed( " objects" , ilg.typ_ Object) ] ) iltyp_ IAsyncResult
3200+ one" EndInvoke" [ mkILParamNamed( " result" , iltyp_ IAsyncResult)] rty]
31973201
31983202
31993203let mkCtorMethSpecForDelegate ( ilg : ILGlobals ) ( typ : ILType , useUIntPtr ) =
32003204let scoref = typ.TypeRef.Scope
32013205 mkILInstanceMethSpecInTy( typ, " .ctor" , [ rescopeILType scoref ilg.typ_ Object; rescopeILType scoref( if useUIntPtrthen ilg.typ_ UIntPtrelse ilg.typ_ IntPtr)], ILType.Void, emptyILGenericArgsList)
32023206
32033207type ILEnumInfo =
3204- { enumValues: ( string * ILFieldInit ) list ;
3208+ { enumValues: ( string * ILFieldInit ) list
32053209 enumType: ILType }
32063210
32073211let getTyOfILEnumInfo info = info.enumType
32083212
32093213let computeILEnumInfo ( mdName , mdFields : ILFieldDefs ) =
32103214match ( List.partition( fun ( fd : ILFieldDef ) -> fd.IsStatic) mdFields.AsList) with
32113215| staticFields, [ vfd] ->
3212- { enumType= vfd.FieldType;
3216+ { enumType= vfd.FieldType
32133217 enumValues= staticFields|> List.map( fun fd -> ( fd.Name, match fd.LiteralValuewith Some i-> i| None-> failwith( " info_of_enum_tdef: badly formed enum" + mdName+ " : static field does not have an default value" ))) }
32143218| _, [] -> failwith( " info_of_enum_tdef: badly formed enum" + mdName+ " : no non-static field found" )
32153219| _, _ -> failwith( " info_of_enum_tdef: badly formed enum" + mdName+ " : more than one non-static field found" )
@@ -3336,9 +3340,9 @@ let z_unsigned_int_size n =
33363340let z_unsigned_int n =
33373341if n>= 0 && n<= 0x7F then [| byte n|]
33383342elif n>= 0x80 && n<= 0x3FFF then [| byte( 0x80 ||| ( n>>>& 8 )); byte( n&&& 0xFF ) |]
3339- else [| byte( 0xc0 ||| ( n>>>& 24 ));
3340- byte(( n>>>& 16 ) &&& 0xFF );
3341- byte(( n>>>& 8 ) &&& 0xFF );
3343+ else [| byte( 0xc0 ||| ( n>>>& 24 ))
3344+ byte(( n>>>& 16 ) &&& 0xFF )
3345+ byte(( n>>>& 8 ) &&& 0xFF )
33423346 byte( n&&& 0xFF ) |]
33433347
33443348let string_as_utf8_bytes ( s : string ) = System.Text.Encoding.UTF8.GetBytes s
@@ -3513,8 +3517,8 @@ and encodeCustomAttrValue ilg ty c =
35133517
35143518let encodeCustomAttrNamedArg ilg ( nm , ty , prop , elem ) =
35153519[| yield ( if propthen 0x54 uyelse 0x53 uy)
3516- yield ! encodeCustomAttrElemType ty;
3517- yield ! encodeCustomAttrString nm;
3520+ yield ! encodeCustomAttrElemType ty
3521+ yield ! encodeCustomAttrString nm
35183522yield ! encodeCustomAttrValue ilg ty elem|]
35193523
35203524let mkILCustomAttribMethRef ( ilg : ILGlobals ) ( mspec : ILMethodSpec , fixedArgs : list < _ >, namedArgs : list < _ >) =
@@ -3526,8 +3530,8 @@ let mkILCustomAttribMethRef (ilg: ILGlobals) (mspec:ILMethodSpec, fixedArgs: lis
35263530yield ! u16AsBytes( uint16 namedArgs.Length)
35273531for namedArgin namedArgsdo
35283532yield ! encodeCustomAttrNamedArg ilg namedArg|]
3529- { Method= mspec;
3530- Data= args;
3533+ { Method= mspec
3534+ Data= args
35313535 Elements= fixedArgs@ ( namedArgs|> List.map( fun ( _ , _ , _ , e ) -> e)) }
35323536
35333537let mkILCustomAttribute ilg ( tref , argtys , argvs , propvs ) =
@@ -3547,15 +3551,15 @@ let EcmaMscorlibILGlobals = mkILGlobals MscorlibScopeRef
35473551// in §23.3, beginning with NumNamed).
35483552let mkPermissionSet ( ilg : ILGlobals ) ( action , attributes : list <( ILTypeRef * ( string * ILType * ILAttribElem ) list )>) =
35493553let bytes =
3550- [| yield ( byte'.' );
3551- yield ! z_ unsigned_ int attributes.Length;
3554+ [| yield ( byte'.' )
3555+ yield ! z_ unsigned_ int attributes.Length
35523556for ( tref: ILTypeRef, props) in attributesdo
35533557yield ! encodeCustomAttrString tref.QualifiedName
35543558let bytes =
3555- [| yield ! z_ unsigned_ int props.Length;
3556- for ( nm, typ, value) in propsdo
3557- yield ! encodeCustomAttrNamedArg ilg( nm, typ, true , value)|]
3558- yield ! z_ unsigned_ int bytes.Length;
3559+ [| yield ! z_ unsigned_ int props.Length
3560+ for ( nm, typ, value) in propsdo
3561+ yield ! encodeCustomAttrNamedArg ilg( nm, typ, true , value)|]
3562+ yield ! z_ unsigned_ int bytes.Length
35593563yield ! bytes|]
35603564
35613565 ILSecurityDecl.ILSecurityDecl( action, bytes)
@@ -3704,7 +3708,7 @@ let decodeILAttribData (ilg: ILGlobals) (ca: ILAttribute) =
37043708let sigptr = 0
37053709let bb0 , sigptr = sigptr_ get_ byte bytes sigptr
37063710let bb1 , sigptr = sigptr_ get_ byte bytes sigptr
3707- if not ( bb0= 0x01 && bb1= 0x00 ) then failwith" decodeILAttribData: invalid data" ;
3711+ if not ( bb0= 0x01 && bb1= 0x00 ) then failwith" decodeILAttribData: invalid data"
37083712
37093713let rec parseVal argty sigptr =
37103714match argtywith
@@ -3825,16 +3829,16 @@ let decodeILAttribData (ilg: ILGlobals) (ca: ILAttribute) =
38253829// --------------------------------------------------------------------
38263830
38273831type ILReferences =
3828- { AssemblyReferences: ILAssemblyRef list ;
3829- ModuleReferences: ILModuleRef list ; }
3832+ { AssemblyReferences: ILAssemblyRef list
3833+ ModuleReferences: ILModuleRef list }
38303834
38313835type ILReferencesAccumulator =
3832- { refsA: HashSet < ILAssemblyRef >;
3833- refsM: HashSet < ILModuleRef >; }
3836+ { refsA: HashSet < ILAssemblyRef >
3837+ refsM: HashSet < ILModuleRef > }
38343838
38353839let emptyILRefs =
3836- { AssemblyReferences=[];
3837- ModuleReferences= []; }
3840+ { AssemblyReferences=[]
3841+ ModuleReferences= [] }
38383842
38393843(* Now find references.*)
38403844let refs_of_assref ( s : ILReferencesAccumulator ) x = s.refsA.Add x|> ignore
@@ -3866,19 +3870,19 @@ and refs_of_genparams s b = List.iter (refs_of_genparam s) b
38663870and refs_of_dloc s ts = refs_ of_ tref s ts
38673871
38683872and refs_of_mref s ( x : ILMethodRef ) =
3869- refs_ of_ dloc s x.DeclaringTypeRef;
3870- refs_ of_ typs s x.mrefArgs;
3873+ refs_ of_ dloc s x.DeclaringTypeRef
3874+ refs_ of_ typs s x.mrefArgs
38713875 refs_ of_ typ s x.mrefReturn
38723876
38733877and refs_of_fref s x = refs_ of_ tref s x.DeclaringTypeRef; refs_ of_ typ s x.Type
38743878and refs_of_ospec s ( OverridesSpec ( mref , ty )) = refs_ of_ mref s mref; refs_ of_ typ s ty
38753879and refs_of_mspec s ( x : ILMethodSpec ) =
3876- refs_ of_ mref s x.MethodRef;
3877- refs_ of_ typ s x.DeclaringType;
3880+ refs_ of_ mref s x.MethodRef
3881+ refs_ of_ typ s x.DeclaringType
38783882 refs_ of_ inst s x.GenericArgs
38793883
38803884and refs_of_fspec s x =
3881- refs_ of_ fref s x.FieldRef;
3885+ refs_ of_ fref s x.FieldRef
38823886 refs_ of_ typ s x.DeclaringType
38833887
38843888and refs_of_typs s l = List.iter( refs_ of_ typ s) l
@@ -3896,11 +3900,11 @@ and refs_of_varargs s tyso = Option.iter (refs_of_typs s) tyso
38963900and refs_of_instr s x =
38973901match xwith
38983902| I_ call(_, mr, varargs) | I_ newobj( mr, varargs) | I_ callvirt(_, mr, varargs) ->
3899- refs_ of_ mspec s mr;
3903+ refs_ of_ mspec s mr
39003904 refs_ of_ varargs s varargs
39013905| I_ callconstraint(_, tr, mr, varargs) ->
3902- refs_ of_ typ s tr;
3903- refs_ of_ mspec s mr;
3906+ refs_ of_ typ s tr
3907+ refs_ of_ mspec s mr
39043908 refs_ of_ varargs s varargs
39053909| I_ calli(_, callsig, varargs) ->
39063910 refs_ of_ callsig s callsig; refs_ of_ varargs s varargs