Charj: Fix primitive type resolution, broken in a couple places.
authorJonathan Lifflander <jliffl2@illinois.edu>
Thu, 1 Mar 2012 01:56:27 +0000 (19:56 -0600)
committerJonathan Lifflander <jliffl2@illinois.edu>
Thu, 1 Mar 2012 01:56:27 +0000 (19:56 -0600)
src/langs/charj/src/charj/translator/PackageScope.java
src/langs/charj/src/charj/translator/TypeName.java

index f7b6e904965842d9e522be52066cf8c1d50ac75b..1ddb9cf6c65fb818bd5f1a31679796e9906c70be 100644 (file)
@@ -33,15 +33,14 @@ public class PackageScope extends SymbolWithScope {
     public ClassSymbol resolveType(List<TypeName> type) {
         if (type == null) return null;
 
-        String typeStr = "";
+        String typeStr = TypeName.typeToString(type);
 
         if (debug()) { 
-            typeStr = TypeName.typeToString(type);
             System.out.println(" PackageScope.resolveType(" + typeStr + 
                                 "): examine " + toString());
         }
 
-        ClassSymbol cs = symtab.primitiveTypes.get(type);
+        ClassSymbol cs = symtab.primitiveTypes.get(typeStr);
         if (cs != null) return cs;
 
         if (type.size() == 1) return (ClassSymbol)members.get(type.get(0).name);
index dfd9831ef594666329f8be029cfffa39fdb32198..4d296db1a0facef402f72478b2cec7173b9bf6bb 100644 (file)
@@ -30,7 +30,11 @@ public class TypeName {
             }
             params = sb.toString();
         }
-        return name + "<" + params + ">";
+        if (params != "") {
+          return name + "<" + params + ">";
+        } else {
+          return name;
+        }
     }
 
     public static List<TypeName> createTypeName(String name) {