internal void EnsureCapacity() { if (this.m_iCount == 0) { this.m_iOffsets = new int[16]; this.m_ScopeActions = new ScopeAction[16]; this.m_localSymInfos = new LocalSymInfo[16]; } else { if (this.m_iCount != this.m_iOffsets.Length) { return; } int length = checked (this.m_iCount * 2); int[] numArray = new int[length]; Array.Copy((Array)this.m_iOffsets, (Array)numArray, this.m_iCount); this.m_iOffsets = numArray; ScopeAction[] scopeActionArray = new ScopeAction[length]; Array.Copy((Array)this.m_ScopeActions, (Array)scopeActionArray, this.m_iCount); this.m_ScopeActions = scopeActionArray; LocalSymInfo[] localSymInfoArray = new LocalSymInfo[length]; Array.Copy((Array)this.m_localSymInfos, (Array)localSymInfoArray, this.m_iCount); this.m_localSymInfos = localSymInfoArray; } }
internal void ReleaseBakedStructures() { if (this.m_bIsBaked) { this.m_ubBody = null; this.m_localSymInfo = null; this.m_RVAFixups = null; this.m_mdMethodFixups = null; this.m_exceptions = null; } }
// This is only called from TypeBuilder.CreateType after the method has been created internal void ReleaseBakedStructures() { if (!m_bIsBaked) { // We don't need to do anything here if we didn't baked the method body return; } m_ubBody = null; m_localSymInfo = null; m_mdMethodFixups = null; m_localSignature = null; m_exceptions = null; }
internal void EnsureCapacity() { if (this.m_iCount == 0) { this.m_iOffsets = new int[0x10]; this.m_ScopeActions = new ScopeAction[0x10]; this.m_localSymInfos = new LocalSymInfo[0x10]; } else if (this.m_iCount == this.m_iOffsets.Length) { int num = this.m_iCount * 2; int[] destinationArray = new int[num]; Array.Copy(this.m_iOffsets, destinationArray, this.m_iCount); this.m_iOffsets = destinationArray; ScopeAction[] actionArray = new ScopeAction[num]; Array.Copy(this.m_ScopeActions, actionArray, this.m_iCount); this.m_ScopeActions = actionArray; LocalSymInfo[] infoArray = new LocalSymInfo[num]; Array.Copy(this.m_localSymInfos, infoArray, this.m_iCount); this.m_localSymInfos = infoArray; } }
// Token: 0x060049DB RID: 18907 RVA: 0x0010AF08 File Offset: 0x00109108 internal void EnsureCapacity() { if (this.m_iCount == 0) { this.m_iOffsets = new int[16]; this.m_ScopeActions = new ScopeAction[16]; this.m_localSymInfos = new LocalSymInfo[16]; return; } if (this.m_iCount == this.m_iOffsets.Length) { int num = checked (this.m_iCount * 2); int[] array = new int[num]; Array.Copy(this.m_iOffsets, array, this.m_iCount); this.m_iOffsets = array; ScopeAction[] array2 = new ScopeAction[num]; Array.Copy(this.m_ScopeActions, array2, this.m_iCount); this.m_ScopeActions = array2; LocalSymInfo[] array3 = new LocalSymInfo[num]; Array.Copy(this.m_localSymInfos, array3, this.m_iCount); this.m_localSymInfos = array3; } }
internal void AddLocalSymInfoToCurrentScope( String strName, byte[] signature, int slot, int startOffset, int endOffset) { int i = GetCurrentActiveScopeIndex(); if (m_localSymInfos[i] == null) { m_localSymInfos[i] = new LocalSymInfo(); } m_localSymInfos[i].AddLocalSymInfo(strName, signature, slot, startOffset, endOffset); }
private void Init( String name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, Module mod, TypeBuilder type, bool bIsGlobalMethod) { m_strName = name; m_localSignature = SignatureHelper.GetLocalVarSigHelper(mod); m_module = mod; m_containingType = type; if (returnType == null) { m_returnType = typeof(void); } else { m_returnType = returnType; } if ((attributes & MethodAttributes.Static) == 0) { // turn on the has this calling convention callingConvention = callingConvention | CallingConventions.HasThis; } else if ((attributes & MethodAttributes.Virtual) != 0) { //A method can't be both static and virtual throw new ArgumentException(Environment.GetResourceString("Arg_NoStaticVirtual")); } if ((attributes & MethodAttributes.SpecialName) != MethodAttributes.SpecialName) { if ((type.Attributes & TypeAttributes.Interface) == TypeAttributes.Interface) { // methods on interface have to be abstract + virtual except special name methods(such as type initializer if ((attributes & (MethodAttributes.Abstract | MethodAttributes.Virtual)) != (MethodAttributes.Abstract | MethodAttributes.Virtual)) { throw new ArgumentException(Environment.GetResourceString("Argument_BadAttributeOnInterfaceMethod")); } } } m_callingConvention = callingConvention; m_returnType = returnType; if (parameterTypes != null) { m_parameterTypes = new Type[parameterTypes.Length]; Array.Copy(parameterTypes, m_parameterTypes, parameterTypes.Length); } else { m_parameterTypes = null; } m_signature = SignatureHelper.GetMethodSigHelper(mod, callingConvention, returnType, parameterTypes); m_iAttributes = attributes; m_bIsGlobalMethod = bIsGlobalMethod; m_bIsBaked = false; m_fInitLocals = true; m_localSymInfo = new LocalSymInfo(); m_ubBody = null; m_ilGenerator = null; // default is managed IL // Manged IL has bit flag 0x0020 set off m_dwMethodImplFlags = MethodImplAttributes.IL; }
private void Init(String name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers, Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers, Module mod, TypeBuilder type, bool bIsGlobalMethod) { if (name == null) throw new ArgumentNullException("name"); if (name.Length == 0) throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "name"); if (name[0] == '\0') throw new ArgumentException(Environment.GetResourceString("Argument_IllegalName"), "name"); if (mod == null) throw new ArgumentNullException("mod"); if (parameterTypes != null) { foreach(Type t in parameterTypes) { if (t == null) throw new ArgumentNullException("parameterTypes"); } } m_link = type.m_currentMethod; type.m_currentMethod = this; m_strName = name; m_module = mod; m_containingType = type; m_localSignature = SignatureHelper.GetLocalVarSigHelper(mod); // //if (returnType == null) //{ // m_returnType = typeof(void); //} //else { m_returnType = returnType; } if ((attributes & MethodAttributes.Static) == 0) { // turn on the has this calling convention callingConvention = callingConvention | CallingConventions.HasThis; } else if ((attributes & MethodAttributes.Virtual) != 0) { // A method can't be both static and virtual throw new ArgumentException(Environment.GetResourceString("Arg_NoStaticVirtual")); } if ((attributes & MethodAttributes.SpecialName) != MethodAttributes.SpecialName) { if ((type.Attributes & TypeAttributes.Interface) == TypeAttributes.Interface) { // methods on interface have to be abstract + virtual except special name methods such as type initializer if ((attributes & (MethodAttributes.Abstract | MethodAttributes.Virtual)) != (MethodAttributes.Abstract | MethodAttributes.Virtual) && (attributes & MethodAttributes.Static) == 0) throw new ArgumentException(Environment.GetResourceString("Argument_BadAttributeOnInterfaceMethod")); } } m_callingConvention = callingConvention; if (parameterTypes != null) { m_parameterTypes = new Type[parameterTypes.Length]; Array.Copy(parameterTypes, m_parameterTypes, parameterTypes.Length); } else { m_parameterTypes = null; } m_returnTypeRequiredCustomModifiers = returnTypeRequiredCustomModifiers; m_returnTypeOptionalCustomModifiers = returnTypeOptionalCustomModifiers; m_parameterTypeRequiredCustomModifiers = parameterTypeRequiredCustomModifiers; m_parameterTypeOptionalCustomModifiers = parameterTypeOptionalCustomModifiers; // m_signature = SignatureHelper.GetMethodSigHelper(mod, callingConvention, // returnType, returnTypeRequiredCustomModifiers, returnTypeOptionalCustomModifiers, // parameterTypes, parameterTypeRequiredCustomModifiers, parameterTypeOptionalCustomModifiers); m_iAttributes = attributes; m_bIsGlobalMethod = bIsGlobalMethod; m_bIsBaked = false; m_fInitLocals = true; m_localSymInfo = new LocalSymInfo(); m_ubBody = null; m_ilGenerator = null; // Default is managed IL. Manged IL has bit flag 0x0020 set off m_dwMethodImplFlags = MethodImplAttributes.IL; //int i = MetadataTokenInternal; }
private void Init(String name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers, Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers, ModuleBuilder mod, TypeBuilder type, bool bIsGlobalMethod) { if (name == null) { throw new ArgumentNullException(nameof(name)); } if (name.Length == 0) { throw new ArgumentException(SR.Argument_EmptyName, nameof(name)); } if (name[0] == '\0') { throw new ArgumentException(SR.Argument_IllegalName, nameof(name)); } if (mod == null) { throw new ArgumentNullException(nameof(mod)); } if (parameterTypes != null) { foreach (Type t in parameterTypes) { if (t == null) { throw new ArgumentNullException(nameof(parameterTypes)); } } } m_strName = name; m_module = mod; m_containingType = type; // //if (returnType == null) //{ // m_returnType = typeof(void); //} //else { m_returnType = returnType; } if ((attributes & MethodAttributes.Static) == 0) { // turn on the has this calling convention callingConvention = callingConvention | CallingConventions.HasThis; } else if ((attributes & MethodAttributes.Virtual) != 0) { // A method can't be both static and virtual throw new ArgumentException(SR.Arg_NoStaticVirtual); } if ((attributes & MethodAttributes.SpecialName) != MethodAttributes.SpecialName) { if ((type.Attributes & TypeAttributes.Interface) == TypeAttributes.Interface) { // methods on interface have to be abstract + virtual except special name methods such as type initializer if ((attributes & (MethodAttributes.Abstract | MethodAttributes.Virtual)) != (MethodAttributes.Abstract | MethodAttributes.Virtual) && (attributes & MethodAttributes.Static) == 0) { throw new ArgumentException(SR.Argument_BadAttributeOnInterfaceMethod); } } } m_callingConvention = callingConvention; if (parameterTypes != null) { m_parameterTypes = new Type[parameterTypes.Length]; Array.Copy(parameterTypes, 0, m_parameterTypes, 0, parameterTypes.Length); } else { m_parameterTypes = null; } m_returnTypeRequiredCustomModifiers = returnTypeRequiredCustomModifiers; m_returnTypeOptionalCustomModifiers = returnTypeOptionalCustomModifiers; m_parameterTypeRequiredCustomModifiers = parameterTypeRequiredCustomModifiers; m_parameterTypeOptionalCustomModifiers = parameterTypeOptionalCustomModifiers; // m_signature = SignatureHelper.GetMethodSigHelper(mod, callingConvention, // returnType, returnTypeRequiredCustomModifiers, returnTypeOptionalCustomModifiers, // parameterTypes, parameterTypeRequiredCustomModifiers, parameterTypeOptionalCustomModifiers); m_iAttributes = attributes; m_bIsGlobalMethod = bIsGlobalMethod; m_bIsBaked = false; m_fInitLocals = true; m_localSymInfo = new LocalSymInfo(); m_ubBody = null; m_ilGenerator = null; // Default is managed IL. Manged IL has bit flag 0x0020 set off m_dwMethodImplFlags = MethodImplAttributes.IL; }
/************************** * * Helper to ensure arrays are large enough * **************************/ internal void EnsureCapacity() { if (m_iCount == 0) { // First time. Allocate the arrays. m_iOffsets = new int[InitialSize]; m_ScopeActions = new ScopeAction[InitialSize]; m_localSymInfos = new LocalSymInfo[InitialSize]; } else if (m_iCount == m_iOffsets.Length) { // the arrays are full. Enlarge the arrays int[] temp = new int [m_iCount * 2]; Array.Copy(m_iOffsets, temp, m_iCount); m_iOffsets = temp; ScopeAction[] tempSA = new ScopeAction[m_iCount * 2]; Array.Copy(m_ScopeActions, tempSA, m_iCount); m_ScopeActions = tempSA; LocalSymInfo[] tempLSI = new LocalSymInfo[m_iCount * 2]; Array.Copy(m_localSymInfos, tempLSI, m_iCount); m_localSymInfos = tempLSI; } }
private void Init(string name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers, Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers, ModuleBuilder mod, TypeBuilder type, bool bIsGlobalMethod) { if (name == null) { throw new ArgumentNullException("name"); } if (name.Length == 0) { throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "name"); } if (name[0] == '\0') { throw new ArgumentException(Environment.GetResourceString("Argument_IllegalName"), "name"); } if (mod == null) { throw new ArgumentNullException("mod"); } if (parameterTypes != null) { foreach (Type type2 in parameterTypes) { if (type2 == null) { throw new ArgumentNullException("parameterTypes"); } } } this.m_strName = name; this.m_module = mod; this.m_containingType = type; this.m_localSignature = SignatureHelper.GetLocalVarSigHelper(mod); this.m_returnType = returnType; if ((attributes & MethodAttributes.Static) == MethodAttributes.PrivateScope) { callingConvention |= CallingConventions.HasThis; } else if ((attributes & MethodAttributes.Virtual) != MethodAttributes.PrivateScope) { throw new ArgumentException(Environment.GetResourceString("Arg_NoStaticVirtual")); } if ((((attributes & MethodAttributes.SpecialName) != MethodAttributes.SpecialName) && ((type.Attributes & TypeAttributes.ClassSemanticsMask) == TypeAttributes.ClassSemanticsMask)) && (((attributes & (MethodAttributes.Abstract | MethodAttributes.Virtual)) != (MethodAttributes.Abstract | MethodAttributes.Virtual)) && ((attributes & MethodAttributes.Static) == MethodAttributes.PrivateScope))) { throw new ArgumentException(Environment.GetResourceString("Argument_BadAttributeOnInterfaceMethod")); } this.m_callingConvention = callingConvention; if (parameterTypes != null) { this.m_parameterTypes = new Type[parameterTypes.Length]; Array.Copy(parameterTypes, this.m_parameterTypes, parameterTypes.Length); } else { this.m_parameterTypes = null; } this.m_returnTypeRequiredCustomModifiers = returnTypeRequiredCustomModifiers; this.m_returnTypeOptionalCustomModifiers = returnTypeOptionalCustomModifiers; this.m_parameterTypeRequiredCustomModifiers = parameterTypeRequiredCustomModifiers; this.m_parameterTypeOptionalCustomModifiers = parameterTypeOptionalCustomModifiers; this.m_iAttributes = attributes; this.m_bIsGlobalMethod = bIsGlobalMethod; this.m_bIsBaked = false; this.m_fInitLocals = true; this.m_localSymInfo = new LocalSymInfo(); this.m_ubBody = null; this.m_ilGenerator = null; this.m_dwMethodImplFlags = MethodImplAttributes.IL; }
internal void AddUsingNamespaceToCurrentScope( String strNamespace) { int i = GetCurrentActiveScopeIndex(); if (m_localSymInfos[i] == null) { m_localSymInfos[i] = new LocalSymInfo(); } m_localSymInfos[i].AddUsingNamespace(strNamespace); }
/************************** * * Helper to ensure arrays are large enough * **************************/ internal void EnsureCapacity() { if (m_iCount == 0) { // First time. Allocate the arrays. m_iOffsets = new int[InitialSize]; m_ScopeActions = new ScopeAction[InitialSize]; m_localSymInfos = new LocalSymInfo[InitialSize]; } else if (m_iCount == m_iOffsets.Length) { // the arrays are full. Enlarge the arrays // It would probably be simpler to just use Lists here. int newSize = checked(m_iCount * 2); int[] temp = new int[newSize]; Array.Copy(m_iOffsets, temp, m_iCount); m_iOffsets = temp; ScopeAction[] tempSA = new ScopeAction[newSize]; Array.Copy(m_ScopeActions, tempSA, m_iCount); m_ScopeActions = tempSA; LocalSymInfo[] tempLSI = new LocalSymInfo[newSize]; Array.Copy(m_localSymInfos, tempLSI, m_iCount); m_localSymInfos = tempLSI; } }
// This is only called from TypeBuilder.CreateType after the method has been created internal void ReleaseBakedStructures() { if (!m_bIsBaked) { // We don't need to do anything here if we didn't baked the method body return; } m_ubBody = null; m_localSymInfo = null; m_RVAFixups = null; m_mdMethodFixups = null; m_exceptions = null; }