tag a couple of obsolete members
[mcs.git] / ilasm / codegen / LdtokenInstr.cs
blob0accc421b63ecff601e045b7691a6e948ad58268
1 //
2 // Mono.ILASM.LdtokenInstr
3 //
4 // Author(s):
5 // Jackson Harper (Jackson@LatitudeGeo.com)
6 //
7 // (C) 2003 Jackson Harper, All rights reserved
8 //
11 using System;
13 namespace Mono.ILASM {
15 public class LdtokenInstr : IInstr {
17 private IFieldRef field_ref;
18 private BaseMethodRef method_ref;
19 private BaseTypeRef type_ref;
21 public LdtokenInstr (IFieldRef field_ref, Location loc)
22 : base (loc)
24 this.field_ref = field_ref;
27 public LdtokenInstr (BaseMethodRef method_ref, Location loc)
28 : base (loc)
30 this.method_ref = method_ref;
33 public LdtokenInstr (BaseTypeRef type_ref, Location loc)
34 : base (loc)
36 this.type_ref = type_ref;
39 public override void Emit (CodeGen code_gen, MethodDef meth,
40 PEAPI.CILInstructions cil)
42 if (field_ref != null) {
43 field_ref.Resolve (code_gen);
44 cil.FieldInst (PEAPI.FieldOp.ldtoken,
45 field_ref.PeapiField);
46 } else if (method_ref != null) {
47 method_ref.Resolve (code_gen);
48 cil.MethInst (PEAPI.MethodOp.ldtoken,
49 method_ref.PeapiMethod);
50 } else if (type_ref != null) {
51 type_ref.Resolve (code_gen);
52 cil.TypeInst (PEAPI.TypeOp.ldtoken,
53 type_ref.PeapiType);