better error message
authorbdemsky <bdemsky>
Sun, 21 Dec 2008 05:31:04 +0000 (05:31 +0000)
committerbdemsky <bdemsky>
Sun, 21 Dec 2008 05:31:04 +0000 (05:31 +0000)
Robust/src/IR/State.java
Robust/src/IR/Tree/SemanticCheck.java

index 893224929cbb821a8f634401ea1c47de070e60e2..42c5bcd9aa20779a2463bb676f1ab88cc3d1d4a5 100644 (file)
@@ -40,6 +40,7 @@ public class State {
     return optionaltaskdescriptors;
   }
 
+
   /** Boolean flag which indicates whether compiler is compiling a task-based
    * program. */
   public boolean WEBINTERFACE=false;
@@ -87,6 +88,7 @@ public class State {
   private int arraycount=0;
 
 
+
   private Hashtable<ClassDescriptor, Hashtable<OptionalTaskDescriptor, OptionalTaskDescriptor>> optionaltaskdescriptors;
   private Hashtable<ClassDescriptor, Hashtable<FlagState, Set<OptionalTaskDescriptor>>> analysisresults;
 
@@ -114,7 +116,9 @@ public class State {
   }
 
   public int getArrayNumber(TypeDescriptor td) {
-    return ((Integer)arraytonumber.get(td)).intValue();
+    if (arraytonumber.containsKey(td))
+      return ((Integer)arraytonumber.get(td)).intValue();
+    else throw new Error("Could not find array type:" + td.toPrettyString());
   }
 
   public int numArrays() {
index 32577cc55e14b7dfd2a6a72db34ff03fcb5e10c2..9bb7d55baefe3bed79967d37a193916d952b42be 100644 (file)
@@ -512,7 +512,6 @@ public class SemanticCheck {
       throw new Error("Bad lside in "+an.printNode(0));
     checkExpressionNode(md, nametable, an.getDest(), null);
 
-
     /* We want parameter variables to tasks to be immutable */
     if (md instanceof TaskDescriptor) {
       if (an.getDest() instanceof NameNode) {
@@ -539,7 +538,6 @@ public class SemanticCheck {
       }
     }
 
-
     if (!postinc&&!typeutil.isSuperorType(an.getDest().getType(),an.getSrc().getType())) {
       throw new Error("Type of rside ("+an.getSrc().getType()+") not compatible with type of lside ("+an.getDest().getType()+")"+an.printNode(0));
     }