Copied remotely
[mono.git] / mcs / ilasm / codegen / Local.cs
1 //
2 // Mono.ILASM.Local
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
14 namespace Mono.ILASM {
15
16         public class Local {
17
18                 private int slot;
19                 private string name;
20                 private ITypeRef type;
21
22                 public Local (int slot, ITypeRef type) : this (slot, null, type) {
23
24                 }
25
26                 public Local (int slot, string name, ITypeRef type) {
27                         this.slot = slot;
28                         this.name = name;
29                         this.type = type;
30                 }
31
32                 public int Slot {
33                         get { return slot; }
34                         set { slot = value; }
35                 }
36
37                 public string Name {
38                         get { return name; }
39                 }
40
41                 public ITypeRef Type {
42                         get { return type; }
43                 }
44
45                 public PEAPI.Local GetPeapiLocal (CodeGen code_gen)
46                 {
47                         int ec = code_gen.Report.ErrorCount;
48                         type.Resolve (code_gen);
49
50                         if (code_gen.Report.ErrorCount > ec)
51                                 return null;
52
53                         return new PEAPI.Local (name, type.PeapiType);
54                 }
55         }
56
57 }
58