@@ -6,6 +6,7 @@ module public Microsoft.FSharp.Compiler.AbstractIL.IL
66
77open Internal.Utilities
88open System.Collections .Generic
9+ open System.Reflection
910
1011[<RequireQualifiedAccess>]
1112type PrimaryAssembly =
@@ -812,7 +813,6 @@ type ILMethodBody =
812813[<RequireQualifiedAccess>]
813814type ILMemberAccess =
814815| Assembly
815- | CompilerControlled
816816| FamilyAndAssembly
817817| FamilyOrAssembly
818818| Family
@@ -1028,32 +1028,14 @@ type ILLazyMethodBody =
10281028[<NoComparison; NoEquality>]
10291029type ILMethodDef =
10301030{ Name: string ;
1031- mdKind: MethodKind ;
1031+ Attributes: MethodAttributes ;
1032+ ImplAttributes: MethodImplAttributes ;
10321033 CallingConv: ILCallingConv ;
10331034 Parameters: ILParameters ;
10341035 Return: ILReturn ;
1035- Access: ILMemberAccess ;
10361036 mdBody: ILLazyMethodBody ;
1037- mdCodeKind: MethodCodeKind ;
1038- IsInternalCall: bool ;
1039- IsManaged: bool ;
1040- IsForwardRef: bool ;
10411037 SecurityDecls: ILPermissions ;
1042- /// Some methods are marked "HasSecurity" even if there are no permissions attached, e.g. if they use SuppressUnmanagedCodeSecurityAttribute
1043- HasSecurity: bool ;
10441038 IsEntryPoint: bool ;
1045- IsReqSecObj: bool ;
1046- IsHideBySig: bool ;
1047- IsSpecialName: bool ;
1048- /// The method is exported to unmanaged code using COM interop.
1049- IsUnmanagedExport: bool ;
1050- IsSynchronized: bool ;
1051- IsPreserveSig: bool ;
1052- /// .NET 2.0 feature: SafeHandle finalizer must be run.
1053- IsMustRun: bool ;
1054- IsNoInline: bool ;
1055- IsAggressiveInline: bool ;
1056-
10571039 GenericParams: ILGenericParameterDefs ;
10581040 CustomAttrs: ILAttributes ; }
10591041
@@ -1083,10 +1065,42 @@ type ILMethodDef =
10831065
10841066member IsFinal : bool
10851067member IsNewSlot : bool
1086- member IsCheckAccessOnOverride : bool
1068+ member IsCheckAccessOnOverride : bool
10871069member IsAbstract : bool
1088- member MethodBody : ILMethodBody
1070+ member MethodBody : ILMethodBody
10891071member CallingSignature : ILCallingSignature
1072+ member Access : ILMemberAccess
1073+ member IsHideBySig : bool
1074+ member IsSpecialName : bool
1075+ /// The method is exported to unmanaged code using COM interop.
1076+ member IsUnmanagedExport : bool
1077+ member IsReqSecObj : bool
1078+ /// Some methods are marked "HasSecurity" even if there are no permissions attached, e.g. if they use SuppressUnmanagedCodeSecurityAttribute
1079+ member HasSecurity : bool
1080+ member IsManaged : bool
1081+ member IsForwardRef : bool
1082+ member IsInternalCall : bool
1083+ member IsPreserveSig : bool
1084+ member IsSynchronized : bool
1085+ member IsNoInline : bool
1086+ member IsAggressiveInline : bool
1087+ /// .NET 2.0 feature: SafeHandle finalizer must be run.
1088+ member IsMustRun : bool
1089+
1090+ member WithSpecialName : ILMethodDef
1091+ member WithHideBySig : unit -> ILMethodDef
1092+ member WithHideBySig : bool -> ILMethodDef
1093+ member WithFinal : bool -> ILMethodDef
1094+ member WithAbstract : bool -> ILMethodDef
1095+ member WithAccess : ILMemberAccess -> ILMethodDef
1096+ member WithNewSlot : ILMethodDef
1097+ member WithSecurity : bool -> ILMethodDef
1098+ member WithPInvoke : bool -> ILMethodDef
1099+ member WithPreserveSig : bool -> ILMethodDef
1100+ member WithSynchronized : bool -> ILMethodDef
1101+ member WithNoInlining : bool -> ILMethodDef
1102+ member WithAggressiveInlining : bool -> ILMethodDef
1103+ member WithRuntime : bool -> ILMethodDef
10901104
10911105/// Tables of methods. Logically equivalent to a list of methods but
10921106/// the table is kept in a form optimized for looking up methods by
@@ -1105,18 +1119,27 @@ type ILMethodDefs =
11051119type ILFieldDef =
11061120{ Name: string ;
11071121 Type: ILType ;
1108- IsStatic: bool ;
1109- Access: ILMemberAccess ;
1122+ Attributes: FieldAttributes ;
11101123 Data: byte [] option ;
11111124 LiteralValue: ILFieldInit option ;
11121125/// The explicit offset in bytes when explicit layout is used.
11131126 Offset: int32 option ;
1114- IsSpecialName: bool ;
11151127 Marshal: ILNativeType option ;
1116- NotSerialized: bool ;
1117- IsLiteral: bool ;
1118- IsInitOnly: bool ;
11191128 CustomAttrs: ILAttributes ; }
1129+ member IsStatic : bool
1130+ member IsSpecialName : bool
1131+ member IsLiteral : bool
1132+ member NotSerialized : bool
1133+ member IsInitOnly : bool
1134+ member Access : ILMemberAccess
1135+ member WithAccess : ILMemberAccess -> ILFieldDef
1136+ member WithInitOnly : bool -> ILFieldDef
1137+ member WithStatic : bool -> ILFieldDef
1138+ member WithSpecialName : bool -> ILFieldDef
1139+ member WithNotSerialized : bool -> ILFieldDef
1140+ member WithLiteral : bool -> ILFieldDef
1141+ member WithHasDefault : bool -> ILFieldDef
1142+ member WithHasFieldMarshal : bool -> ILFieldDef
11201143
11211144/// Tables of fields. Logically equivalent to a list of fields but
11221145/// the table is kept in a form optimized for looking up fields by
@@ -1129,15 +1152,16 @@ type ILFieldDefs =
11291152/// Event definitions.
11301153[<NoComparison; NoEquality>]
11311154type ILEventDef =
1132- { Type: ILType option ;
1155+ { Type: ILType option ;
11331156 Name: string ;
1134- IsRTSpecialName: bool ;
1135- IsSpecialName: bool ;
1157+ Attributes: EventAttributes
11361158 AddMethod: ILMethodRef ;
11371159 RemoveMethod: ILMethodRef ;
11381160 FireMethod: ILMethodRef option ;
11391161 OtherMethods: ILMethodRef list ;
11401162 CustomAttrs: ILAttributes ; }
1163+ member IsSpecialName : bool
1164+ member IsRTSpecialName : bool
11411165
11421166/// Table of those events in a type definition.
11431167[<NoEquality; NoComparison; Sealed>]
@@ -1149,15 +1173,16 @@ type ILEventDefs =
11491173[<NoComparison; NoEquality>]
11501174type ILPropertyDef =
11511175{ Name: string ;
1152- IsRTSpecialName: bool ;
1153- IsSpecialName: bool ;
1176+ Attributes: PropertyAttributes ;
11541177 SetMethod: ILMethodRef option ;
11551178 GetMethod: ILMethodRef option ;
11561179 CallingConv: ILThisConvention ;
11571180 Type: ILType ;
11581181 Init: ILFieldInit option ;
11591182 Args: ILTypes ;
11601183 CustomAttrs: ILAttributes ; }
1184+ member IsSpecialName : bool
1185+ member IsRTSpecialName : bool
11611186
11621187/// Table of those properties in a type definition.
11631188[<NoEquality; NoComparison>]
@@ -1263,37 +1288,49 @@ type ILTypeDefs =
12631288/// have a very specific form.
12641289and [<NoComparison; NoEquality>]
12651290ILTypeDef =
1266- { tdKind : ILTypeDefKind ;
1267- Name : string ;
1291+ { Name : string ;
1292+ Attributes : TypeAttributes ;
12681293 GenericParams: ILGenericParameterDefs ;
1269- Access: ILTypeDefAccess ;
1270- IsAbstract: bool ;
1271- IsSealed: bool ;
1272- IsSerializable: bool ;
1273- /// Class or interface generated for COM interop.
1274- IsComInterop: bool ;
12751294 Layout: ILTypeDefLayout ;
1276- IsSpecialName: bool ;
1277- Encoding: ILDefaultPInvokeEncoding ;
12781295 NestedTypes: ILTypeDefs ;
12791296 Implements: ILTypes ;
12801297 Extends: ILType option ;
12811298 Methods: ILMethodDefs ;
12821299 SecurityDecls: ILPermissions ;
1283- /// Some classes are marked "HasSecurity" even if there are no permissions attached,
1284- /// e.g. if they use SuppressUnmanagedCodeSecurityAttribute
1285- HasSecurity: bool ;
12861300 Fields: ILFieldDefs ;
12871301 MethodImpls: ILMethodImplDefs ;
1288- InitSemantics: ILTypeInit ;
12891302 Events: ILEventDefs ;
12901303 Properties: ILPropertyDefs ;
12911304 CustomAttrs: ILAttributes ; }
12921305member IsClass : bool ;
1306+ member IsStruct : bool ;
12931307member IsInterface : bool ;
12941308member IsEnum : bool ;
12951309member IsDelegate : bool ;
12961310member IsStructOrEnum : bool
1311+ member Access : ILTypeDefAccess
1312+ member IsAbstract : bool
1313+ member IsSealed : bool
1314+ member IsSerializable : bool
1315+ /// Class or interface generated for COM interop.
1316+ member IsComInterop : bool
1317+ member IsSpecialName : bool
1318+ /// Some classes are marked "HasSecurity" even if there are no permissions attached,
1319+ /// e.g. if they use SuppressUnmanagedCodeSecurityAttribute
1320+ member HasSecurity : bool
1321+ member Encoding : ILDefaultPInvokeEncoding ;
1322+ member WithAccess : ILTypeDefAccess -> ILTypeDef
1323+ member WithNestedAccess : ILMemberAccess -> ILTypeDef
1324+ member WithSealed : bool -> ILTypeDef
1325+ member WithSerializable : bool -> ILTypeDef
1326+ member WithAbstract : bool -> ILTypeDef
1327+ member WithImport : bool -> ILTypeDef
1328+ member WithHasSecurity : bool -> ILTypeDef
1329+ member WithLayout : ILTypeDefLayout -> ILTypeDef
1330+ member WithKind : ILTypeDefKind -> ILTypeDef
1331+ member WithEncoding : ILDefaultPInvokeEncoding -> ILTypeDef
1332+ member WithSpecialName : bool -> ILTypeDef
1333+ member WithInitSemantics : ILTypeInit -> ILTypeDef
12971334
12981335[<NoEquality; NoComparison>]
12991336[<Sealed>]
@@ -1339,10 +1376,11 @@ type ILExportedTypeOrForwarder =
13391376{ ScopeRef: ILScopeRef ;
13401377/// [Namespace.]Name
13411378 Name: string ;
1342- IsForwarder: bool ;
1343- Access: ILTypeDefAccess ;
1379+ Attributes: TypeAttributes
13441380 Nested: ILNestedExportedTypes ;
1345- CustomAttrs: ILAttributes }
1381+ CustomAttrs: ILAttributes }
1382+ member Access : ILTypeDefAccess
1383+ member IsForwarder : bool
13461384
13471385[<NoEquality; NoComparison>]
13481386[<Sealed>]
@@ -1685,10 +1723,10 @@ val mkILClassCtor: MethodBody -> ILMethodDef
16851723val mkILNonGenericEmptyCtor : ILSourceMarker option -> ILType -> ILMethodDef
16861724val mkILStaticMethod : ILGenericParameterDefs * string * ILMemberAccess * ILParameter list * ILReturn * MethodBody -> ILMethodDef
16871725val mkILNonGenericStaticMethod : string * ILMemberAccess * ILParameter list * ILReturn * MethodBody -> ILMethodDef
1688- val mkILGenericVirtualMethod : string * ILMemberAccess * ILGenericParameterDefs * ILParameter list * ILReturn * MethodBody -> ILMethodDef
1689- val mkILGenericNonVirtualMethod : string * ILMemberAccess * ILGenericParameterDefs * ILParameter list * ILReturn * MethodBody -> ILMethodDef
1726+ val mkILGenericVirtualMethod : string * ILMemberAccess * ILGenericParameterDefs * ILParameter list * ILReturn * MethodBody -> ILMethodDef
1727+ val mkILGenericNonVirtualMethod : string * ILMemberAccess * ILGenericParameterDefs * ILParameter list * ILReturn * MethodBody -> ILMethodDef
16901728val mkILNonGenericVirtualMethod : string * ILMemberAccess * ILParameter list * ILReturn * MethodBody -> ILMethodDef
1691- val mkILNonGenericInstanceMethod : string * ILMemberAccess * ILParameter list * ILReturn * MethodBody -> ILMethodDef
1729+ val mkILNonGenericInstanceMethod : string * ILMemberAccess * ILParameter list * ILReturn * MethodBody -> ILMethodDef
16921730
16931731
16941732/// Make field definitions.
@@ -1727,7 +1765,7 @@ val mkILStorageCtor: ILSourceMarker option * ILInstr list * ILType * (string * I
17271765val mkILSimpleStorageCtor : ILSourceMarker option * ILTypeSpec option * ILType * ILParameter list * ( string * ILType ) list * ILMemberAccess -> ILMethodDef
17281766val mkILSimpleStorageCtorWithParamNames : ILSourceMarker option * ILTypeSpec option * ILType * ILParameter list * ( string * string * ILType ) list * ILMemberAccess -> ILMethodDef
17291767
1730- val mkILDelegateMethods : ILGlobals -> ILType * ILType -> ILParameter list * ILReturn -> ILMethodDef list
1768+ val mkILDelegateMethods : ILMemberAccess -> ILGlobals-> ILType * ILType -> ILParameter list * ILReturn -> ILMethodDef list
17311769
17321770/// Given a delegate type definition which lies in a particular scope ,
17331771/// make a reference to its constructor.
@@ -1785,6 +1823,7 @@ val emptyILTypeDefs: ILTypeDefs
17851823val mkILTypeDefsComputed : ( unit -> ( string list * string * ILAttributes * Lazy < ILTypeDef >) array ) -> ILTypeDefs
17861824val addILTypeDef : ILTypeDef -> ILTypeDefs -> ILTypeDefs
17871825
1826+ val mkTypeForwarder : ILScopeRef -> string -> ILNestedExportedTypes -> ILAttributes -> ILTypeDefAccess -> ILExportedTypeOrForwarder
17881827val mkILNestedExportedTypes : ILNestedExportedType list -> ILNestedExportedTypes
17891828val mkILNestedExportedTypesLazy : Lazy < ILNestedExportedType list > -> ILNestedExportedTypes
17901829