Fix bug #534965.
[mcs.git] / ilasm / codegen / CalliInstr.cs
blob676e7462f63f8c846bb090e46d649d2d8be80d7f
1 //
2 // Mono.ILASM.CalliInstr
3 //
4 // Author(s):
5 // Jackson Harper (Jackson@LatitudeGeo.com)
6 //
7 // (C) 2003 Jackson Harper, All rights reserved
8 //
11 using System;
14 namespace Mono.ILASM {
16 public class CalliInstr : IInstr {
18 private PEAPI.CallConv call_conv;
19 private BaseTypeRef ret_type;
20 private BaseTypeRef[] param;
22 public CalliInstr (PEAPI.CallConv call_conv, BaseTypeRef ret_type,
23 BaseTypeRef[] param, Location loc)
24 : base (loc)
26 this.call_conv = call_conv;
27 this.ret_type = ret_type;
28 this.param = param;
31 public override void Emit (CodeGen code_gen, MethodDef meth,
32 PEAPI.CILInstructions cil)
34 PEAPI.Type[] param_array;
35 PEAPI.CalliSig callisig;
37 if (param != null) {
38 param_array = new PEAPI.Type[param.Length];
39 int count = 0;
40 foreach (BaseTypeRef typeref in param) {
41 typeref.Resolve (code_gen);
42 param_array[count++] = typeref.PeapiType;
44 } else {
45 param_array = new PEAPI.Type[0];
48 ret_type.Resolve (code_gen);
49 callisig = new PEAPI.CalliSig (call_conv,
50 ret_type.PeapiType, param_array);
52 cil.calli (callisig);