提交 b606cb5c 编写于 作者: D Don Syme

hide representations in Abstract IL

上级 2c6e3b6d
...@@ -1000,15 +1000,21 @@ type MethodCodeKind = ...@@ -1000,15 +1000,21 @@ type MethodCodeKind =
/// may include the bounds, if any, on the generic parameter. /// may include the bounds, if any, on the generic parameter.
type ILGenericParameterDef = type ILGenericParameterDef =
{ Name: string { Name: string
/// At most one is the parent type, the others are interface types.
/// At most one is the parent type, the others are interface types.
Constraints: ILTypes Constraints: ILTypes
/// Variance of type parameters, only applicable to generic parameters for generic interfaces and delegates. /// Variance of type parameters, only applicable to generic parameters for generic interfaces and delegates.
Variance: ILGenericVariance Variance: ILGenericVariance
/// Indicates the type argument must be a reference type. /// Indicates the type argument must be a reference type.
HasReferenceTypeConstraint: bool HasReferenceTypeConstraint: bool
CustomAttrs: ILAttributes CustomAttrs: ILAttributes
/// Indicates the type argument must be a value type, but not Nullable. /// Indicates the type argument must be a value type, but not Nullable.
HasNotNullableValueTypeConstraint: bool HasNotNullableValueTypeConstraint: bool
/// Indicates the type argument must have a public nullary constructor. /// Indicates the type argument must have a public nullary constructor.
HasDefaultConstructorConstraint: bool } HasDefaultConstructorConstraint: bool }
...@@ -1020,13 +1026,14 @@ type ILLazyMethodBody = ...@@ -1020,13 +1026,14 @@ type ILLazyMethodBody =
/// IL Method definitions. /// IL Method definitions.
/// ///
/// The object is immutable. We use a class to get control over the representation used, /// This type is immutable and record-like. We use a class to get control over the representation
/// which allows more efficient representation of the information. /// used, which allows more efficient representation of the information.
[<NoComparison; NoEquality>] [<NoComparison; NoEquality>]
type ILMethodDef = type ILMethodDef =
/// Functional creation of a value
new: name: string * attributes: MethodAttributes * implAttributes: MethodImplAttributes * callingConv: ILCallingConv * parameters: ILParameters * ret: ILReturn * body: ILLazyMethodBody * securityDecls: ILSecurityDecls * isEntryPoint:bool * genericParams: ILGenericParameterDefs * customAttrs: ILAttributes -> ILMethodDef new: name: string * attributes: MethodAttributes * implAttributes: MethodImplAttributes * callingConv: ILCallingConv * parameters: ILParameters * ret: ILReturn * body: ILLazyMethodBody * securityDecls: ILSecurityDecls * isEntryPoint:bool * genericParams: ILGenericParameterDefs * customAttrs: ILAttributes -> ILMethodDef
member With: ?name: string * ?attributes: MethodAttributes * ?implAttributes: MethodImplAttributes * ?callingConv: ILCallingConv * ?parameters: ILParameters * ?ret: ILReturn * ?body: ILLazyMethodBody * ?securityDecls: ILSecurityDecls * ?isEntryPoint:bool * ?genericParams: ILGenericParameterDefs * ?customAttrs: ILAttributes -> ILMethodDef
member Name: string member Name: string
member Attributes: MethodAttributes member Attributes: MethodAttributes
member ImplAttributes: MethodImplAttributes member ImplAttributes: MethodImplAttributes
...@@ -1073,6 +1080,7 @@ type ILMethodDef = ...@@ -1073,6 +1080,7 @@ type ILMethodDef =
/// The method is exported to unmanaged code using COM interop. /// The method is exported to unmanaged code using COM interop.
member IsUnmanagedExport: bool member IsUnmanagedExport: bool
member IsReqSecObj: bool member IsReqSecObj: bool
/// Some methods are marked "HasSecurity" even if there are no permissions attached, e.g. if they use SuppressUnmanagedCodeSecurityAttribute /// Some methods are marked "HasSecurity" even if there are no permissions attached, e.g. if they use SuppressUnmanagedCodeSecurityAttribute
member HasSecurity: bool member HasSecurity: bool
member IsManaged: bool member IsManaged: bool
...@@ -1086,6 +1094,8 @@ type ILMethodDef = ...@@ -1086,6 +1094,8 @@ type ILMethodDef =
/// SafeHandle finalizer must be run. /// SafeHandle finalizer must be run.
member IsMustRun: bool member IsMustRun: bool
/// Functional update of the value
member With: ?name: string * ?attributes: MethodAttributes * ?implAttributes: MethodImplAttributes * ?callingConv: ILCallingConv * ?parameters: ILParameters * ?ret: ILReturn * ?body: ILLazyMethodBody * ?securityDecls: ILSecurityDecls * ?isEntryPoint:bool * ?genericParams: ILGenericParameterDefs * ?customAttrs: ILAttributes -> ILMethodDef
member WithSpecialName: ILMethodDef member WithSpecialName: ILMethodDef
member WithHideBySig: unit -> ILMethodDef member WithHideBySig: unit -> ILMethodDef
member WithHideBySig: bool -> ILMethodDef member WithHideBySig: bool -> ILMethodDef
...@@ -1104,8 +1114,9 @@ type ILMethodDef = ...@@ -1104,8 +1114,9 @@ type ILMethodDef =
/// Tables of methods. Logically equivalent to a list of methods but /// Tables of methods. Logically equivalent to a list of methods but
/// the table is kept in a form optimized for looking up methods by /// the table is kept in a form optimized for looking up methods by
/// name and arity. /// name and arity.
///
/// abstract type equivalent to [ILMethodDef list] /// This type is immutable and record-like. We use a class to get control over the representation
/// used, which allows more efficient representation of the information.
[<NoEquality; NoComparison; Sealed>] [<NoEquality; NoComparison; Sealed>]
type ILMethodDefs = type ILMethodDefs =
interface IEnumerable<ILMethodDef> interface IEnumerable<ILMethodDef>
...@@ -1114,15 +1125,21 @@ type ILMethodDefs = ...@@ -1114,15 +1125,21 @@ type ILMethodDefs =
member FindByName: string -> ILMethodDef list member FindByName: string -> ILMethodDef list
/// Field definitions. /// Field definitions.
///
/// This type is immutable and record-like. We use a class to get control over the representation
/// used, which allows more efficient representation of the information.
[<NoComparison; NoEquality>] [<NoComparison; NoEquality>]
type ILFieldDef = type ILFieldDef =
/// Functional creation of a value
new: name: string * fieldType: ILType * attributes: FieldAttributes * data: byte[] option * literalValue: ILFieldInit option * offset: int32 option * marshal: ILNativeType option * customAttrs: ILAttributes -> ILFieldDef new: name: string * fieldType: ILType * attributes: FieldAttributes * data: byte[] option * literalValue: ILFieldInit option * offset: int32 option * marshal: ILNativeType option * customAttrs: ILAttributes -> ILFieldDef
member With: ?name: string * ?fieldType: ILType * ?attributes: FieldAttributes * ?data: byte[] option * ?literalValue: ILFieldInit option * ?offset: int32 option * ?marshal: ILNativeType option * ?customAttrs: ILAttributes -> ILFieldDef
member Name: string member Name: string
member FieldType: ILType member FieldType: ILType
member Attributes: FieldAttributes member Attributes: FieldAttributes
member Data: byte[] option member Data: byte[] option
member LiteralValue: ILFieldInit option member LiteralValue: ILFieldInit option
/// The explicit offset in bytes when explicit layout is used. /// The explicit offset in bytes when explicit layout is used.
member Offset: int32 option member Offset: int32 option
member Marshal: ILNativeType option member Marshal: ILNativeType option
...@@ -1133,6 +1150,9 @@ type ILFieldDef = ...@@ -1133,6 +1150,9 @@ type ILFieldDef =
member NotSerialized: bool member NotSerialized: bool
member IsInitOnly: bool member IsInitOnly: bool
member Access: ILMemberAccess member Access: ILMemberAccess
/// Functional update of the value
member With: ?name: string * ?fieldType: ILType * ?attributes: FieldAttributes * ?data: byte[] option * ?literalValue: ILFieldInit option * ?offset: int32 option * ?marshal: ILNativeType option * ?customAttrs: ILAttributes -> ILFieldDef
member WithAccess: ILMemberAccess -> ILFieldDef member WithAccess: ILMemberAccess -> ILFieldDef
member WithInitOnly: bool -> ILFieldDef member WithInitOnly: bool -> ILFieldDef
member WithStatic: bool -> ILFieldDef member WithStatic: bool -> ILFieldDef
...@@ -1150,10 +1170,15 @@ type ILFieldDefs = ...@@ -1150,10 +1170,15 @@ type ILFieldDefs =
member LookupByName: string -> ILFieldDef list member LookupByName: string -> ILFieldDef list
/// Event definitions. /// Event definitions.
///
/// This type is immutable and record-like. We use a class to get control over the representation
/// used, which allows more efficient representation of the information.
[<NoComparison; NoEquality>] [<NoComparison; NoEquality>]
type ILEventDef = type ILEventDef =
/// Functional creation of a value
new: eventType: ILType option * name: string * attributes: EventAttributes * addMethod: ILMethodRef * removeMethod: ILMethodRef * fireMethod: ILMethodRef option * otherMethods: ILMethodRef list * customAttrs: ILAttributes -> ILEventDef new: eventType: ILType option * name: string * attributes: EventAttributes * addMethod: ILMethodRef * removeMethod: ILMethodRef * fireMethod: ILMethodRef option * otherMethods: ILMethodRef list * customAttrs: ILAttributes -> ILEventDef
member With: ?eventType: ILType option * ?name: string * ?attributes: EventAttributes * ?addMethod: ILMethodRef * ?removeMethod: ILMethodRef * ?fireMethod: ILMethodRef option * ?otherMethods: ILMethodRef list * ?customAttrs: ILAttributes -> ILEventDef
member EventType: ILType option member EventType: ILType option
member Name: string member Name: string
member Attributes: EventAttributes member Attributes: EventAttributes
...@@ -1165,17 +1190,31 @@ type ILEventDef = ...@@ -1165,17 +1190,31 @@ type ILEventDef =
member IsSpecialName: bool member IsSpecialName: bool
member IsRTSpecialName: bool member IsRTSpecialName: bool
/// Functional update of the value
member With: ?eventType: ILType option * ?name: string * ?attributes: EventAttributes * ?addMethod: ILMethodRef * ?removeMethod: ILMethodRef * ?fireMethod: ILMethodRef option * ?otherMethods: ILMethodRef list * ?customAttrs: ILAttributes -> ILEventDef
/// Table of those events in a type definition. /// Table of those events in a type definition.
///
/// This type is immutable and record-like. We use a class to get control over the representation
/// used, which allows more efficient representation of the information.
[<NoEquality; NoComparison; Sealed>] [<NoEquality; NoComparison; Sealed>]
type ILEventDefs = type ILEventDefs =
member AsList: ILEventDef list member AsList: ILEventDef list
member LookupByName: string -> ILEventDef list member LookupByName: string -> ILEventDef list
/// Property definitions /// Property definitions
///
/// This type is immutable and record-like. We use a class to get control over the representation
/// used, which allows more efficient representation of the information.
[<NoComparison; NoEquality>] [<NoComparison; NoEquality>]
type ILPropertyDef = type ILPropertyDef =
/// Functional creation of a value
new: name: string * attributes: PropertyAttributes * setMethod: ILMethodRef option * getMethod: ILMethodRef option * callingConv: ILThisConvention * propertyType: ILType * init: ILFieldInit option * args: ILTypes * customAttrs: ILAttributes -> ILPropertyDef new: name: string * attributes: PropertyAttributes * setMethod: ILMethodRef option * getMethod: ILMethodRef option * callingConv: ILThisConvention * propertyType: ILType * init: ILFieldInit option * args: ILTypes * customAttrs: ILAttributes -> ILPropertyDef
/// Functional update of the value
member With: ?name: string * ?attributes: PropertyAttributes * ?setMethod: ILMethodRef option * ?getMethod: ILMethodRef option * ?callingConv: ILThisConvention * ?propertyType: ILType * ?init: ILFieldInit option * ?args: ILTypes * ?customAttrs: ILAttributes -> ILPropertyDef member With: ?name: string * ?attributes: PropertyAttributes * ?setMethod: ILMethodRef option * ?getMethod: ILMethodRef option * ?callingConv: ILThisConvention * ?propertyType: ILType * ?init: ILFieldInit option * ?args: ILTypes * ?customAttrs: ILAttributes -> ILPropertyDef
member Name: string member Name: string
member Attributes: PropertyAttributes member Attributes: PropertyAttributes
member SetMethod: ILMethodRef option member SetMethod: ILMethodRef option
...@@ -1267,9 +1306,9 @@ type ILTypeDefs = ...@@ -1267,9 +1306,9 @@ type ILTypeDefs =
/// Represents IL Type Definitions. /// Represents IL Type Definitions.
/// ///
/// The object is immutable. We use a class /// This type is immutable and record-like. We use a class to get control over the representation
/// to get control over the representation used, which allows more efficient representation of the information. /// used, which allows more efficient representation of the information.
and [<NoComparison; NoEquality; Class>] and [<NoComparison; NoEquality>]
ILTypeDef = ILTypeDef =
/// Create the contents /// Create the contents
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册