629 lines
30 KiB
C#
629 lines
30 KiB
C#
using System;
|
|
using System.Diagnostics.SymbolStore;
|
|
using System.Globalization;
|
|
using System.Runtime.InteropServices;
|
|
using System.Security;
|
|
using System.Security.Permissions;
|
|
using System.Text;
|
|
|
|
namespace System.Reflection.Emit
|
|
{
|
|
/// <summary>Defines and represents a constructor of a dynamic class.</summary>
|
|
// Token: 0x020001E2 RID: 482
|
|
[ComVisible(true)]
|
|
[ComDefaultInterface(typeof(_ConstructorBuilder))]
|
|
[ClassInterface(ClassInterfaceType.None)]
|
|
public sealed class ConstructorBuilder : ConstructorInfo, _ConstructorBuilder
|
|
{
|
|
// Token: 0x060018DC RID: 6364 RVA: 0x0005FD78 File Offset: 0x0005DF78
|
|
internal ConstructorBuilder(TypeBuilder tb, MethodAttributes attributes, CallingConventions callingConvention, Type[] parameterTypes, Type[][] paramModReq, Type[][] paramModOpt)
|
|
{
|
|
this.attrs = attributes | MethodAttributes.SpecialName | MethodAttributes.RTSpecialName;
|
|
this.call_conv = callingConvention;
|
|
if (parameterTypes != null)
|
|
{
|
|
for (int i = 0; i < parameterTypes.Length; i++)
|
|
{
|
|
if (parameterTypes[i] == null)
|
|
{
|
|
throw new ArgumentException("Elements of the parameterTypes array cannot be null", "parameterTypes");
|
|
}
|
|
}
|
|
this.parameters = new Type[parameterTypes.Length];
|
|
Array.Copy(parameterTypes, this.parameters, parameterTypes.Length);
|
|
}
|
|
this.type = tb;
|
|
this.paramModReq = paramModReq;
|
|
this.paramModOpt = paramModOpt;
|
|
this.table_idx = this.get_next_table_index(this, 6, true);
|
|
((ModuleBuilder)tb.Module).RegisterToken(this, this.GetToken().Token);
|
|
}
|
|
|
|
/// <summary>Maps a set of names to a corresponding set of dispatch identifiers.</summary>
|
|
/// <param name="riid">Reserved for future use. Must be IID_NULL.</param>
|
|
/// <param name="rgszNames">Passed-in array of names to be mapped.</param>
|
|
/// <param name="cNames">Count of the names to be mapped.</param>
|
|
/// <param name="lcid">The locale context in which to interpret the names.</param>
|
|
/// <param name="rgDispId">Caller-allocated array which receives the IDs corresponding to the names.</param>
|
|
/// <exception cref="T:System.NotImplementedException">Late-bound access using the COM IDispatch interface is not supported.</exception>
|
|
// Token: 0x060018DD RID: 6365 RVA: 0x0005FE48 File Offset: 0x0005E048
|
|
void _ConstructorBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
/// <summary>Retrieves the type information for an object, which can then be used to get the type information for an interface.</summary>
|
|
/// <param name="iTInfo">The type information to return.</param>
|
|
/// <param name="lcid">The locale identifier for the type information.</param>
|
|
/// <param name="ppTInfo">Receives a pointer to the requested type information object.</param>
|
|
/// <exception cref="T:System.NotImplementedException">Late-bound access using the COM IDispatch interface is not supported.</exception>
|
|
// Token: 0x060018DE RID: 6366 RVA: 0x0005FE50 File Offset: 0x0005E050
|
|
void _ConstructorBuilder.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
/// <summary>Retrieves the number of type information interfaces that an object provides (either 0 or 1).</summary>
|
|
/// <param name="pcTInfo">Points to a location that receives the number of type information interfaces provided by the object.</param>
|
|
/// <exception cref="T:System.NotImplementedException">Late-bound access using the COM IDispatch interface is not supported.</exception>
|
|
// Token: 0x060018DF RID: 6367 RVA: 0x0005FE58 File Offset: 0x0005E058
|
|
void _ConstructorBuilder.GetTypeInfoCount(out uint pcTInfo)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
/// <summary>Provides access to properties and methods exposed by an object.</summary>
|
|
/// <param name="dispIdMember">Identifies the member.</param>
|
|
/// <param name="riid">Reserved for future use. Must be IID_NULL.</param>
|
|
/// <param name="lcid">The locale context in which to interpret arguments.</param>
|
|
/// <param name="wFlags">Flags describing the context of the call.</param>
|
|
/// <param name="pDispParams">Pointer to a structure containing an array of arguments, an array of argument DISPIDs for named arguments, and counts for the number of elements in the arrays.</param>
|
|
/// <param name="pVarResult">Pointer to the location where the result is to be stored.</param>
|
|
/// <param name="pExcepInfo">Pointer to a structure that contains exception information.</param>
|
|
/// <param name="puArgErr">The index of the first argument that has an error.</param>
|
|
/// <exception cref="T:System.NotImplementedException">Late-bound access using the COM IDispatch interface is not supported.</exception>
|
|
// Token: 0x060018E0 RID: 6368 RVA: 0x0005FE60 File Offset: 0x0005E060
|
|
void _ConstructorBuilder.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
/// <summary>Gets a <see cref="T:System.Reflection.CallingConventions" /> value that depends on whether the declaring type is generic.</summary>
|
|
/// <returns>
|
|
/// <see cref="F:System.Reflection.CallingConventions.HasThis" /> if the declaring type is generic; otherwise, <see cref="F:System.Reflection.CallingConventions.Standard" />. </returns>
|
|
// Token: 0x17000454 RID: 1108
|
|
// (get) Token: 0x060018E1 RID: 6369 RVA: 0x0005FE68 File Offset: 0x0005E068
|
|
[MonoTODO]
|
|
public override CallingConventions CallingConvention
|
|
{
|
|
get
|
|
{
|
|
return this.call_conv;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets or sets whether the local variables in this constructor should be zero-initialized.</summary>
|
|
/// <returns>Read/write. Gets or sets whether the local variables in this constructor should be zero-initialized.</returns>
|
|
// Token: 0x17000455 RID: 1109
|
|
// (get) Token: 0x060018E2 RID: 6370 RVA: 0x0005FE70 File Offset: 0x0005E070
|
|
// (set) Token: 0x060018E3 RID: 6371 RVA: 0x0005FE78 File Offset: 0x0005E078
|
|
public bool InitLocals
|
|
{
|
|
get
|
|
{
|
|
return this.init_locals;
|
|
}
|
|
set
|
|
{
|
|
this.init_locals = value;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000456 RID: 1110
|
|
// (get) Token: 0x060018E4 RID: 6372 RVA: 0x0005FE84 File Offset: 0x0005E084
|
|
internal TypeBuilder TypeBuilder
|
|
{
|
|
get
|
|
{
|
|
return this.type;
|
|
}
|
|
}
|
|
|
|
/// <summary>Returns the method implementation flags for this constructor.</summary>
|
|
/// <returns>The method implementation flags for this constructor.</returns>
|
|
// Token: 0x060018E5 RID: 6373 RVA: 0x0005FE8C File Offset: 0x0005E08C
|
|
public override MethodImplAttributes GetMethodImplementationFlags()
|
|
{
|
|
return this.iattrs;
|
|
}
|
|
|
|
/// <summary>Returns the parameters of this constructor.</summary>
|
|
/// <returns>Returns an array of <see cref="T:System.Reflection.ParameterInfo" /> objects that represent the parameters of this constructor.</returns>
|
|
/// <exception cref="T:System.InvalidOperationException">
|
|
/// <see cref="M:System.Reflection.Emit.TypeBuilder.CreateType" /> has not been called on this constructor's type, in the .NET Framework versions 1.0 and 1.1. </exception>
|
|
/// <exception cref="T:System.NotSupportedException">
|
|
/// <see cref="M:System.Reflection.Emit.TypeBuilder.CreateType" /> has not been called on this constructor's type, in the .NET Framework version 2.0. </exception>
|
|
// Token: 0x060018E6 RID: 6374 RVA: 0x0005FE94 File Offset: 0x0005E094
|
|
public override ParameterInfo[] GetParameters()
|
|
{
|
|
if (!this.type.is_created && !this.IsCompilerContext)
|
|
{
|
|
throw this.not_created();
|
|
}
|
|
return this.GetParametersInternal();
|
|
}
|
|
|
|
// Token: 0x060018E7 RID: 6375 RVA: 0x0005FECC File Offset: 0x0005E0CC
|
|
internal ParameterInfo[] GetParametersInternal()
|
|
{
|
|
if (this.parameters == null)
|
|
{
|
|
return new ParameterInfo[0];
|
|
}
|
|
ParameterInfo[] array = new ParameterInfo[this.parameters.Length];
|
|
for (int i = 0; i < this.parameters.Length; i++)
|
|
{
|
|
array[i] = new ParameterInfo((this.pinfo != null) ? this.pinfo[i + 1] : null, this.parameters[i], this, i + 1);
|
|
}
|
|
return array;
|
|
}
|
|
|
|
// Token: 0x060018E8 RID: 6376 RVA: 0x0005FF44 File Offset: 0x0005E144
|
|
internal override int GetParameterCount()
|
|
{
|
|
if (this.parameters == null)
|
|
{
|
|
return 0;
|
|
}
|
|
return this.parameters.Length;
|
|
}
|
|
|
|
/// <summary>Dynamically invokes the constructor reflected by this instance with the specified arguments, under the constraints of the specified Binder.</summary>
|
|
/// <returns>An instance of the class associated with the constructor.</returns>
|
|
/// <param name="obj">The object that needs to be reinitialized. </param>
|
|
/// <param name="invokeAttr">One of the BindingFlags values that specifies the type of binding that is desired. </param>
|
|
/// <param name="binder">A Binder that defines a set of properties and enables the binding, coercion of argument types, and invocation of members using reflection. If <paramref name="binder" /> is null, then Binder.DefaultBinding is used. </param>
|
|
/// <param name="parameters">An argument list. This is an array of arguments with the same number, order, and type as the parameters of the constructor to be invoked. If there are no parameters, this should be a null reference (Nothing in Visual Basic). </param>
|
|
/// <param name="culture">A <see cref="T:System.Globalization.CultureInfo" /> used to govern the coercion of types. If this is null, the <see cref="T:System.Globalization.CultureInfo" /> for the current thread is used. </param>
|
|
/// <exception cref="T:System.NotSupportedException">This method is not currently supported. You can retrieve the constructor using <see cref="M:System.Type.GetConstructor(System.Reflection.BindingFlags,System.Reflection.Binder,System.Reflection.CallingConventions,System.Type[],System.Reflection.ParameterModifier[])" /> and call <see cref="M:System.Reflection.ConstructorInfo.Invoke(System.Reflection.BindingFlags,System.Reflection.Binder,System.Object[],System.Globalization.CultureInfo)" /> on the returned <see cref="T:System.Reflection.ConstructorInfo" />. </exception>
|
|
// Token: 0x060018E9 RID: 6377 RVA: 0x0005FF5C File Offset: 0x0005E15C
|
|
public override object Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture)
|
|
{
|
|
throw this.not_supported();
|
|
}
|
|
|
|
/// <summary>Invokes the constructor dynamically reflected by this instance on the given object, passing along the specified parameters, and under the constraints of the given binder.</summary>
|
|
/// <returns>Returns an <see cref="T:System.Object" /> that is the return value of the invoked constructor.</returns>
|
|
/// <param name="invokeAttr">This must be a bit flag from <see cref="T:System.Reflection.BindingFlags" />, such as InvokeMethod, NonPublic, and so on. </param>
|
|
/// <param name="binder">An object that enables the binding, coercion of argument types, invocation of members, and retrieval of MemberInfo objects using reflection. If binder is null, the default binder is used. See <see cref="T:System.Reflection.Binder" />. </param>
|
|
/// <param name="parameters">An argument list. This is an array of arguments with the same number, order, and type as the parameters of the constructor to be invoked. If there are no parameters this should be null. </param>
|
|
/// <param name="culture">An instance of <see cref="T:System.Globalization.CultureInfo" /> used to govern the coercion of types. If this is null, the <see cref="T:System.Globalization.CultureInfo" /> for the current thread is used. (For example, this is necessary to convert a <see cref="T:System.String" /> that represents 1000 to a <see cref="T:System.Double" /> value, since 1000 is represented differently by different cultures.) </param>
|
|
/// <exception cref="T:System.NotSupportedException">This method is not currently supported. You can retrieve the constructor using <see cref="M:System.Type.GetConstructor(System.Reflection.BindingFlags,System.Reflection.Binder,System.Reflection.CallingConventions,System.Type[],System.Reflection.ParameterModifier[])" /> and call <see cref="M:System.Reflection.ConstructorInfo.Invoke(System.Reflection.BindingFlags,System.Reflection.Binder,System.Object[],System.Globalization.CultureInfo)" /> on the returned <see cref="T:System.Reflection.ConstructorInfo" />. </exception>
|
|
// Token: 0x060018EA RID: 6378 RVA: 0x0005FF64 File Offset: 0x0005E164
|
|
public override object Invoke(BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture)
|
|
{
|
|
throw this.not_supported();
|
|
}
|
|
|
|
/// <summary>Retrieves the internal handle for the method. Use this handle to access the underlying metadata handle.</summary>
|
|
/// <returns>Returns the internal handle for the method. Use this handle to access the underlying metadata handle.</returns>
|
|
/// <exception cref="T:System.NotSupportedException">This property is not supported on this class. </exception>
|
|
// Token: 0x17000457 RID: 1111
|
|
// (get) Token: 0x060018EB RID: 6379 RVA: 0x0005FF6C File Offset: 0x0005E16C
|
|
public override RuntimeMethodHandle MethodHandle
|
|
{
|
|
get
|
|
{
|
|
throw this.not_supported();
|
|
}
|
|
}
|
|
|
|
/// <summary>Retrieves the attributes for this constructor.</summary>
|
|
/// <returns>Returns the attributes for this constructor.</returns>
|
|
// Token: 0x17000458 RID: 1112
|
|
// (get) Token: 0x060018EC RID: 6380 RVA: 0x0005FF74 File Offset: 0x0005E174
|
|
public override MethodAttributes Attributes
|
|
{
|
|
get
|
|
{
|
|
return this.attrs;
|
|
}
|
|
}
|
|
|
|
/// <summary>Holds a reference to the <see cref="T:System.Type" /> object from which this object was obtained.</summary>
|
|
/// <returns>Returns the Type object from which this object was obtained.</returns>
|
|
// Token: 0x17000459 RID: 1113
|
|
// (get) Token: 0x060018ED RID: 6381 RVA: 0x0005FF7C File Offset: 0x0005E17C
|
|
public override Type ReflectedType
|
|
{
|
|
get
|
|
{
|
|
return this.type;
|
|
}
|
|
}
|
|
|
|
/// <summary>Retrieves a reference to the <see cref="T:System.Type" /> object for the type that declares this member.</summary>
|
|
/// <returns>Returns the <see cref="T:System.Type" /> object for the type that declares this member.</returns>
|
|
// Token: 0x1700045A RID: 1114
|
|
// (get) Token: 0x060018EE RID: 6382 RVA: 0x0005FF84 File Offset: 0x0005E184
|
|
public override Type DeclaringType
|
|
{
|
|
get
|
|
{
|
|
return this.type;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets null.</summary>
|
|
/// <returns>Returns null.</returns>
|
|
// Token: 0x1700045B RID: 1115
|
|
// (get) Token: 0x060018EF RID: 6383 RVA: 0x0005FF8C File Offset: 0x0005E18C
|
|
public Type ReturnType
|
|
{
|
|
get
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
|
|
/// <summary>Retrieves the name of this constructor.</summary>
|
|
/// <returns>Returns the name of this constructor.</returns>
|
|
// Token: 0x1700045C RID: 1116
|
|
// (get) Token: 0x060018F0 RID: 6384 RVA: 0x0005FF90 File Offset: 0x0005E190
|
|
public override string Name
|
|
{
|
|
get
|
|
{
|
|
return ((this.attrs & MethodAttributes.Static) == MethodAttributes.PrivateScope) ? ConstructorInfo.ConstructorName : ConstructorInfo.TypeConstructorName;
|
|
}
|
|
}
|
|
|
|
/// <summary>Retrieves the signature of the field in the form of a string.</summary>
|
|
/// <returns>Returns the signature of the field.</returns>
|
|
// Token: 0x1700045D RID: 1117
|
|
// (get) Token: 0x060018F1 RID: 6385 RVA: 0x0005FFB0 File Offset: 0x0005E1B0
|
|
public string Signature
|
|
{
|
|
get
|
|
{
|
|
return "constructor signature";
|
|
}
|
|
}
|
|
|
|
/// <summary>Adds declarative security to this constructor.</summary>
|
|
/// <param name="action">The security action to be taken, such as Demand, Assert, and so on. </param>
|
|
/// <param name="pset">The set of permissions the action applies to. </param>
|
|
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
|
/// <paramref name="action" /> is invalid (RequestMinimum, RequestOptional, and RequestRefuse are invalid). </exception>
|
|
/// <exception cref="T:System.InvalidOperationException">The containing type has been previously created using <see cref="M:System.Reflection.Emit.TypeBuilder.CreateType" />.-or- The permission set <paramref name="pset" /> contains an action that was added earlier by AddDeclarativeSecurity. </exception>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="pset" /> is null. </exception>
|
|
// Token: 0x060018F2 RID: 6386 RVA: 0x0005FFB8 File Offset: 0x0005E1B8
|
|
public void AddDeclarativeSecurity(SecurityAction action, PermissionSet pset)
|
|
{
|
|
}
|
|
|
|
/// <summary>Defines a parameter of this constructor.</summary>
|
|
/// <returns>Returns a ParameterBuilder object that represents the new parameter of this constructor.</returns>
|
|
/// <param name="iSequence">The position of the parameter in the parameter list. Parameters are indexed beginning with the number 1 for the first parameter. </param>
|
|
/// <param name="attributes">The attributes of the parameter. </param>
|
|
/// <param name="strParamName">The name of the parameter. The name can be the null string. </param>
|
|
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
|
/// <paramref name="position" /> is less than or equal to zero, or it is greater than the number of parameters of the constructor. </exception>
|
|
/// <exception cref="T:System.InvalidOperationException">The containing type has been created using <see cref="M:System.Reflection.Emit.TypeBuilder.CreateType" />. </exception>
|
|
// Token: 0x060018F3 RID: 6387 RVA: 0x0005FFBC File Offset: 0x0005E1BC
|
|
public ParameterBuilder DefineParameter(int iSequence, ParameterAttributes attributes, string strParamName)
|
|
{
|
|
if (iSequence < 1 || iSequence > this.GetParameterCount())
|
|
{
|
|
throw new ArgumentOutOfRangeException("iSequence");
|
|
}
|
|
if (this.type.is_created)
|
|
{
|
|
throw this.not_after_created();
|
|
}
|
|
ParameterBuilder parameterBuilder = new ParameterBuilder(this, iSequence, attributes, strParamName);
|
|
if (this.pinfo == null)
|
|
{
|
|
this.pinfo = new ParameterBuilder[this.parameters.Length + 1];
|
|
}
|
|
this.pinfo[iSequence] = parameterBuilder;
|
|
return parameterBuilder;
|
|
}
|
|
|
|
/// <summary>Checks if the specified custom attribute type is defined.</summary>
|
|
/// <returns>true if the specified custom attribute type is defined; otherwise, false.</returns>
|
|
/// <param name="attributeType">A custom attribute type. </param>
|
|
/// <param name="inherit">Controls inheritance of custom attributes from base classes. This parameter is ignored. </param>
|
|
/// <exception cref="T:System.NotSupportedException">This method is not currently supported. You can retrieve the constructor using <see cref="M:System.Type.GetConstructor(System.Reflection.BindingFlags,System.Reflection.Binder,System.Reflection.CallingConventions,System.Type[],System.Reflection.ParameterModifier[])" /> and call <see cref="M:System.Reflection.MemberInfo.IsDefined(System.Type,System.Boolean)" /> on the returned <see cref="T:System.Reflection.ConstructorInfo" />. </exception>
|
|
// Token: 0x060018F4 RID: 6388 RVA: 0x00060034 File Offset: 0x0005E234
|
|
public override bool IsDefined(Type attributeType, bool inherit)
|
|
{
|
|
throw this.not_supported();
|
|
}
|
|
|
|
/// <summary>Returns all the custom attributes defined for this constructor.</summary>
|
|
/// <returns>Returns an array of objects representing all the custom attributes of the constructor represented by this <see cref="T:System.Reflection.Emit.ConstructorBuilder" /> instance.</returns>
|
|
/// <param name="inherit">Controls inheritance of custom attributes from base classes. This parameter is ignored. </param>
|
|
/// <exception cref="T:System.NotSupportedException">This method is not currently supported. </exception>
|
|
// Token: 0x060018F5 RID: 6389 RVA: 0x0006003C File Offset: 0x0005E23C
|
|
public override object[] GetCustomAttributes(bool inherit)
|
|
{
|
|
if (this.type.is_created && this.IsCompilerContext)
|
|
{
|
|
return MonoCustomAttrs.GetCustomAttributes(this, inherit);
|
|
}
|
|
throw this.not_supported();
|
|
}
|
|
|
|
/// <summary>Returns the custom attributes identified by the given type.</summary>
|
|
/// <returns>Returns an array of type <see cref="T:System.Object" /> representing the attributes of this constructor.</returns>
|
|
/// <param name="attributeType">The custom attribute type. </param>
|
|
/// <param name="inherit">Controls inheritance of custom attributes from base classes. This parameter is ignored. </param>
|
|
/// <exception cref="T:System.NotSupportedException">This method is not currently supported. </exception>
|
|
// Token: 0x060018F6 RID: 6390 RVA: 0x00060074 File Offset: 0x0005E274
|
|
public override object[] GetCustomAttributes(Type attributeType, bool inherit)
|
|
{
|
|
if (this.type.is_created && this.IsCompilerContext)
|
|
{
|
|
return MonoCustomAttrs.GetCustomAttributes(this, attributeType, inherit);
|
|
}
|
|
throw this.not_supported();
|
|
}
|
|
|
|
/// <summary>Gets an <see cref="T:System.Reflection.Emit.ILGenerator" /> for this constructor.</summary>
|
|
/// <returns>Returns an <see cref="T:System.Reflection.Emit.ILGenerator" /> object for this constructor.</returns>
|
|
/// <exception cref="T:System.InvalidOperationException">The constructor is a default constructor.-or-The constructor has <see cref="T:System.Reflection.MethodAttributes" /> or <see cref="T:System.Reflection.MethodImplAttributes" /> flags indicating that it should not have a method body.</exception>
|
|
// Token: 0x060018F7 RID: 6391 RVA: 0x000600AC File Offset: 0x0005E2AC
|
|
public ILGenerator GetILGenerator()
|
|
{
|
|
return this.GetILGenerator(64);
|
|
}
|
|
|
|
/// <summary>Gets an <see cref="T:System.Reflection.Emit.ILGenerator" /> object, with the specified MSIL stream size, that can be used to build a method body for this constructor.</summary>
|
|
/// <returns>An <see cref="T:System.Reflection.Emit.ILGenerator" /> for this constructor.</returns>
|
|
/// <param name="streamSize">The size of the MSIL stream, in bytes.</param>
|
|
/// <exception cref="T:System.InvalidOperationException">The constructor is a default constructor.-or-The constructor has <see cref="T:System.Reflection.MethodAttributes" /> or <see cref="T:System.Reflection.MethodImplAttributes" /> flags indicating that it should not have a method body. </exception>
|
|
// Token: 0x060018F8 RID: 6392 RVA: 0x000600B8 File Offset: 0x0005E2B8
|
|
public ILGenerator GetILGenerator(int streamSize)
|
|
{
|
|
if (this.ilgen != null)
|
|
{
|
|
return this.ilgen;
|
|
}
|
|
this.ilgen = new ILGenerator(this.type.Module, ((ModuleBuilder)this.type.Module).GetTokenGenerator(), streamSize);
|
|
return this.ilgen;
|
|
}
|
|
|
|
/// <summary>Set a custom attribute using a custom attribute builder.</summary>
|
|
/// <param name="customBuilder">An instance of a helper class to define the custom attribute. </param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="customBuilder" /> is null. </exception>
|
|
// Token: 0x060018F9 RID: 6393 RVA: 0x0006010C File Offset: 0x0005E30C
|
|
public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
|
|
{
|
|
if (customBuilder == null)
|
|
{
|
|
throw new ArgumentNullException("customBuilder");
|
|
}
|
|
string fullName = customBuilder.Ctor.ReflectedType.FullName;
|
|
if (fullName == "System.Runtime.CompilerServices.MethodImplAttribute")
|
|
{
|
|
byte[] data = customBuilder.Data;
|
|
int num = (int)data[2];
|
|
num |= (int)data[3] << 8;
|
|
this.SetImplementationFlags((MethodImplAttributes)num);
|
|
return;
|
|
}
|
|
if (this.cattrs != null)
|
|
{
|
|
CustomAttributeBuilder[] array = new CustomAttributeBuilder[this.cattrs.Length + 1];
|
|
this.cattrs.CopyTo(array, 0);
|
|
array[this.cattrs.Length] = customBuilder;
|
|
this.cattrs = array;
|
|
}
|
|
else
|
|
{
|
|
this.cattrs = new CustomAttributeBuilder[1];
|
|
this.cattrs[0] = customBuilder;
|
|
}
|
|
}
|
|
|
|
/// <summary>Set a custom attribute using a specified custom attribute blob.</summary>
|
|
/// <param name="con">The constructor for the custom attribute. </param>
|
|
/// <param name="binaryAttribute">A byte blob representing the attributes. </param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="con" /> or <paramref name="binaryAttribute" /> is null. </exception>
|
|
// Token: 0x060018FA RID: 6394 RVA: 0x000601BC File Offset: 0x0005E3BC
|
|
[ComVisible(true)]
|
|
public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
|
|
{
|
|
if (con == null)
|
|
{
|
|
throw new ArgumentNullException("con");
|
|
}
|
|
if (binaryAttribute == null)
|
|
{
|
|
throw new ArgumentNullException("binaryAttribute");
|
|
}
|
|
this.SetCustomAttribute(new CustomAttributeBuilder(con, binaryAttribute));
|
|
}
|
|
|
|
/// <summary>Sets the method implementation flags for this constructor.</summary>
|
|
/// <param name="attributes">The method implementation flags. </param>
|
|
/// <exception cref="T:System.InvalidOperationException">The containing type has been created using <see cref="M:System.Reflection.Emit.TypeBuilder.CreateType" />. </exception>
|
|
// Token: 0x060018FB RID: 6395 RVA: 0x000601F0 File Offset: 0x0005E3F0
|
|
public void SetImplementationFlags(MethodImplAttributes attributes)
|
|
{
|
|
if (this.type.is_created)
|
|
{
|
|
throw this.not_after_created();
|
|
}
|
|
this.iattrs = attributes;
|
|
}
|
|
|
|
/// <summary>Returns a reference to the module that contains this constructor.</summary>
|
|
/// <returns>The module that contains this constructor.</returns>
|
|
// Token: 0x060018FC RID: 6396 RVA: 0x00060210 File Offset: 0x0005E410
|
|
public Module GetModule()
|
|
{
|
|
return this.type.Module;
|
|
}
|
|
|
|
/// <summary>Returns the <see cref="T:System.Reflection.Emit.MethodToken" /> that represents the token for this constructor.</summary>
|
|
/// <returns>Returns the <see cref="T:System.Reflection.Emit.MethodToken" /> of this constructor.</returns>
|
|
// Token: 0x060018FD RID: 6397 RVA: 0x00060220 File Offset: 0x0005E420
|
|
public MethodToken GetToken()
|
|
{
|
|
return new MethodToken(100663296 | this.table_idx);
|
|
}
|
|
|
|
/// <summary>Sets this constructor's custom attribute associated with symbolic information.</summary>
|
|
/// <param name="name">The name of the custom attribute. </param>
|
|
/// <param name="data">The value of the custom attribute. </param>
|
|
/// <exception cref="T:System.InvalidOperationException">The containing type has been created using <see cref="M:System.Reflection.Emit.TypeBuilder.CreateType" />.-or- The module does not have a symbol writer defined. For example, the module is not a debug module. </exception>
|
|
// Token: 0x060018FE RID: 6398 RVA: 0x00060234 File Offset: 0x0005E434
|
|
[MonoTODO]
|
|
public void SetSymCustomAttribute(string name, byte[] data)
|
|
{
|
|
if (this.type.is_created)
|
|
{
|
|
throw this.not_after_created();
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets the dynamic module in which this constructor is defined.</summary>
|
|
/// <returns>A <see cref="T:System.Reflection.Module" /> object that represents the dynamic module in which this constructor is defined.</returns>
|
|
// Token: 0x1700045E RID: 1118
|
|
// (get) Token: 0x060018FF RID: 6399 RVA: 0x00060250 File Offset: 0x0005E450
|
|
public override Module Module
|
|
{
|
|
get
|
|
{
|
|
return base.Module;
|
|
}
|
|
}
|
|
|
|
/// <summary>Returns this <see cref="T:System.Reflection.Emit.ConstructorBuilder" /> instance as a <see cref="T:System.String" />.</summary>
|
|
/// <returns>Returns a <see cref="T:System.String" /> containing the name, attributes, and exceptions of this constructor, followed by the current Microsoft intermediate language (MSIL) stream.</returns>
|
|
// Token: 0x06001900 RID: 6400 RVA: 0x00060258 File Offset: 0x0005E458
|
|
public override string ToString()
|
|
{
|
|
return "ConstructorBuilder ['" + this.type.Name + "']";
|
|
}
|
|
|
|
// Token: 0x06001901 RID: 6401 RVA: 0x00060274 File Offset: 0x0005E474
|
|
internal void fixup()
|
|
{
|
|
if ((this.attrs & (MethodAttributes.Abstract | MethodAttributes.PinvokeImpl)) == MethodAttributes.PrivateScope && (this.iattrs & (MethodImplAttributes)4099) == MethodImplAttributes.IL && (this.ilgen == null || ILGenerator.Mono_GetCurrentOffset(this.ilgen) == 0))
|
|
{
|
|
throw new InvalidOperationException("Method '" + this.Name + "' does not have a method body.");
|
|
}
|
|
if (this.ilgen != null)
|
|
{
|
|
this.ilgen.label_fixup();
|
|
}
|
|
}
|
|
|
|
// Token: 0x06001902 RID: 6402 RVA: 0x000602F0 File Offset: 0x0005E4F0
|
|
internal void GenerateDebugInfo(ISymbolWriter symbolWriter)
|
|
{
|
|
if (this.ilgen != null && this.ilgen.HasDebugInfo)
|
|
{
|
|
SymbolToken symbolToken = new SymbolToken(this.GetToken().Token);
|
|
symbolWriter.OpenMethod(symbolToken);
|
|
symbolWriter.SetSymAttribute(symbolToken, "__name", Encoding.UTF8.GetBytes(this.Name));
|
|
this.ilgen.GenerateDebugInfo(symbolWriter);
|
|
symbolWriter.CloseMethod();
|
|
}
|
|
}
|
|
|
|
// Token: 0x06001903 RID: 6403 RVA: 0x00060364 File Offset: 0x0005E564
|
|
internal override int get_next_table_index(object obj, int table, bool inc)
|
|
{
|
|
return this.type.get_next_table_index(obj, table, inc);
|
|
}
|
|
|
|
// Token: 0x1700045F RID: 1119
|
|
// (get) Token: 0x06001904 RID: 6404 RVA: 0x00060374 File Offset: 0x0005E574
|
|
private bool IsCompilerContext
|
|
{
|
|
get
|
|
{
|
|
ModuleBuilder moduleBuilder = (ModuleBuilder)this.TypeBuilder.Module;
|
|
AssemblyBuilder assemblyBuilder = (AssemblyBuilder)moduleBuilder.Assembly;
|
|
return assemblyBuilder.IsCompilerContext;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06001905 RID: 6405 RVA: 0x000603A4 File Offset: 0x0005E5A4
|
|
private void RejectIfCreated()
|
|
{
|
|
if (this.type.is_created)
|
|
{
|
|
throw new InvalidOperationException("Type definition of the method is complete.");
|
|
}
|
|
}
|
|
|
|
// Token: 0x06001906 RID: 6406 RVA: 0x000603C4 File Offset: 0x0005E5C4
|
|
private Exception not_supported()
|
|
{
|
|
return new NotSupportedException("The invoked member is not supported in a dynamic module.");
|
|
}
|
|
|
|
// Token: 0x06001907 RID: 6407 RVA: 0x000603D0 File Offset: 0x0005E5D0
|
|
private Exception not_after_created()
|
|
{
|
|
return new InvalidOperationException("Unable to change after type has been created.");
|
|
}
|
|
|
|
// Token: 0x06001908 RID: 6408 RVA: 0x000603DC File Offset: 0x0005E5DC
|
|
private Exception not_created()
|
|
{
|
|
return new NotSupportedException("The type is not yet created.");
|
|
}
|
|
|
|
// Token: 0x04000771 RID: 1905
|
|
private RuntimeMethodHandle mhandle;
|
|
|
|
// Token: 0x04000772 RID: 1906
|
|
private ILGenerator ilgen;
|
|
|
|
// Token: 0x04000773 RID: 1907
|
|
internal Type[] parameters;
|
|
|
|
// Token: 0x04000774 RID: 1908
|
|
private MethodAttributes attrs;
|
|
|
|
// Token: 0x04000775 RID: 1909
|
|
private MethodImplAttributes iattrs;
|
|
|
|
// Token: 0x04000776 RID: 1910
|
|
private int table_idx;
|
|
|
|
// Token: 0x04000777 RID: 1911
|
|
private CallingConventions call_conv;
|
|
|
|
// Token: 0x04000778 RID: 1912
|
|
private TypeBuilder type;
|
|
|
|
// Token: 0x04000779 RID: 1913
|
|
internal ParameterBuilder[] pinfo;
|
|
|
|
// Token: 0x0400077A RID: 1914
|
|
private CustomAttributeBuilder[] cattrs;
|
|
|
|
// Token: 0x0400077B RID: 1915
|
|
private bool init_locals = true;
|
|
|
|
// Token: 0x0400077C RID: 1916
|
|
private Type[][] paramModReq;
|
|
|
|
// Token: 0x0400077D RID: 1917
|
|
private Type[][] paramModOpt;
|
|
|
|
// Token: 0x0400077E RID: 1918
|
|
private RefEmitPermissionSet[] permissions;
|
|
}
|
|
}
|