blob: 0accc421b63ecff601e045b7691a6e948ad58268 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
//
// Mono.ILASM.LdtokenInstr
//
// Author(s):
// Jackson Harper (Jackson@LatitudeGeo.com)
//
// (C) 2003 Jackson Harper, All rights reserved
//
using System;
namespace Mono.ILASM {
public class LdtokenInstr : IInstr {
private IFieldRef field_ref;
private BaseMethodRef method_ref;
private BaseTypeRef type_ref;
public LdtokenInstr (IFieldRef field_ref, Location loc)
: base (loc)
{
this.field_ref = field_ref;
}
public LdtokenInstr (BaseMethodRef method_ref, Location loc)
: base (loc)
{
this.method_ref = method_ref;
}
public LdtokenInstr (BaseTypeRef type_ref, Location loc)
: base (loc)
{
this.type_ref = type_ref;
}
public override void Emit (CodeGen code_gen, MethodDef meth,
PEAPI.CILInstructions cil)
{
if (field_ref != null) {
field_ref.Resolve (code_gen);
cil.FieldInst (PEAPI.FieldOp.ldtoken,
field_ref.PeapiField);
} else if (method_ref != null) {
method_ref.Resolve (code_gen);
cil.MethInst (PEAPI.MethodOp.ldtoken,
method_ref.PeapiMethod);
} else if (type_ref != null) {
type_ref.Resolve (code_gen);
cil.TypeInst (PEAPI.TypeOp.ldtoken,
type_ref.PeapiType);
}
}
}
}
|