2 import IR.Tree.Modifiers;
3 import IR.Tree.ExpressionNode;
8 * represents a symbol in the language (var name, function name, etc).
11 public class FieldDescriptor extends Descriptor {
13 public static FieldDescriptor arrayLength=new FieldDescriptor(new Modifiers(Modifiers.PUBLIC|Modifiers.FINAL), new TypeDescriptor(TypeDescriptor.INT), "length", null);
15 protected Modifiers modifier;
16 protected TypeDescriptor td;
17 protected String identifier;
18 protected ExpressionNode en;
20 public FieldDescriptor(Modifiers m, TypeDescriptor t, String identifier, ExpressionNode e) {
24 this.identifier=identifier;
26 this.safename = "___" + name + "___";
27 this.uniqueid=count++;
28 if (en!=null) throw new Error("Field initializers not implemented");
31 public TypeDescriptor getType() {
35 public String toString() {
37 return modifier.toString()+td.toString()+" "+identifier+";";
39 return modifier.toString()+td.toString()+" "+identifier+"="+en.printNode(0)+";";