2005-01-31 Zoltan Varga <vargaz@freemail.hu>
[mono.git] / mcs / ilasm / codegen / FieldRef.cs
1 //
2 // Mono.ILASM.FieldRef
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 namespace Mono.ILASM {
14
15
16         public class FieldRef : IFieldRef {
17
18                 private TypeRef owner;
19                 private ITypeRef ret_type;
20                 private string name;
21
22                 private bool is_resolved;
23                 private PEAPI.Field peapi_field;
24
25                 public FieldRef (TypeRef owner, ITypeRef ret_type, string name)
26                 {
27                         this.owner = owner;
28                         this.ret_type = ret_type;
29                         this.name = name;
30                         
31                         is_resolved = false;
32                 }
33
34                 public PEAPI.Field PeapiField {
35                         get { return peapi_field; }
36                 }
37
38                 public void Resolve (CodeGen code_gen)
39                 {
40                         if (is_resolved)
41                                 return;
42
43                         TypeDef owner_def = code_gen.TypeManager[owner.FullName];
44                         peapi_field = owner_def.ResolveField (name, code_gen);
45
46                         is_resolved = true;
47                 }
48         }
49 }
50