Hi,
On Fri, Mar 25, 2011 at 8:01 PM, tbarela <[email protected]> wrote:
> MethodDefinition callee = ( instruction.Operand as
> MethodReference ).Resolve();
By using Resolve you retrieve the MethodDefinition from another
module, and you later use it as it. You can't use a definition from
another module directly in a module, you need to import it. But in
your case, you already have the proper method reference. Just write:
MethodReference callee = (MethodReference) instruction.Operand;
MethodDefinition callee_def = callee.Resolve ();
> if( canUseCall( callee ) )
> {
if (canUseCall (callee_def))
> Console.Write("->");
>
> var newInstruction =
> processor.Create(OpCodes.Call, callee);
> processor.Replace(instruction, newInstruction);
And here you just reuse the properly scoped callee.
Jb
--
--
mono-cecil