* support-test-*.cs: Rename from test-*-p2.cs.
[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 BaseTypeRef type;
21
22                 public Local (int slot, BaseTypeRef type) : this (slot, null, type) {
23
24                 }
25
26                 public Local (int slot, string name, BaseTypeRef 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 BaseTypeRef Type {
42                         get { return type; }
43                 }
44
45                 public PEAPI.Local GetPeapiLocal (CodeGen code_gen)
46                 {
47                         int ec = code_gen.Report.ErrorCount;
48                         BaseGenericTypeRef gtr = type as BaseGenericTypeRef;
49                         if (gtr == null)
50                                 type.Resolve (code_gen);
51                         else
52                                 gtr.ResolveNoTypeSpec (code_gen);
53
54                         if (code_gen.Report.ErrorCount > ec)
55                                 return null;
56
57                         return new PEAPI.Local (name, type.PeapiType);
58                 }
59         }
60
61 }
62