Author: jbevain
Date: 2007-07-19 10:16:04 -0400 (Thu, 19 Jul 2007)
New Revision: 82289

Modified:
   trunk/mcs/class/Mono.Cecil/ChangeLog
   trunk/mcs/class/Mono.Cecil/Mono.Cecil.Cil/CodeWriter.cs
   trunk/mcs/class/Mono.Cecil/Mono.Cecil.Signatures/SignatureReader.cs
   trunk/mcs/class/Mono.Cecil/Mono.Cecil/ReflectionReader.cs
   trunk/mcs/class/Mono.Cecil/Mono.Cecil/SentinelType.cs
Log:
2007-07-19  Jb Evain  <[EMAIL PROTECTED]>

        * Mono.Cecil/ReflectionReader.cs
          Mono.Cecil/SentinelType.cs
          Mono.Cecil.Cil/CodeWriter.cs:
          Mono.Cecil.Signatures/SignatureReader.cs:
                Fix handling of varargs methods.


Modified: trunk/mcs/class/Mono.Cecil/ChangeLog
===================================================================
--- trunk/mcs/class/Mono.Cecil/ChangeLog        2007-07-19 13:56:46 UTC (rev 
82288)
+++ trunk/mcs/class/Mono.Cecil/ChangeLog        2007-07-19 14:16:04 UTC (rev 
82289)
@@ -1,3 +1,11 @@
+2007-07-19  Jb Evain  <[EMAIL PROTECTED]>
+
+       * Mono.Cecil/ReflectionReader.cs
+         Mono.Cecil/SentinelType.cs
+         Mono.Cecil.Cil/CodeWriter.cs:
+         Mono.Cecil.Signatures/SignatureReader.cs:
+               Fix handling of varargs methods.
+
 2007-07-18  Jb Evain  <[EMAIL PROTECTED]>
 
        * Mono.Cecil.Cil/CodeReader.cs

Modified: trunk/mcs/class/Mono.Cecil/Mono.Cecil/ReflectionReader.cs
===================================================================
--- trunk/mcs/class/Mono.Cecil/Mono.Cecil/ReflectionReader.cs   2007-07-19 
13:56:46 UTC (rev 82288)
+++ trunk/mcs/class/Mono.Cecil/Mono.Cecil/ReflectionReader.cs   2007-07-19 
14:16:04 UTC (rev 82289)
@@ -233,6 +233,11 @@
                                                pdef.Method = methref;
                                                methref.Parameters.Add (pdef);
                                        }
+
+                                       MethodDefSig mdsig = ms as MethodDefSig;
+                                       if (mdsig != null && mdsig.Sentinel > 
-1)
+                                               CreateSentinel (methref, 
mdsig.Sentinel);
+
                                        member = methref;
                                }
                                break;
@@ -1057,7 +1062,7 @@
                                throw new ArgumentException ("Invalid 
sentinel");
 
                        ParameterDefinition param = meth.Parameters [sentinel];
-                       param.ParameterType = new SentinelType 
(param.ParameterType);
+                       param.ParameterType = new SentinelType ();
                }
 
                TypeReference GetGenericArg (GenericArg arg, GenericContext 
context)

Modified: trunk/mcs/class/Mono.Cecil/Mono.Cecil/SentinelType.cs
===================================================================
--- trunk/mcs/class/Mono.Cecil/Mono.Cecil/SentinelType.cs       2007-07-19 
13:56:46 UTC (rev 82288)
+++ trunk/mcs/class/Mono.Cecil/Mono.Cecil/SentinelType.cs       2007-07-19 
14:16:04 UTC (rev 82289)
@@ -28,9 +28,9 @@
 
 namespace Mono.Cecil {
 
-       public sealed class SentinelType : TypeSpecification {
+       public sealed class SentinelType : TypeReference {
 
-               public SentinelType (TypeReference type) : base (type)
+               public SentinelType () : base ("...", null)
                {
                }
        }

Modified: trunk/mcs/class/Mono.Cecil/Mono.Cecil.Cil/CodeWriter.cs
===================================================================
--- trunk/mcs/class/Mono.Cecil/Mono.Cecil.Cil/CodeWriter.cs     2007-07-19 
13:56:46 UTC (rev 82288)
+++ trunk/mcs/class/Mono.Cecil/Mono.Cecil.Cil/CodeWriter.cs     2007-07-19 
14:16:04 UTC (rev 82289)
@@ -452,7 +452,7 @@
                static void ComputeMaxStack (InstructionCollection instructions)
                {
                        InstructionCollection ehs = new InstructionCollection 
(null);
-                       foreach (ExceptionHandler eh in 
instructions.Container.ExceptionHandlers)
+                       foreach (ExceptionHandler eh in 
instructions.Container.ExceptionHandlers) {
                                switch (eh.Type) {
                                case ExceptionHandlerType.Catch :
                                        ehs.Add (eh.HandlerStart);
@@ -461,6 +461,7 @@
                                        ehs.Add (eh.FilterStart);
                                        break;
                                }
+                       }
 
                        int max = 0, current = 0;
                        foreach (Instruction instr in instructions) {

Modified: trunk/mcs/class/Mono.Cecil/Mono.Cecil.Signatures/SignatureReader.cs
===================================================================
--- trunk/mcs/class/Mono.Cecil/Mono.Cecil.Signatures/SignatureReader.cs 
2007-07-19 13:56:46 UTC (rev 82288)
+++ trunk/mcs/class/Mono.Cecil/Mono.Cecil.Signatures/SignatureReader.cs 
2007-07-19 14:16:04 UTC (rev 82289)
@@ -163,10 +163,10 @@
                        int start, callconv;
                        Utilities.ReadCompressedInteger (m_blobData, (int) 
index, out start);
                        callconv = m_blobData [start];
+                       if ((callconv & 0x5) == 0x5 || (callconv & 0x10) == 
0x10) // vararg || generic?
+                               return GetMethodDefSig (index);
                        if ((callconv & 0x6) != 0) // field ?
                                return GetFieldSig (index);
-                       if ((callconv & 0x10) != 0) // generic ?
-                               return GetMethodDefSig (index);
 
                        switch (tt) {
                        case TokenType.TypeDef :
@@ -266,7 +266,9 @@
 
                        methodDef.ParamCount = Utilities.ReadCompressedInteger 
(data, start, out start);
                        methodDef.RetType = ReadRetType (data, start, out 
start);
-                       methodDef.Parameters = ReadParameters 
(methodDef.ParamCount, data, start);
+                       int sentpos;
+                       methodDef.Parameters = ReadParameters 
(methodDef.ParamCount, data, start, out sentpos);
+                       methodDef.Sentinel = sentpos;
                }
 
                void ReadMethodRefSig (MethodRefSig methodRef, byte [] data, 
int pos, out int start)

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

Reply via email to