Updated to support being able to do calls such as package1.package2.class abc = new...
authorstephey <stephey>
Fri, 22 Apr 2011 08:38:18 +0000 (08:38 +0000)
committerstephey <stephey>
Fri, 22 Apr 2011 08:38:18 +0000 (08:38 +0000)
P.S. Someone forgot to checkin a TryCatchTest.output.goal

Robust/src/IR/Tree/BuildIR.java
Robust/src/IR/Tree/SemanticCheck.java
Robust/src/IR/TypeUtil.java

index 943f52c5f91e36d805ad798fb8e502c4c1a6c240..307796612f423bfbc0b18ab24bb429645b3c0b02 100644 (file)
@@ -53,15 +53,15 @@ public class BuildIR {
             mandatoryImports.put(nd.getIdentifier(), nd.getPathFromRootToHere());
           } else {
             throw new Error("An ambiguous class "+ nd.getIdentifier() +" has been found. It is included for " +
-                       ((String)mandatoryImports.get(nd.getIdentifier())).replace("___________", ".") + " and " +
-                       nd.getPathFromRootToHere(nd.getIdentifier()).replace("___________", "."));
+                       ((String)mandatoryImports.get(nd.getIdentifier())) + " and " +
+                       nd.getPathFromRootToHere());
           }
         else {
           // This kind of breaks away from tradition a little bit by doing the file checks here
           // instead of in Semantic check, but doing it here is easier because we have a mapping early on
           // if I wait until semantic check, I have to change ALL the type descriptors to match the new
           // mapping and that's both ugly and tedious.
-          File folder = new File(nd.getPathFromRootToHere(nd.getIdentifier()).replace('.', '/'));
+          File folder = new File(nd.getPathFromRootToHere().replace('.', '/'));
           if (folder.exists()) {
             for (String file : folder.list()) {
               // if the file is of type *.java add to multiImport list.
@@ -75,8 +75,7 @@ public class BuildIR {
                     multiimports.put(classname, new Error("Error: class " + nd.getIdentifier()
                         + " is defined more than once in a multi-import in " + sourcefile));
                   } else {
-                    multiimports.put(classname, nd.getIdentifier().replace("\\.", "___________")
-                        + "___________" + classname);
+                    multiimports.put(classname, nd.getIdentifier() + "." + classname);
                   }
                 }
               }
@@ -486,8 +485,8 @@ public class BuildIR {
     if(packageName == null) {
       cn=new ClassDescriptor(pn.getChild("name").getTerminal(), false); 
     } else  {
-      String newClassname = packageName + "___________" + pn.getChild("name").getTerminal();
-      cn= new ClassDescriptor(packageName, newClassname.replaceAll("\\.", "___________") , false);
+      String newClassname = packageName + "." + pn.getChild("name").getTerminal();
+      cn= new ClassDescriptor(packageName, newClassname, false);
     }
     cn.setImports(mandatoryImports);
     if (!isEmpty(pn.getChild("super").getTerminal())) {
index a7238a89d6c4c8475b034a3fbba78cc4e36dbd27..6f87cbe89cca3c7f78ea01b88b15c0627d9c029f 100644 (file)
@@ -147,10 +147,6 @@ public class SemanticCheck {
       return;       /* Done */
     else if (td.isClass()) {
       String name=td.toString();
-      int index = name.lastIndexOf('.');
-      if(index != -1) {
-        name = name.substring(index+1);
-      }
       ClassDescriptor field_cd=checkAll?getClass(cd, name):getClass(cd, name, REFERENCE);
 
       if (field_cd==null)
index 50f6863909c19f7f8e04a145da46eedcedb42db1..30c3c555072e875092e294edda90adc7b6200abc 100644 (file)
@@ -43,7 +43,6 @@ public class TypeUtil {
   }
 
   public void addNewClass(String cl, Set todo) {
-    System.out.println("I'm looking for "+cl.replace(".", "/"));
     //search through the default locations for the file.
     for (int i = 0; i < state.classpath.size(); i++) {
       String path = (String) state.classpath.get(i);