Author: jbevain
Date: 2007-06-07 13:09:35 -0400 (Thu, 07 Jun 2007)
New Revision: 78868

Modified:
   trunk/cecil/linker/ChangeLog
   trunk/cecil/linker/Mono.Linker.Steps/MarkStep.cs
   trunk/cecil/linker/Mono.Linker/CustomResolver.cs
Log:
2007-06-07  Jb Evain  <[EMAIL PROTECTED]>

        * Mono.Linker.Steps/MarkStep.cs:
                Mark types used in some marshal specs.


Modified: trunk/cecil/linker/ChangeLog
===================================================================
--- trunk/cecil/linker/ChangeLog        2007-06-07 17:08:17 UTC (rev 78867)
+++ trunk/cecil/linker/ChangeLog        2007-06-07 17:09:35 UTC (rev 78868)
@@ -1,5 +1,8 @@
 2007-06-07  Jb Evain  <[EMAIL PROTECTED]>
 
+       * Mono.Linker.Steps/MarkStep.cs:
+               Mark types used in some marshal specs.
+
        * Mono.Linker.Tests/MarkStep.cs
          Tests/Mono.Linker.Tests/XmlLinkingTestFixture.cs
          Tests/TestCases/Linker/ReferenceInAttributes/*:

Modified: trunk/cecil/linker/Mono.Linker/CustomResolver.cs
===================================================================
--- trunk/cecil/linker/Mono.Linker/CustomResolver.cs    2007-06-07 17:08:17 UTC 
(rev 78867)
+++ trunk/cecil/linker/Mono.Linker/CustomResolver.cs    2007-06-07 17:09:35 UTC 
(rev 78868)
@@ -51,6 +51,10 @@
                                return assembly.MainModule.Types 
[type.FullName];
                        }
 
+                       ModuleDefinition module = type.Scope as 
ModuleDefinition;
+                       if (module != null)
+                               return module.Types [type.FullName];
+
                        throw new NotImplementedException ();
                }
 

Modified: trunk/cecil/linker/Mono.Linker.Steps/MarkStep.cs
===================================================================
--- trunk/cecil/linker/Mono.Linker.Steps/MarkStep.cs    2007-06-07 17:08:17 UTC 
(rev 78867)
+++ trunk/cecil/linker/Mono.Linker.Steps/MarkStep.cs    2007-06-07 17:09:35 UTC 
(rev 78868)
@@ -122,6 +122,16 @@
                                MarkInstruction (instruction);
                }
 
+               void MarkMarshalSpec (IHasMarshalSpec spec)
+               {
+                       CustomMarshalerSpec marshaler = spec.MarshalSpec as 
CustomMarshalerSpec;
+                       if (marshaler == null)
+                               return;
+
+                       TypeDefinition type = _context.GetType 
(marshaler.ManagedType);
+                       MarkType (type);
+               }
+
                void MarkCustomAttributes (ICustomAttributeProvider provider)
                {
                        foreach (CustomAttribute ca in 
provider.CustomAttributes)
@@ -131,6 +141,7 @@
                void MarkCustomAttribute (CustomAttribute ca)
                {
                        MarkMethod (ca.Constructor);
+
                        if (!ca.Resolved) {
                                ca = ca.Clone ();
                                ca.Resolve ();
@@ -225,6 +236,7 @@
                        MarkType (fd.DeclaringType);
                        MarkType (fd.FieldType);
                        MarkCustomAttributes (fd);
+                       MarkMarshalSpec (fd);
 
                        Annotations.Mark (fd);
                }
@@ -458,6 +470,7 @@
                        foreach (ParameterDefinition pd in md.Parameters) {
                                MarkType (pd.ParameterType);
                                MarkCustomAttributes (pd);
+                               MarkMarshalSpec (pd);
                        }
 
                        foreach (MethodReference ov in md.Overrides)
@@ -465,6 +478,7 @@
 
                        MarkType (md.ReturnType.ReturnType);
                        MarkCustomAttributes (md.ReturnType);
+                       MarkMarshalSpec (md.ReturnType);
 
                        if (ShouldParseMethodBody (md))
                                MarkMethodBody (md.Body);

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

Reply via email to