Author: jbevain
Date: 2005-10-28 13:01:04 -0400 (Fri, 28 Oct 2005)
New Revision: 52335

Modified:
   trunk/cecil/lib/ChangeLog
   trunk/cecil/lib/Mono.Cecil/ModuleDefinition.cs
   trunk/cecil/lib/Mono.Cecil/ReflectionReader.cs
   trunk/cecil/lib/Mono.Cecil/ReflectionWriter.cs
   trunk/cecil/lib/Mono.Cecil/TypeDefinition.cs
   trunk/cecil/lib/Mono.Cecil/TypeReference.cs
Log:
2005-10-28  Jb Evain  <[EMAIL PROTECTED]>

        * Mono.Cecil/TypeReference.cs
          Mono.Cecil/ReflectionReader.cs
          Mono.Cecil/TypeDefinition.cs
          Mono.Cecil/ModuleDefinition.cs
          Mono.Cecil/ReflectionWriter.cs:
                Uniformize the API.


Modified: trunk/cecil/lib/ChangeLog
===================================================================
--- trunk/cecil/lib/ChangeLog   2005-10-28 16:36:28 UTC (rev 52334)
+++ trunk/cecil/lib/ChangeLog   2005-10-28 17:01:04 UTC (rev 52335)
@@ -1,5 +1,12 @@
 2005-10-28  Jb Evain  <[EMAIL PROTECTED]>
 
+       * Mono.Cecil/TypeReference.cs
+         Mono.Cecil/ReflectionReader.cs
+         Mono.Cecil/TypeDefinition.cs
+         Mono.Cecil/ModuleDefinition.cs
+         Mono.Cecil/ReflectionWriter.cs:
+               Uniformize the API.
+
        * Mono.Cecil.Signatures/SignatureWriter.cs:
                Correct a bug in strings encoding in custom attributes.
 

Modified: trunk/cecil/lib/Mono.Cecil/ModuleDefinition.cs
===================================================================
--- trunk/cecil/lib/Mono.Cecil/ModuleDefinition.cs      2005-10-28 16:36:28 UTC 
(rev 52334)
+++ trunk/cecil/lib/Mono.Cecil/ModuleDefinition.cs      2005-10-28 17:01:04 UTC 
(rev 52335)
@@ -192,6 +192,7 @@
                                throw new ReflectionException ("Type is already 
attached, clone it instead");
 
                        ea.TypeDefinition.Module = this;
+                       ea.TypeDefinition.AttachToScope (this);
                }
 
                void OnTypeDefinitionRemoved (Object sender, 
TypeDefinitionEventArgs ea)

Modified: trunk/cecil/lib/Mono.Cecil/ReflectionReader.cs
===================================================================
--- trunk/cecil/lib/Mono.Cecil/ReflectionReader.cs      2005-10-28 16:36:28 UTC 
(rev 52334)
+++ trunk/cecil/lib/Mono.Cecil/ReflectionReader.cs      2005-10-28 17:01:04 UTC 
(rev 52335)
@@ -344,8 +344,7 @@
                                TypeDefinition t = new TypeDefinition (
                                        m_root.Streams.StringsHeap [type.Name],
                                        m_root.Streams.StringsHeap 
[type.Namespace],
-                                       type.Flags,
-                                       m_module);
+                                       type.Flags);
                                t.MetadataToken = MetadataToken.FromMetadataRow 
(TokenType.TypeDef, i);
 
                                m_typeDefs [i] = t;

Modified: trunk/cecil/lib/Mono.Cecil/ReflectionWriter.cs
===================================================================
--- trunk/cecil/lib/Mono.Cecil/ReflectionWriter.cs      2005-10-28 16:36:28 UTC 
(rev 52334)
+++ trunk/cecil/lib/Mono.Cecil/ReflectionWriter.cs      2005-10-28 17:01:04 UTC 
(rev 52335)
@@ -181,7 +181,7 @@
 
                        if (types [Constants.ModuleType] == null)
                                types.Add (new TypeDefinition (
-                                               Constants.ModuleType, 
string.Empty, (TypeAttributes) 0, m_mod));
+                                               Constants.ModuleType, 
string.Empty, (TypeAttributes) 0));
 
                        foreach (ITypeDefinition t in types)
                                orderedTypes.Add (t);

Modified: trunk/cecil/lib/Mono.Cecil/TypeDefinition.cs
===================================================================
--- trunk/cecil/lib/Mono.Cecil/TypeDefinition.cs        2005-10-28 16:36:28 UTC 
(rev 52334)
+++ trunk/cecil/lib/Mono.Cecil/TypeDefinition.cs        2005-10-28 17:01:04 UTC 
(rev 52335)
@@ -249,31 +249,20 @@
                        }
                }
 
-               internal TypeDefinition (string name, string ns, TypeAttributes 
attrs, ModuleDefinition module) :
+               internal TypeDefinition (string name, string ns, TypeAttributes 
attrs) :
                        base (name, ns)
                {
                        m_hasInfo = false;
                        m_attributes = attrs;
-                       m_scope = module;
                }
 
                public TypeDefinition (string name, string ns,
-                       TypeAttributes attributes, ModuleDefinition module, 
TypeReference baseType) :
-                       this (name, ns, attributes, module)
+                       TypeAttributes attributes, TypeReference baseType) :
+                       this (name, ns, attributes)
                {
-                       if (baseType.Module != module)
-                               baseType = module.Import (baseType);
-
                        this.BaseType = baseType;
                }
 
-               public TypeDefinition (string name, string ns,
-                       TypeAttributes attributes, ModuleDefinition module, 
Type baseType) :
-               this (name, ns, attributes, module)
-               {
-                       this.BaseType = module.Import (baseType);
-               }
-
                void OnMethodAdded (object sender, MethodDefinitionEventArgs ea)
                {
                        AttachMember (ea.MethodDefinition);
@@ -375,8 +364,7 @@
                        TypeDefinition nt = new TypeDefinition (
                                type.Name,
                                type.Namespace,
-                               type.Attributes,
-                               type.Module);
+                               type.Attributes);
 
                        nt.BaseType = helper == null ? type.BaseType : 
helper.ImportTypeReference (type.BaseType);
 

Modified: trunk/cecil/lib/Mono.Cecil/TypeReference.cs
===================================================================
--- trunk/cecil/lib/Mono.Cecil/TypeReference.cs 2005-10-28 16:36:28 UTC (rev 
52334)
+++ trunk/cecil/lib/Mono.Cecil/TypeReference.cs 2005-10-28 17:01:04 UTC (rev 
52335)
@@ -152,6 +152,11 @@
                        this.IsValueType = valueType;
                }
 
+               internal void AttachToScope (IMetadataScope scope)
+               {
+                       m_scope = scope;
+               }
+
                void OnGenericParameterAdded (object sender, 
GenericParameterEventArgs ea)
                {
                        ea.GenericParameter.Position = m_genparams.Count + 1;

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to