public AddArgument ( System clsArgument ) : void | ||
clsArgument | System | |
Результат | void |
/// <summary>Sets the name and lexical scope of this local variable.</summary> /// <param name="name">The name of the local variable. </param> /// <param name="startOffset">The beginning offset of the lexical scope of the local variable. </param> /// <param name="endOffset">The ending offset of the lexical scope of the local variable. </param> /// <exception cref="T:System.InvalidOperationException">The containing type has been created with <see cref="M:System.Reflection.Emit.TypeBuilder.CreateType" />.-or- There is no symbolic writer defined for the containing module. </exception> /// <exception cref="T:System.NotSupportedException">This local is defined in a dynamic method, rather than in a method of a dynamic type.</exception> // Token: 0x060049F6 RID: 18934 RVA: 0x0010B4A8 File Offset: 0x001096A8 public void SetLocalSymInfo(string name, int startOffset, int endOffset) { MethodBuilder methodBuilder = this.m_methodBuilder as MethodBuilder; if (methodBuilder == null) { throw new NotSupportedException(); } ModuleBuilder moduleBuilder = (ModuleBuilder)methodBuilder.Module; if (methodBuilder.IsTypeCreated()) { throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_TypeHasBeenCreated")); } if (moduleBuilder.GetSymWriter() == null) { throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NotADebugModule")); } SignatureHelper fieldSigHelper = SignatureHelper.GetFieldSigHelper(moduleBuilder); fieldSigHelper.AddArgument(this.m_localType); int num; byte[] sourceArray = fieldSigHelper.InternalGetSignature(out num); byte[] array = new byte[num - 1]; Array.Copy(sourceArray, 1, array, 0, num - 1); int currentActiveScopeIndex = methodBuilder.GetILGenerator().m_ScopeTree.GetCurrentActiveScopeIndex(); if (currentActiveScopeIndex == -1) { methodBuilder.m_localSymInfo.AddLocalSymInfo(name, array, this.m_localIndex, startOffset, endOffset); return; } methodBuilder.GetILGenerator().m_ScopeTree.AddLocalSymInfoToCurrentScope(name, array, this.m_localIndex, startOffset, endOffset); }
public override void EmitCalli(OpCode opcode, CallingConvention unmanagedCallConv, Type returnType, Type[] parameterTypes) { int num1 = 0; int num2 = 0; if (parameterTypes != null) { num2 = parameterTypes.Length; } SignatureHelper methodSigHelper = SignatureHelper.GetMethodSigHelper(unmanagedCallConv, returnType); if (parameterTypes != null) { for (int index = 0; index < num2; ++index) { methodSigHelper.AddArgument(parameterTypes[index]); } } if (returnType != typeof(void)) { ++num1; } if (parameterTypes != null) { num1 -= num2; } int stackchange = num1 - 1; this.UpdateStackSize(OpCodes.Calli, stackchange); this.EnsureCapacity(7); this.Emit(OpCodes.Calli); this.PutInteger4(this.GetTokenForSig(methodSigHelper.GetSignature(true))); }
public override void EmitCalli(OpCode opcode, CallingConvention unmanagedCallConv, Type returnType, Type[] parameterTypes) { int stackchange = 0; int length = 0; if (parameterTypes != null) { length = parameterTypes.Length; } SignatureHelper methodSigHelper = SignatureHelper.GetMethodSigHelper(unmanagedCallConv, returnType); if (parameterTypes != null) { for (int i = 0; i < length; i++) { methodSigHelper.AddArgument(parameterTypes[i]); } } if (returnType != typeof(void)) { stackchange++; } if (parameterTypes != null) { stackchange -= length; } stackchange--; base.UpdateStackSize(OpCodes.Calli, stackchange); base.EnsureCapacity(7); this.Emit(OpCodes.Calli); int num4 = this.AddSignature(methodSigHelper.GetSignature(true)); base.PutInteger4(num4); }
internal void GenerateDebugInfo(ISymbolWriter symbolWriter) { if (sequencePointLists != null) { SequencePointList first = (SequencePointList)sequencePointLists [0]; SequencePointList last = (SequencePointList)sequencePointLists [sequencePointLists.Count - 1]; symbolWriter.SetMethodSourceRange(first.Document, first.StartLine, first.StartColumn, last.Document, last.EndLine, last.EndColumn); foreach (SequencePointList list in sequencePointLists) { symbolWriter.DefineSequencePoints(list.Document, list.GetOffsets(), list.GetLines(), list.GetColumns(), list.GetEndLines(), list.GetEndColumns()); } if (locals != null) { foreach (LocalBuilder local in locals) { if (local.Name != null && local.Name.Length > 0) { SignatureHelper sighelper = SignatureHelper.GetLocalVarSigHelper(module as ModuleBuilder); sighelper.AddArgument(local.LocalType); byte[] signature = sighelper.GetSignature(); symbolWriter.DefineLocalVariable(local.Name, FieldAttributes.Public, signature, SymAddressKind.ILOffset, local.position, 0, 0, local.StartOffset, local.EndOffset); } } } sequencePointLists = null; } }
// Token: 0x060048C1 RID: 18625 RVA: 0x00106A1C File Offset: 0x00104C1C public override void EmitCalli(OpCode opcode, CallingConvention unmanagedCallConv, Type returnType, Type[] parameterTypes) { int num = 0; int num2 = 0; if (parameterTypes != null) { num2 = parameterTypes.Length; } SignatureHelper methodSigHelper = SignatureHelper.GetMethodSigHelper(unmanagedCallConv, returnType); if (parameterTypes != null) { for (int i = 0; i < num2; i++) { methodSigHelper.AddArgument(parameterTypes[i]); } } if (returnType != typeof(void)) { num++; } if (parameterTypes != null) { num -= num2; } num--; base.UpdateStackSize(OpCodes.Calli, num); base.EnsureCapacity(7); this.Emit(OpCodes.Calli); int tokenForSig = this.GetTokenForSig(methodSigHelper.GetSignature(true)); base.PutInteger4(tokenForSig); }
public virtual void EmitCalli(OpCode opcode, CallingConvention unmanagedCallConv, Type returnType, Type[] parameterTypes) { int stackchange = 0; int length = 0; ModuleBuilder module = (ModuleBuilder)this.m_methodBuilder.Module; if (parameterTypes != null) { length = parameterTypes.Length; } SignatureHelper sigHelper = SignatureHelper.GetMethodSigHelper(module, unmanagedCallConv, returnType); if (parameterTypes != null) { for (int i = 0; i < length; i++) { sigHelper.AddArgument(parameterTypes[i]); } } if (returnType != typeof(void)) { stackchange++; } if (parameterTypes != null) { stackchange -= length; } stackchange--; this.UpdateStackSize(OpCodes.Calli, stackchange); this.EnsureCapacity(7); this.Emit(OpCodes.Calli); this.RecordTokenFixup(); this.PutInteger4(module.GetSignatureToken(sigHelper).Token); }
// Create a signature helper for a property signature. public static SignatureHelper GetPropertySigHelper (Module mod, Type returnType, Type[] parameterTypes) { lock (typeof(AssemblyBuilder)) { // Convert the module into a signature create context. IntPtr context = ModuleToContext(mod); // Create the basic signature helper. IntPtr sig = ClrSigCreateProperty (context, CSToILType(mod, context, returnType)); SignatureHelper helper = new SignatureHelper (mod, context, sig); // Add the parameters to the helper. if (parameterTypes != null) { foreach (Type type in parameterTypes) { helper.AddArgument(type); } } return(helper); } }
internal FieldBuilder(TypeBuilder typeBuilder, string fieldName, Type type, Type[]?requiredCustomModifiers, Type[]?optionalCustomModifiers, FieldAttributes attributes) { ArgumentException.ThrowIfNullOrEmpty(fieldName); if (fieldName[0] == '\0') { throw new ArgumentException(SR.Argument_IllegalName, nameof(fieldName)); } ArgumentNullException.ThrowIfNull(type); if (type == typeof(void)) { throw new ArgumentException(SR.Argument_BadFieldType); } m_fieldName = fieldName; m_typeBuilder = typeBuilder; m_fieldType = type; m_Attributes = attributes & ~FieldAttributes.ReservedMask; SignatureHelper sigHelp = SignatureHelper.GetFieldSigHelper(m_typeBuilder.Module); sigHelp.AddArgument(type, requiredCustomModifiers, optionalCustomModifiers); byte[] signature = sigHelp.InternalGetSignature(out int sigLength); ModuleBuilder module = m_typeBuilder.GetModuleBuilder(); m_fieldTok = TypeBuilder.DefineField(new QCallModule(ref module), typeBuilder.TypeToken, fieldName, signature, sigLength, m_Attributes); }
private static IUnknownReleaseDelegate Create_IUnknownRelease() { DynamicMethod dm = new DynamicMethod("IUnknownRelease", typeof(int), new Type[] { typeof(IntPtr) }, DynamicModule); ILGenerator method = dm.GetILGenerator(); // return functionPtr(...) method.Emit(OpCodes.Ldarg_0); // functionPtr = *(IntPtr*)(*(interfacePointer) + VTABLE_OFFSET) int iunknownReleaseOffset = ((int)IDispatchMethodIndices.IUnknown_Release) * Marshal.SizeOf(typeof(IntPtr)); method.Emit(OpCodes.Ldarg_0); method.Emit(OpCodes.Ldind_I); method.Emit(OpCodes.Ldc_I4, iunknownReleaseOffset); method.Emit(OpCodes.Add); method.Emit(OpCodes.Ldind_I); System.Reflection.Emit.SignatureHelper signature = System.Reflection.Emit.SignatureHelper.GetMethodSigHelper(CallingConvention.Winapi, typeof(int)); signature.AddArgument(typeof(IntPtr)); method.Emit(OpCodes.Calli, signature); method.Emit(OpCodes.Ret); return((IUnknownReleaseDelegate)dm.CreateDelegate(typeof(IUnknownReleaseDelegate))); }
internal FieldBuilder(TypeBuilder typeBuilder, string fieldName, Type type, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers, FieldAttributes attributes) { if (fieldName == null) { throw new ArgumentNullException("fieldName"); } if (fieldName.Length == 0) { throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "fieldName"); } if (fieldName[0] == '\0') { throw new ArgumentException(Environment.GetResourceString("Argument_IllegalName"), "fieldName"); } if (type == null) { throw new ArgumentNullException("type"); } if (type == typeof(void)) { throw new ArgumentException(Environment.GetResourceString("Argument_BadFieldType")); } this.m_fieldName = fieldName; this.m_typeBuilder = typeBuilder; this.m_fieldType = type; this.m_Attributes = (attributes & ~FieldAttributes.ReservedMask); SignatureHelper fieldSigHelper = SignatureHelper.GetFieldSigHelper(this.m_typeBuilder.Module); fieldSigHelper.AddArgument(type, requiredCustomModifiers, optionalCustomModifiers); int sigLength; byte[] signature = fieldSigHelper.InternalGetSignature(out sigLength); this.m_fieldTok = TypeBuilder.DefineField(this.m_typeBuilder.GetModuleBuilder().GetNativeHandle(), typeBuilder.TypeToken.Token, fieldName, signature, sigLength, this.m_Attributes); this.m_tkField = new FieldToken(this.m_fieldTok, type); }
internal static SignatureHelper GetMethodSpecSigHelper(Module scope, Type[] inst) { SignatureHelper sigHelp = new SignatureHelper(scope, MdSigCallingConvention.GenericInst); sigHelp.AddData(inst.Length); foreach(Type t in inst) sigHelp.AddArgument(t); return sigHelp; }
internal override SignatureHelper GetMemberRefSignature(CallingConventions call, Type returnType, Type[] parameterTypes, Type[] optionalParameterTypes) { int num = parameterTypes != null ? parameterTypes.Length : 0; SignatureHelper methodSigHelper = SignatureHelper.GetMethodSigHelper(call, returnType); for (int index = 0; index < num; ++index) { methodSigHelper.AddArgument(parameterTypes[index]); } if (optionalParameterTypes != null && optionalParameterTypes.Length != 0) { methodSigHelper.AddSentinel(); for (int index = 0; index < optionalParameterTypes.Length; ++index) { methodSigHelper.AddArgument(optionalParameterTypes[index]); } } return(methodSigHelper); }
internal static SignatureHelper GetMethodSpecSigHelper(Module scope, Type[] inst) { SignatureHelper sigHelp = new SignatureHelper(scope, MdSigCallingConvention.GenericInst); sigHelp.AddData(inst.Length); foreach (Type t in inst) { sigHelp.AddArgument(t); } return(sigHelp); }
internal static SignatureHelper GetMethodSpecSigHelper(Module scope, Type[] inst) { SignatureHelper sigHelp = new SignatureHelper(scope, IMAGE_CEE_CS_CALLCONV_GENERICINST); sigHelp.AddData(inst.Length); foreach (Type t in inst) { sigHelp.AddArgument(t); } return(sigHelp); }
internal static SignatureHelper GetMethodSpecSigHelper(Module scope, Type[] inst) { SignatureHelper helper = new SignatureHelper(scope, System.Reflection.MdSigCallingConvention.Default | System.Reflection.MdSigCallingConvention.GenericInst); helper.AddData(inst.Length); foreach (Type type in inst) { helper.AddArgument(type); } return(helper); }
internal FieldBuilder(TypeBuilder typeBuilder, String fieldName, Type type, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers, FieldAttributes attributes) { if (fieldName == null) { throw new ArgumentNullException(nameof(fieldName)); } if (fieldName.Length == 0) { throw new ArgumentException(SR.Argument_EmptyName, nameof(fieldName)); } if (fieldName[0] == '\0') { throw new ArgumentException(SR.Argument_IllegalName, nameof(fieldName)); } if (type == null) { throw new ArgumentNullException(nameof(type)); } if (type == typeof(void)) { throw new ArgumentException(SR.Argument_BadFieldType); } Contract.EndContractBlock(); m_fieldName = fieldName; m_typeBuilder = typeBuilder; m_fieldType = type; m_Attributes = attributes & ~FieldAttributes.ReservedMask; SignatureHelper sigHelp = SignatureHelper.GetFieldSigHelper(m_typeBuilder.Module); sigHelp.AddArgument(type, requiredCustomModifiers, optionalCustomModifiers); int sigLength; byte[] signature = sigHelp.InternalGetSignature(out sigLength); m_fieldTok = TypeBuilder.DefineField(m_typeBuilder.GetModuleBuilder().GetNativeHandle(), typeBuilder.TypeToken.Token, fieldName, signature, sigLength, m_Attributes); m_tkField = new FieldToken(m_fieldTok, type); }
/// <summary>设置该局部变量的名称和词法范围。</summary> /// <param name="name">局部变量的名称。</param> /// <param name="startOffset">局部变量词法范围的开始偏移量。</param> /// <param name="endOffset">局部变量词法范围的结束偏移量。</param> /// <exception cref="T:System.InvalidOperationException">已经用 <see cref="M:System.Reflection.Emit.TypeBuilder.CreateType" /> 创建了该包含类型。- 或 -没有为包含模块定义的符号编写器。</exception> /// <exception cref="T:System.NotSupportedException">此局部变量是使用动态方法(而不是动态类型的方法)来定义的。</exception> public void SetLocalSymInfo(string name, int startOffset, int endOffset) { MethodBuilder methodBuilder = this.m_methodBuilder as MethodBuilder; if ((MethodInfo)methodBuilder == (MethodInfo)null) { throw new NotSupportedException(); } ModuleBuilder moduleBuilder = (ModuleBuilder)methodBuilder.Module; if (methodBuilder.IsTypeCreated()) { throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_TypeHasBeenCreated")); } if (moduleBuilder.GetSymWriter() == null) { throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NotADebugModule")); } SignatureHelper fieldSigHelper = SignatureHelper.GetFieldSigHelper((Module)moduleBuilder); Type clsArgument = this.m_localType; fieldSigHelper.AddArgument(clsArgument); int num; // ISSUE: explicit reference operation // ISSUE: variable of a reference type int& length1 = @num; byte[] signature1 = fieldSigHelper.InternalGetSignature(length1); byte[] signature2 = new byte[num - 1]; int sourceIndex = 1; byte[] numArray = signature2; int destinationIndex = 0; int length2 = num - 1; Array.Copy((Array)signature1, sourceIndex, (Array)numArray, destinationIndex, length2); if (methodBuilder.GetILGenerator().m_ScopeTree.GetCurrentActiveScopeIndex() == -1) { methodBuilder.m_localSymInfo.AddLocalSymInfo(name, signature2, this.m_localIndex, startOffset, endOffset); } else { methodBuilder.GetILGenerator().m_ScopeTree.AddLocalSymInfoToCurrentScope(name, signature2, this.m_localIndex, startOffset, endOffset); } }
internal FieldBuilder(TypeBuilder typeBuilder, String fieldName, Type type, FieldAttributes attributes) { if (fieldName == null) { throw new ArgumentNullException("fieldName"); } if (fieldName.Length == 0) { throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "fieldName"); } if (fieldName[0] == '\0') { throw new ArgumentException(Environment.GetResourceString("Argument_IllegalName"), "fieldName"); } if (type == null) { throw new ArgumentNullException("type"); } if (type == SystemVoid) { throw new ArgumentException(Environment.GetResourceString("Argument_BadFieldType")); } m_fieldName = fieldName; m_typeBuilder = typeBuilder; m_fieldType = type; m_Attributes = attributes; SignatureHelper sigHelp = SignatureHelper.GetFieldSigHelper(m_typeBuilder.Module); sigHelp.AddArgument(type); int sigLength; byte[] signature = sigHelp.InternalGetSignature(out sigLength); m_tkField = new FieldToken(TypeBuilder.InternalDefineField( typeBuilder.TypeToken, fieldName, signature, sigLength, attributes, m_typeBuilder.Module), type); }
// Create a signature helper for a method signature. internal static SignatureHelper GetMethodSigHelper (Module mod, CallingConventions callConv, CallingConvention unmanagedCallConv, Type returnType, Type[] parameterTypes) { lock (typeof(AssemblyBuilder)) { // Convert the module into a signature create context. IntPtr context = ModuleToContext(mod); // Determine the calling convention flags to use. int conv = 0; /* default */ if ((callConv & CallingConventions.VarArgs) != 0) { conv = 0x05; /* vararg */ } if ((callConv & CallingConventions.HasThis) != 0) { conv |= 0x20; /* hasthis */ } if ((callConv & CallingConventions.ExplicitThis) != 0) { conv |= 0x40; /* explicitthis */ } // Create the basic signature helper. IntPtr sig = ClrSigCreateMethod (context, conv, CSToILType(mod, context, returnType)); SignatureHelper helper = new SignatureHelper (mod, context, sig, unmanagedCallConv); // Add the parameters to the helper. if (parameterTypes != null) { foreach (Type type in parameterTypes) { helper.AddArgument(type); } } return(helper); } }
/// <include file='doc\SignatureHelper.uex' path='docs/doc[@for="SignatureHelper.GetPropertySigHelper"]/*' /> public static SignatureHelper GetPropertySigHelper(Module mod, Type returnType, Type[] parameterTypes) { SignatureHelper sigHelp; if (returnType == null) { returnType = typeof(void); } sigHelp = new SignatureHelper(mod, IMAGE_CEE_CS_CALLCONV_PROPERTY, (Type)returnType); if (parameterTypes != null) { for (int i = 0; i < parameterTypes.Length; i++) { sigHelp.AddArgument(parameterTypes[i]); } } return(sigHelp); }
internal FieldBuilder(TypeBuilder typeBuilder, string fieldName, Type type, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers, FieldAttributes attributes) { if (fieldName == null) { throw new ArgumentNullException("fieldName"); } if (fieldName.Length == 0) { throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "fieldName"); } if ((int)fieldName[0] == 0) { throw new ArgumentException(Environment.GetResourceString("Argument_IllegalName"), "fieldName"); } if (type == (Type)null) { throw new ArgumentNullException("type"); } if (type == typeof(void)) { throw new ArgumentException(Environment.GetResourceString("Argument_BadFieldType")); } this.m_fieldName = fieldName; this.m_typeBuilder = typeBuilder; this.m_fieldType = type; this.m_Attributes = attributes & ~FieldAttributes.ReservedMask; SignatureHelper fieldSigHelper = SignatureHelper.GetFieldSigHelper(this.m_typeBuilder.Module); Type type1 = type; Type[] requiredCustomModifiers1 = requiredCustomModifiers; Type[] optionalCustomModifiers1 = optionalCustomModifiers; fieldSigHelper.AddArgument(type1, requiredCustomModifiers1, optionalCustomModifiers1); int sigLength; // ISSUE: explicit reference operation // ISSUE: variable of a reference type int& length = @sigLength; byte[] signature = fieldSigHelper.InternalGetSignature(length); this.m_fieldTok = TypeBuilder.DefineField(this.m_typeBuilder.GetModuleBuilder().GetNativeHandle(), typeBuilder.TypeToken.Token, fieldName, signature, sigLength, this.m_Attributes); this.m_tkField = new FieldToken(this.m_fieldTok, type); }
internal static SignatureHelper GetMethodSigHelper( Module mod, CallingConventions callingConvention, Type returnType, Type[] parameterTypes) { SignatureHelper sigHelp; int intCall; if (returnType == null) { returnType = typeof(void); } intCall = IMAGE_CEE_CS_CALLCONV_DEFAULT; if ((callingConvention & CallingConventions.VarArgs) == CallingConventions.VarArgs) { intCall = IMAGE_CEE_CS_CALLCONV_VARARG; } if ((callingConvention & CallingConventions.HasThis) == CallingConventions.HasThis) { intCall |= IMAGE_CEE_CS_CALLCONV_HASTHIS; } sigHelp = new SignatureHelper(mod, intCall, (Type)returnType); if (parameterTypes != null) { for (int i = 0; i < parameterTypes.Length; i++) { sigHelp.AddArgument(parameterTypes[i]); } } return(sigHelp); }
internal static SignatureHelper GetMethodSpecSigHelper(Module scope, Type[] inst) { SignatureHelper sigHelp = new SignatureHelper(scope, IMAGE_CEE_CS_CALLCONV_GENERICINST); sigHelp.AddData(inst.Length); foreach(Type t in inst) sigHelp.AddArgument(t); return sigHelp; }
/// <include file='doc\SignatureHelper.uex' path='docs/doc[@for="SignatureHelper.GetPropertySigHelper"]/*' /> public static SignatureHelper GetPropertySigHelper(Module mod, Type returnType, Type[] parameterTypes) { SignatureHelper sigHelp; if (returnType == null) { returnType = typeof(void); } sigHelp = new SignatureHelper(mod, IMAGE_CEE_CS_CALLCONV_PROPERTY, (Type)returnType); if (parameterTypes != null) { for (int i=0; i<parameterTypes.Length; i++) { sigHelp.AddArgument(parameterTypes[i]); } } return sigHelp; }
internal static SignatureHelper GetMethodSigHelper( Module mod, CallingConventions callingConvention, Type returnType, Type[] parameterTypes) { SignatureHelper sigHelp; int intCall; if (returnType == null) { returnType = typeof(void); } intCall = IMAGE_CEE_CS_CALLCONV_DEFAULT; if ((callingConvention & CallingConventions.VarArgs) == CallingConventions.VarArgs) { intCall = IMAGE_CEE_CS_CALLCONV_VARARG; } if ((callingConvention & CallingConventions.HasThis) == CallingConventions.HasThis) { intCall |= IMAGE_CEE_CS_CALLCONV_HASTHIS; } sigHelp = new SignatureHelper(mod, intCall, (Type)returnType); if (parameterTypes != null) { for (int i=0; i<parameterTypes.Length; i++) { sigHelp.AddArgument(parameterTypes[i]); } } return sigHelp; }
// Create a signature helper for a method signature. internal static SignatureHelper GetMethodSigHelper (Module mod, CallingConventions callConv, CallingConvention unmanagedCallConv, Type returnType, Type[] parameterTypes) { lock(typeof(AssemblyBuilder)) { // Convert the module into a signature create context. IntPtr context = ModuleToContext(mod); // Determine the calling convention flags to use. int conv = 0; /* default */ if((callConv & CallingConventions.VarArgs) != 0) { conv = 0x05; /* vararg */ } if((callConv & CallingConventions.HasThis) != 0) { conv |= 0x20; /* hasthis */ } if((callConv & CallingConventions.ExplicitThis) != 0) { conv |= 0x40; /* explicitthis */ } // Create the basic signature helper. IntPtr sig = ClrSigCreateMethod (context, conv, CSToILType(mod, context, returnType)); SignatureHelper helper = new SignatureHelper (mod, context, sig, unmanagedCallConv); // Add the parameters to the helper. if(parameterTypes != null) { foreach(Type type in parameterTypes) { helper.AddArgument(type); } } return helper; } }
// Create a signature helper for a property signature. public static SignatureHelper GetPropertySigHelper (Module mod, Type returnType, Type[] parameterTypes) { lock(typeof(AssemblyBuilder)) { // Convert the module into a signature create context. IntPtr context = ModuleToContext(mod); // Create the basic signature helper. IntPtr sig = ClrSigCreateProperty (context, CSToILType(mod, context, returnType)); SignatureHelper helper = new SignatureHelper (mod, context, sig); // Add the parameters to the helper. if(parameterTypes != null) { foreach(Type type in parameterTypes) { helper.AddArgument(type); } } return helper; } }
internal static SignatureHelper GetMethodSpecSigHelper(Module scope, Type[] inst) { SignatureHelper helper = new SignatureHelper(scope, System.Reflection.MdSigCallingConvention.Default | System.Reflection.MdSigCallingConvention.GenericInst); helper.AddData(inst.Length); foreach (Type type in inst) { helper.AddArgument(type); } return helper; }