changes to MGC class library
[IRC.git] / Robust / src / IR / TypeDescriptor.java
index 855345789a76f69727efd793c2f889d191fbc3ce..431d964dc0d1d76572f17fb2b2951506890ce7ef 100644 (file)
@@ -30,18 +30,19 @@ public class TypeDescriptor extends Descriptor {
   private int type;
   ClassDescriptor class_desc;
   boolean isClassNameRef = false;
-  
+
   private Vector<AnnotationDescriptor> annotationSet;
+  private TypeExtension typeExtension;
 
   public boolean equals(Object o) {
     if (o instanceof TypeDescriptor) {
       TypeDescriptor t=(TypeDescriptor)o;
       if (t.type!=type)
-       return false;
+        return false;
       if ((type==CLASS)&&(!t.getSymbol().equals(getSymbol())))
-       return false;
+        return false;
       if (t.arraycount!=arraycount)
-       return false;
+        return false;
       if (t.isClassNameRef != this.isClassNameRef)
         return false;
       return true;
@@ -58,11 +59,11 @@ public class TypeDescriptor extends Descriptor {
       return false;
     return true;
   }
-  
+
   public boolean isClassNameRef() {
     return this.isClassNameRef;
   }
-  
+
   public void setClassNameRef() {
     this.isClassNameRef = true;
   }
@@ -78,14 +79,14 @@ public class TypeDescriptor extends Descriptor {
     if (arraycount!=0||!isClass())
       return false;
     return (name.equals("bytewrapper")||
-           name.equals("booleanwrapper")||
-           name.equals("shortwrapper")||
-           name.equals("intwrapper")||
-           name.equals("longwrapper")||
-           name.equals("charwrapper")||
-           name.equals("floatwrapper")||
-           name.equals("doublewrapper")||
-           name.equals("Objectwrapper"));
+            name.equals("booleanwrapper")||
+            name.equals("shortwrapper")||
+            name.equals("intwrapper")||
+            name.equals("longwrapper")||
+            name.equals("charwrapper")||
+            name.equals("floatwrapper")||
+            name.equals("doublewrapper")||
+            name.equals("Objectwrapper"));
   }
 
   public TypeDescriptor makeArray(State state) {
@@ -149,7 +150,9 @@ public class TypeDescriptor extends Descriptor {
       return "float";
     else if (isOffset())
       return "short";
-    else 
+    else if (isNull())
+      return "null";
+    else
       throw new Error("Error Type: "+type);
   }
 
@@ -266,12 +269,12 @@ public class TypeDescriptor extends Descriptor {
   public boolean isEnum() {
     if(this.type != CLASS) {
       return false;
-    } else if(this.class_desc != null){
+    } else if(this.class_desc != null) {
       return this.class_desc.isEnum();
     }
     return false;
   }
-  
+
   public boolean isClass() {
     return (type==CLASS && !isEnum());
   }
@@ -281,7 +284,7 @@ public class TypeDescriptor extends Descriptor {
   }
 
   public boolean isImmutable() {
-    return isPrimitive() || isString();
+    return isPrimitive();
   }
 
   public TypeDescriptor(NameDescriptor name) {
@@ -337,7 +340,7 @@ public class TypeDescriptor extends Descriptor {
     }
     for(int i=0; i<arraycount; i++)
       str+="[]";
-    return str;    
+    return str;
   }
 
   private static String decodeInt(int type) {
@@ -367,13 +370,21 @@ public class TypeDescriptor extends Descriptor {
       return "offset";
     else throw new Error();
   }
-  
-  public void addAnnotationMarker(AnnotationDescriptor an){
+
+  public void addAnnotationMarker(AnnotationDescriptor an) {
     annotationSet.add(an);
   }
-  
-  public Vector<AnnotationDescriptor> getAnnotationMarkers(){
+
+  public Vector<AnnotationDescriptor> getAnnotationMarkers() {
     return annotationSet;
   }
-  
+
+  public void setExtension(TypeExtension te) {
+    typeExtension=te;
+  }
+
+  public TypeExtension getExtension() {
+    return typeExtension;
+  }
+
 }