Merge pull request #4246 from Unity-Technologies/mcs-generic-constraint-enumerator
[mono.git] / mcs / ilasm / codegen / MethodInstr.cs
1 //
2 // Mono.ILASM.MethodInstr
3 //
4 // Author(s):
5 //  Jackson Harper (Jackson@LatitudeGeo.com)
6 //
7 // (C) 2003 Jackson Harper, All rights reserved
8 //
9
10
11 using System;
12
13
14 namespace Mono.ILASM {
15
16         public class MethodInstr : IInstr {
17
18                 private PEAPI.MethodOp op;
19                 private BaseMethodRef operand;
20
21                 public MethodInstr (PEAPI.MethodOp op, BaseMethodRef operand, Location loc)
22                         : base (loc)
23                 {
24                         this.op = op;
25                         this.operand = operand;
26
27                         if (op == PEAPI.MethodOp.newobj || op == PEAPI.MethodOp.callvirt)
28                                 operand.CallConv |= PEAPI.CallConv.Instance;
29                 }
30
31                 public override void Emit (CodeGen code_gen, MethodDef meth,
32                                            PEAPI.CILInstructions cil)
33                 {
34                         operand.Resolve (code_gen);
35                         cil.MethInst (op, operand.PeapiMethod);
36                 }
37         }
38
39 }
40
41