diff --git a/src/Compiler/AbstractIL/il.fs b/src/Compiler/AbstractIL/il.fs
index 363004b2ff6..b438cc1d79d 100644
--- a/src/Compiler/AbstractIL/il.fs
+++ b/src/Compiler/AbstractIL/il.fs
@@ -184,20 +184,22 @@ type LazyOrderedMultiMap<'Key, 'Data when 'Key: equality>(keyf: 'Data -> 'Key, l
t)
- member self.Entries() = lazyItems.Force()
+ member _.Entries() = lazyItems.Force()
- member self.Add y =
+ member _.Add y =
new LazyOrderedMultiMap<'Key, 'Data>(keyf, lazyItems |> lazyMap (fun x -> y :: x))
- member self.Filter f =
+ member _.Filter f =
new LazyOrderedMultiMap<'Key, 'Data>(keyf, lazyItems |> lazyMap (List.filter f))
- member self.Item
+ member _.Item
with get x =
match quickMap.Force().TryGetValue x with
| true, v -> v
| _ -> []
+ override _.ToString() = "
"
+
//---------------------------------------------------------------------
// SHA1 hash-signing algorithm. Used to get the public key token from
// the public key.
@@ -422,6 +424,8 @@ type AssemblyRefData =
assemRefLocale: Locale option
}
+ override x.ToString() = x.assemRefName
+
/// Global state: table of all assembly references keyed by AssemblyRefData.
let AssemblyRefUniqueStampGenerator = UniqueStampGenerator()
@@ -578,6 +582,8 @@ type ILModuleRef =
member x.Hash = x.hash
+ override x.ToString() = x.Name
+
[]
[]
type ILScopeRef =
@@ -667,6 +673,9 @@ type ILCallingConv =
static member Static = ILCallingConvStatics.Static
+ override x.ToString() =
+ if x.IsStatic then "static" else "instance"
+
/// Static storage to amortize the allocation of ILCallingConv.Instance and ILCallingConv.Static.
and ILCallingConvStatics() =
@@ -986,7 +995,8 @@ type ILMethodRef =
member x.ReturnType = x.mrefReturn
- member x.CallingSignature = mkILCallSig (x.CallingConv, x.ArgTypes, x.ReturnType)
+ member x.GetCallingSignature() =
+ mkILCallSig (x.CallingConv, x.ArgTypes, x.ReturnType)
static member Create(enclosingTypeRef, callingConv, name, genericArity, argTypes, returnType) =
{
@@ -1115,6 +1125,8 @@ type ILSourceDocument =
member x.File = x.sourceFile
+ override x.ToString() = x.File
+
[]
type ILDebugPoint =
{
@@ -1451,6 +1463,9 @@ type ILLocalDebugInfo =
DebugMappings: ILLocalDebugMapping list
}
+ override x.ToString() =
+ (fst x.Range).ToString() + "-" + (snd x.Range).ToString()
+
[]
type ILCode =
{
@@ -1460,6 +1475,8 @@ type ILCode =
Locals: ILLocalDebugInfo list
}
+ override x.ToString() = ""
+
[]
type ILLocal =
{
@@ -1468,6 +1485,8 @@ type ILLocal =
DebugInfo: (string * int * int) option
}
+ override x.ToString() = ""
+
type ILLocals = ILLocal list
[]
@@ -1484,6 +1503,8 @@ type ILDebugImports =
Imports: ILDebugImport[]
}
+ override x.ToString() = ""
+
[]
type ILMethodBody =
{
@@ -1497,6 +1518,8 @@ type ILMethodBody =
DebugImports: ILDebugImports option
}
+ override x.ToString() = ""
+
[]
type ILMemberAccess =
| Assembly
@@ -1737,6 +1760,8 @@ type PInvokeMethod =
CharBestFit: PInvokeCharBestFit
}
+ override x.ToString() = x.Name
+
[]
type ILParameter =
{
@@ -1753,6 +1778,9 @@ type ILParameter =
member x.CustomAttrs = x.CustomAttrsStored.GetCustomAttrs x.MetadataIndex
+ override x.ToString() =
+ x.Name |> Option.defaultValue ""
+
type ILParameters = ILParameter list
[]
@@ -1764,6 +1792,8 @@ type ILReturn =
MetadataIndex: int32
}
+ override x.ToString() = ""
+
member x.CustomAttrs = x.CustomAttrsStored.GetCustomAttrs x.MetadataIndex
member x.WithCustomAttrs(customAttrs) =
@@ -1778,6 +1808,9 @@ type ILOverridesSpec =
member x.DeclaringType = let (OverridesSpec (_mr, ty)) = x in ty
+ override x.ToString() =
+ "overrides " + x.DeclaringType.ToString() + "::" + x.MethodRef.ToString()
+
type ILMethodVirtualInfo =
{
IsFinal: bool
@@ -1800,7 +1833,7 @@ type MethodCodeKind =
| Native
| Runtime
-let typesOfILParams (ps: ILParameters) : ILTypes = ps |> List.map (fun p -> p.Type)
+let typesOfILParams (ps: ILParameters) = ps |> List.map (fun p -> p.Type)
[]
type ILGenericVariance =
@@ -1985,7 +2018,7 @@ type ILMethodDef
member x.IsZeroInit = x.MethodBody.IsZeroInit
- member md.CallingSignature =
+ member md.GetCallingSignature() =
mkILCallSig (md.CallingConv, md.ParameterTypes, md.Return.Type)
member x.IsClassInitializer = x.Name = ".cctor"
@@ -2149,7 +2182,7 @@ type ILMethodDefs(f: unit -> ILMethodDef[]) =
member x.TryFindInstanceByNameAndCallingSignature(nm, callingSig) =
x.FindByName nm
- |> List.tryFind (fun x -> not x.IsStatic && x.CallingSignature = callingSig)
+ |> List.tryFind (fun x -> not x.IsStatic && x.GetCallingSignature() = callingSig)
[]
type ILEventDef
@@ -2232,6 +2265,8 @@ type ILEventDefs =
member x.LookupByName s = let (ILEvents t) = x in t[s]
+ override x.ToString() = ""
+
[]
type ILPropertyDef
(
@@ -2310,6 +2345,8 @@ type ILPropertyDefs =
member x.LookupByName s = let (ILProperties t) = x in t[s]
+ override x.ToString() = ""
+
let convertFieldAccess (ilMemberAccess: ILMemberAccess) =
match ilMemberAccess with
| ILMemberAccess.Assembly -> FieldAttributes.Assembly
@@ -2424,6 +2461,8 @@ type ILFieldDefs =
member x.LookupByName s = let (ILFields t) = x in t[s]
+ override x.ToString() = ""
+
type ILMethodImplDef =
{
Overrides: ILOverridesSpec
@@ -2804,10 +2843,10 @@ and [] ILTypeDefs(f: unit -> ILPreTypeDef[]) =
ReadOnlyDictionary t)
- member x.AsArray() =
+ member _.AsArray() =
[| for pre in array.Value -> pre.GetTypeDef() |]
- member x.AsList() =
+ member _.AsList() =
[ for pre in array.Value -> pre.GetTypeDef() ]
interface IEnumerable with
@@ -2870,6 +2909,8 @@ type ILNestedExportedType =
member x.CustomAttrs = x.CustomAttrsStored.GetCustomAttrs x.MetadataIndex
+ override x.ToString() = "exported type " + x.Name
+
and ILNestedExportedTypes =
| ILNestedExportedTypes of Lazy