diff options
Diffstat (limited to 'src/mscorlib/src/System/Reflection/Emit/AssemblyBuilderData.cs')
-rw-r--r-- | src/mscorlib/src/System/Reflection/Emit/AssemblyBuilderData.cs | 126 |
1 files changed, 62 insertions, 64 deletions
diff --git a/src/mscorlib/src/System/Reflection/Emit/AssemblyBuilderData.cs b/src/mscorlib/src/System/Reflection/Emit/AssemblyBuilderData.cs index 7ac9daeac0..529ba54514 100644 --- a/src/mscorlib/src/System/Reflection/Emit/AssemblyBuilderData.cs +++ b/src/mscorlib/src/System/Reflection/Emit/AssemblyBuilderData.cs @@ -6,7 +6,8 @@ //////////////////////////////////////////////////////////////////////////////// // -namespace System.Reflection.Emit { +namespace System.Reflection.Emit +{ using System; using IList = System.Collections.IList; using System.Collections.Generic; @@ -25,10 +26,10 @@ namespace System.Reflection.Emit { internal class AssemblyBuilderData { internal AssemblyBuilderData( - InternalAssemblyBuilder assembly, - String strAssemblyName, - AssemblyBuilderAccess access, - String dir) + InternalAssemblyBuilder assembly, + String strAssemblyName, + AssemblyBuilderAccess access, + String dir) { m_assembly = assembly; m_strAssemblyName = strAssemblyName; @@ -44,8 +45,8 @@ namespace System.Reflection.Emit { m_strDir = dir; m_peFileKind = PEFileKinds.Dll; - } - + } + // Helper to add a dynamic module into the tracking list internal void AddModule(ModuleBuilder dynModule) { @@ -56,7 +57,6 @@ namespace System.Reflection.Emit { // Helper to track CAs to persist onto disk internal void AddCustomAttribute(CustomAttributeBuilder customBuilder) { - // make sure we have room for this CA if (m_CABuilders == null) { @@ -64,31 +64,30 @@ namespace System.Reflection.Emit { } if (m_iCABuilder == m_CABuilders.Length) { - CustomAttributeBuilder[] tempCABuilders = new CustomAttributeBuilder[m_iCABuilder * 2]; + CustomAttributeBuilder[] tempCABuilders = new CustomAttributeBuilder[m_iCABuilder * 2]; Array.Copy(m_CABuilders, 0, tempCABuilders, 0, m_iCABuilder); - m_CABuilders = tempCABuilders; + m_CABuilders = tempCABuilders; } m_CABuilders[m_iCABuilder] = customBuilder; - + m_iCABuilder++; } // Helper to track CAs to persist onto disk internal void AddCustomAttribute(ConstructorInfo con, byte[] binaryAttribute) { - // make sure we have room for this CA if (m_CABytes == null) { m_CABytes = new byte[m_iInitialSize][]; - m_CACons = new ConstructorInfo[m_iInitialSize]; + m_CACons = new ConstructorInfo[m_iInitialSize]; } if (m_iCAs == m_CABytes.Length) { // enlarge the arrays - byte[][] temp = new byte[m_iCAs * 2][]; + byte[][] temp = new byte[m_iCAs * 2][]; ConstructorInfo[] tempCon = new ConstructorInfo[m_iCAs * 2]; - for (int i=0; i < m_iCAs; i++) + for (int i = 0; i < m_iCAs; i++) { temp[i] = m_CABytes[i]; tempCon[i] = m_CACons[i]; @@ -103,12 +102,12 @@ namespace System.Reflection.Emit { m_CACons[m_iCAs] = con; m_iCAs++; } - + // Helper to ensure the type name is unique underneath assemblyBuilder internal void CheckTypeNameConflict(String strTypeName, TypeBuilder enclosingType) { - BCLDebug.Log("DYNIL","## DYNIL LOGGING: AssemblyBuilderData.CheckTypeNameConflict( " + strTypeName + " )"); - for (int i = 0; i < m_moduleBuilderList.Count; i++) + BCLDebug.Log("DYNIL", "## DYNIL LOGGING: AssemblyBuilderData.CheckTypeNameConflict( " + strTypeName + " )"); + for (int i = 0; i < m_moduleBuilderList.Count; i++) { ModuleBuilder curModule = m_moduleBuilderList[i]; curModule.CheckTypeNameConflict(strTypeName, enclosingType); @@ -121,60 +120,59 @@ namespace System.Reflection.Emit { // if (enclosingType == null && m_assembly.GetType(strTypeName, false, false) != null) // { // // Cannot have two types with the same name - // throw new ArgumentException(Environment.GetResourceString("Argument_DuplicateTypeName")); + // throw new ArgumentException(SR.Argument_DuplicateTypeName); // } } - - internal List<ModuleBuilder> m_moduleBuilderList; - internal List<ResWriterData> m_resWriterList; - internal String m_strAssemblyName; - internal AssemblyBuilderAccess m_access; + + internal List<ModuleBuilder> m_moduleBuilderList; + internal List<ResWriterData> m_resWriterList; + internal String m_strAssemblyName; + internal AssemblyBuilderAccess m_access; private InternalAssemblyBuilder m_assembly; - - internal Type[] m_publicComTypeList; - internal int m_iPublicComTypeCount; - - internal bool m_isSaved; - internal const int m_iInitialSize = 16; - internal String m_strDir; + + internal Type[] m_publicComTypeList; + internal int m_iPublicComTypeCount; + + internal bool m_isSaved; + internal const int m_iInitialSize = 16; + internal String m_strDir; // hard coding the assembly def token - internal const int m_tkAssembly = 0x20000001; - + internal const int m_tkAssembly = 0x20000001; + // tracking AssemblyDef's CAs for persistence to disk internal CustomAttributeBuilder[] m_CABuilders; - internal int m_iCABuilder; - internal byte[][] m_CABytes; - internal ConstructorInfo[] m_CACons; - internal int m_iCAs; - internal PEFileKinds m_peFileKind; // assembly file kind - internal MethodInfo m_entryPointMethod; - internal Assembly m_ISymWrapperAssembly; + internal int m_iCABuilder; + internal byte[][] m_CABytes; + internal ConstructorInfo[] m_CACons; + internal int m_iCAs; + internal PEFileKinds m_peFileKind; // assembly file kind + internal MethodInfo m_entryPointMethod; + internal Assembly m_ISymWrapperAssembly; // For unmanaged resources - internal String m_strResourceFileName; - internal byte[] m_resourceBytes; - internal NativeVersionInfo m_nativeVersion; - internal bool m_hasUnmanagedVersionInfo; - internal bool m_OverrideUnmanagedVersionInfo; - + internal String m_strResourceFileName; + internal byte[] m_resourceBytes; + internal NativeVersionInfo m_nativeVersion; + internal bool m_hasUnmanagedVersionInfo; + internal bool m_OverrideUnmanagedVersionInfo; } - + /********************************************** * * Internal structure to track the list of ResourceWriter for * AssemblyBuilder & ModuleBuilder. * **********************************************/ - internal class ResWriterData + internal class ResWriterData { - internal String m_strName; - internal String m_strFileName; - internal String m_strFullFileName; - internal Stream m_memoryStream; - internal ResWriterData m_nextResWriter; - internal ResourceAttributes m_attribute; + internal String m_strName; + internal String m_strFileName; + internal String m_strFullFileName; + internal Stream m_memoryStream; + internal ResWriterData m_nextResWriter; + internal ResourceAttributes m_attribute; } internal class NativeVersionInfo @@ -191,15 +189,15 @@ namespace System.Reflection.Emit { m_strFileVersion = null; m_lcid = -1; } - - internal String m_strDescription; - internal String m_strCompany; - internal String m_strTitle; - internal String m_strCopyright; - internal String m_strTrademark; - internal String m_strProduct; - internal String m_strProductVersion; - internal String m_strFileVersion; - internal int m_lcid; + + internal String m_strDescription; + internal String m_strCompany; + internal String m_strTitle; + internal String m_strCopyright; + internal String m_strTrademark; + internal String m_strProduct; + internal String m_strProductVersion; + internal String m_strFileVersion; + internal int m_lcid; } } |