2 // Mono.ILASM.LdtokenInstr
5 // Jackson Harper (Jackson@LatitudeGeo.com)
7 // (C) 2003 Jackson Harper, All rights reserved
13 namespace Mono.ILASM {
15 public class LdtokenInstr : IInstr {
17 private IFieldRef field_ref;
18 private IMethodRef method_ref;
20 public LdtokenInstr (IFieldRef field_ref)
22 this.field_ref = field_ref;
25 public LdtokenInstr (IMethodRef method_ref)
27 this.method_ref = method_ref;
30 public void Emit (CodeGen code_gen, PEAPI.CILInstructions cil)
32 if (field_ref != null) {
33 field_ref.Resolve (code_gen);
34 cil.FieldInst (PEAPI.FieldOp.ldtoken,
35 field_ref.PeapiField);
36 } else if (method_ref != null) {
37 method_ref.Resolve (code_gen);
38 cil.MethInst (PEAPI.MethodOp.ldtoken,
39 method_ref.PeapiMethod);