In ilasm/codegen:
[mono.git] / mcs / ilasm / codegen / TypeSpecFieldRef.cs
1 //
2 // Mono.ILASM.TypeSpecFieldRef
3 //
4 // Author(s):
5 //  Jackson Harper (Jackson@LatitudeGeo.com)
6 //
7 // (C) 2003 JacksonHarper, All rights reserved
8 //
9
10
11 using System;
12
13
14 namespace Mono.ILASM {
15
16         public class TypeSpecFieldRef : IFieldRef {
17
18                 private BaseTypeRef owner;
19                 private BaseTypeRef type;
20                 private string name;
21
22                 private PEAPI.FieldRef peapi_field;
23                 private bool is_resolved;
24
25                 public TypeSpecFieldRef (BaseTypeRef owner, BaseTypeRef type, string name)
26                 {
27                         this.owner = owner;
28                         this.type = 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                         owner.Resolve (code_gen);
44
45                         type.Resolve (code_gen);
46                         peapi_field = code_gen.PEFile.AddFieldToTypeSpec (owner.PeapiType, name, type.PeapiType);
47                 
48                         is_resolved = true;
49                 }
50
51         }
52
53 }
54