2006-11-14 Atsushi Enomoto <atsushi@ximian.com>
[mono.git] / mcs / ilasm / codegen / MethodInstr.cs
index 2f0d9f9542a37f26334904cb8429d5ea76024457..62c291c8900ca52ef23e9b693d4937770a038fd8 100644 (file)
@@ -16,15 +16,20 @@ namespace Mono.ILASM {
         public class MethodInstr : IInstr {
 
                 private PEAPI.MethodOp op;
-                private IMethodRef operand;
+                private BaseMethodRef operand;
 
-                public MethodInstr (PEAPI.MethodOp op, IMethodRef operand)
+                public MethodInstr (PEAPI.MethodOp op, BaseMethodRef operand, Location loc)
+                       : base (loc)
                 {
                         this.op = op;
                         this.operand = operand;
+
+                        if (op == PEAPI.MethodOp.newobj || op == PEAPI.MethodOp.callvirt)
+                                operand.CallConv |= PEAPI.CallConv.Instance;
                 }
 
-                public void Emit (CodeGen code_gen, PEAPI.CILInstructions cil)
+                public override void Emit (CodeGen code_gen, MethodDef meth,
+                                          PEAPI.CILInstructions cil)
                 {
                         operand.Resolve (code_gen);
                         cil.MethInst (op, operand.PeapiMethod);