Charj: Forgot to check in these files.
authorJonathan Lifflander <jliffl2@illinois.edu>
Mon, 23 Aug 2010 20:24:09 +0000 (15:24 -0500)
committerAaron Becker <akbecker@gmail.com>
Mon, 23 Aug 2010 20:37:34 +0000 (15:37 -0500)
src/langs/charj/src/charj/translator/LiteralType.java [new file with mode: 0644]
src/langs/charj/src/charj/translator/TemplateType.java [new file with mode: 0644]

diff --git a/src/langs/charj/src/charj/translator/LiteralType.java b/src/langs/charj/src/charj/translator/LiteralType.java
new file mode 100644 (file)
index 0000000..82ac1b9
--- /dev/null
@@ -0,0 +1,16 @@
+
+package charj.translator;
+
+public class LiteralType extends ClassSymbol implements Type {
+    public Type baseType;
+    public String literal;
+
+    public LiteralType(SymbolTable symtab, Type _baseType) {
+        super(symtab, _baseType.getTypeName());
+        baseType = _baseType;
+    }
+
+    public String getTypeName() {
+        return baseType.getTypeName() + "[" + literal + "]";
+    }
+}
diff --git a/src/langs/charj/src/charj/translator/TemplateType.java b/src/langs/charj/src/charj/translator/TemplateType.java
new file mode 100644 (file)
index 0000000..d00e861
--- /dev/null
@@ -0,0 +1,26 @@
+
+package charj.translator;
+
+import java.util.List;
+
+public class TemplateType extends Symbol implements Type {
+    public Type baseType;
+    public List<Type> parameters;
+
+    public TemplateType(SymbolTable symtab, Type _baseType, 
+                        List<Type> _parameters) {
+        super(symtab, _baseType.getTypeName(), null);
+        baseType = _baseType;
+        parameters = _parameters;
+    }
+
+    public String getTypeName() {
+        StringBuilder sb = new StringBuilder();
+
+        for (Type t : parameters) {
+            sb.append(t.getTypeName());
+        }
+
+        return baseType.getTypeName() + "<" + sb.toString() + ">";
+    }
+}