start of new file
[IRC.git] / Robust / src / IR / TagVarDescriptor.java
1 package IR;
2
3 /**
4  * Descriptor 
5  *
6  * represents a symbol in the language (var name, function name, etc).
7  */
8
9 public class TagVarDescriptor extends Descriptor {
10
11     protected TagDescriptor td;
12     protected String identifier;
13     
14     public TagVarDescriptor(TagDescriptor t, String identifier) {
15         super(identifier);
16         this.td=t;
17         this.identifier=identifier;
18         this.safename = "___" + name + "___";
19         this.uniqueid=count++;
20     }
21
22     public String getName() {
23         return identifier;
24     }
25
26     public TagDescriptor getTag() {
27         return td;
28     }
29
30     public TypeDescriptor getType() {
31         return new TypeDescriptor(TypeDescriptor.TAG);
32     }
33
34     /*    public boolean equals(Object o) {
35         if (o instanceof TagVarDescriptor) {
36             TagVarDescriptor tvd=(TagVarDescriptor)o;
37             if (tvd.identifier.equals(identifier)) {
38                 if (tvd.td!=null) {
39                     if (!tvd.td.equals(td))
40                         throw new Error();
41                 } else if (td!=null)
42                     throw new Error();
43                 return true;
44             }
45         }
46         return false;
47     }
48
49     public int hashCode() {
50         return identifier.hashCode();
51         }*/
52
53     public String toString() {
54             return td.toString()+" "+identifier;
55     }
56 }