I've commited a slightly modified version of your patch, thanks!
On 9/18/07, Jb Evain <[EMAIL PROTECTED]> wrote:
> Hey,
>
> Good catch!
>
> Again, if you have an assembly you can send me, that would be nice.
>
> Jb
>
> On 9/18/07, Ivan <[EMAIL PROTECTED]> wrote:
> >
> > Whilst using monomerge.exe I found a case where MethodBody.Clone
> > didn't decode an instruction.
> > The method was like below:
> >
> > .method assembly specialname rtspecialname instance void .ctor() cil
> > managed
> > {
> > .maxstack 4
> > L_0000: ldarg 0
> > L_0004: call instance void [mscorlib]System.Object::.ctor()
> >
> > While processing "ldarg 0" the routine couldn't find a method
> > parameter to match the operand.
> > I have limited CIL knowledge, but I believe "ldarg 0" references the
> > "this" pointer.
> > I changed my code to recognise and clone the "this" operand.
> >
> > diff -u3 -r org\Mono.Cecil/Mono.Cecil.Cil/MethodBody.cs Mono.Cecil/
> > Mono.Cecil.Cil/MethodBody.cs
> > --- org\Mono.Cecil/Mono.Cecil.Cil/MethodBody.cs 2007-07-13
> > 08:28:50.000000000 +1000
> > +++ Mono.Cecil/Mono.Cecil.Cil/MethodBody.cs 2007-09-18
> > 16:25:09.445511600 +1000
> > @@ -130,7 +130,7 @@
> > case OperandType.InlineParam :
> > case OperandType.ShortInlineParam :
> > int param =
> > body.Method.Parameters.IndexOf
> > ((ParameterDefinition) instr.Operand);
> > - ni.Operand = parent.Parameters
> > [param];
> > + ni.Operand = instr.Operand ==
> > body.Method.This ?
> > nb.Method.This : parent.Parameters[param];
> > break;
> > case OperandType.InlineVar :
> > case OperandType.ShortInlineVar :
> >
> >
> > > >
> >
>
>
> --
> Jb Evain <[EMAIL PROTECTED]>
>
--
Jb Evain <[EMAIL PROTECTED]>
--~--~---------~--~----~------------~-------~--~----~
--
mono-cecil
-~----------~----~----~----~------~----~------~--~---