2010-06-03 Jb Evain <jbevain@novell.com>
[mcs.git] / ilasm / codegen / LabelInfo.cs
blob328787729ad99d7ddb7df3be4d3fe20632ab2245
1 //
2 // Mono.ILASM.LabelInfo
3 //
4 // Author(s):
5 // Jackson Harper (Jackson@LatitudeGeo.com)
6 //
7 // (C) 2003 Jackson Harper, All rights reserved
8 //
10 using System;
12 namespace Mono.ILASM {
14 public class LabelInfo : IComparable {
16 public readonly string Name;
17 public readonly int Pos;
18 public readonly uint Offset;
19 public PEAPI.CILLabel Label;
20 public bool UseOffset;
22 public LabelInfo (string name, int pos, uint offset)
24 Name = name;
25 Pos = pos;
26 Offset = offset;
27 Label = null;
28 UseOffset = true;
31 public LabelInfo (string name, int pos)
33 Name = name;
34 Pos = pos;
35 Label = null;
36 UseOffset = false;
39 public void Define (PEAPI.CILLabel label)
41 Label = label;
44 public int CompareTo (object obj)
46 LabelInfo other = obj as LabelInfo;
48 if(other != null)
49 return Pos.CompareTo(other.Pos);
51 throw new InternalErrorException ("object is not a LabelInfo");
54 public override string ToString ()
56 if (Name != null)
57 return Name;
58 return "IL_" + Pos;