Author: jbevain
Date: 2008-02-19 04:28:43 -0500 (Tue, 19 Feb 2008)
New Revision: 96124

Modified:
   trunk/mcs/class/Mono.Cecil/ChangeLog
   trunk/mcs/class/Mono.Cecil/Mono.Cecil/DefaultImporter.cs
Log:
2008-02-19  Jb Evain  <[EMAIL PROTECTED]>

        * Mono.Cecil/DefaultImporter.cs:
                Add support for importing function pointers. Based on a
                patch by Andrea Carlo Ornstein <[EMAIL PROTECTED]>.


Modified: trunk/mcs/class/Mono.Cecil/ChangeLog
===================================================================
--- trunk/mcs/class/Mono.Cecil/ChangeLog        2008-02-19 09:20:39 UTC (rev 
96123)
+++ trunk/mcs/class/Mono.Cecil/ChangeLog        2008-02-19 09:28:43 UTC (rev 
96124)
@@ -1,5 +1,9 @@
 2008-02-19  Jb Evain  <[EMAIL PROTECTED]>
 
+       * Mono.Cecil/DefaultImporter.cs:
+               Add support for importing function pointers. Based on a
+               patch by Andrea Carlo Ornstein <[EMAIL PROTECTED]>.
+
        * Mono.Cecil/ModuleDefinition.cs:
                Add a Inject(FieldDef) overload for symmetry.
                Patch by Andrea Carlo Ornstein <[EMAIL PROTECTED]>.

Modified: trunk/mcs/class/Mono.Cecil/Mono.Cecil/DefaultImporter.cs
===================================================================
--- trunk/mcs/class/Mono.Cecil/Mono.Cecil/DefaultImporter.cs    2008-02-19 
09:20:39 UTC (rev 96123)
+++ trunk/mcs/class/Mono.Cecil/Mono.Cecil/DefaultImporter.cs    2008-02-19 
09:28:43 UTC (rev 96124)
@@ -94,6 +94,19 @@
                                typeSpec = new ModifierRequired (elementType, 
ImportTypeReference (mt, context));
                        } else if (original is SentinelType) {
                                typeSpec = new SentinelType (elementType);
+                       } else if (original is FunctionPointerType) {
+                               FunctionPointerType ori = original as 
FunctionPointerType;
+
+                               FunctionPointerType fnptr = new 
FunctionPointerType (
+                                       ori.HasThis,
+                                       ori.ExplicitThis,
+                                       ori.CallingConvention,
+                                       new MethodReturnType 
(ImportTypeReference (ori.ReturnType.ReturnType, context)));
+
+                               foreach (ParameterDefinition parameter in 
ori.Parameters)
+                                       fnptr.Parameters.Add (new 
ParameterDefinition (ImportTypeReference (parameter.ParameterType, context)));
+
+                               typeSpec = fnptr;
                        } else
                                throw new ReflectionException ("Unknown element 
type: {0}", original.GetType ().Name);
 

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

Reply via email to