Charj: fix interaction between pupping code and readonly variables
authorAaron Becker <akbecker@gmail.com>
Wed, 2 Jun 2010 01:18:50 +0000 (20:18 -0500)
committerAaron Becker <akbecker@gmail.com>
Wed, 2 Jun 2010 01:18:50 +0000 (20:18 -0500)
src/langs/charj/src/charj/translator/AstModifier.java
src/langs/charj/src/charj/translator/CharjASTModifier.g
src/langs/charj/src/charj/translator/CharjSemantics.g

index b427cbcee711cf69f392683cc7f16cca98657761..ee7c47f456b17686ea089fd95ffec140232e9bb7 100644 (file)
@@ -84,11 +84,11 @@ class AstModifier
             switch(p.getType())
             {
                 case CharjParser.PRIMITIVE_VAR_DECLARATION:
-                    System.out.println("found primitive var: " + idNode.getText());
+                    //System.out.println("found primitive var: " + idNode.getText());
                     type = p.getType();
                     break;
                 case CharjParser.OBJECT_VAR_DECLARATION:
-                    System.out.println("found object var: " + idNode.getText());
+                    //System.out.println("found object var: " + idNode.getText());
                     type = p.getChild(0).getType();
                     break;
                 case CharjParser.FUNCTION_METHOD_DECL:
@@ -99,18 +99,18 @@ class AstModifier
                     switch(type)
                     {
                         case CharjParser.REFERENCE_TYPE:
-                            System.out.println("puping a reference type");
+                            //System.out.println("puping a reference type");
                             break;
                         case CharjParser.PRIMITIVE_VAR_DECLARATION:
-                            System.out.println("puping a primitive type");
+                            //System.out.println("puping a primitive type");
                             primitiveVarPup(idNode);
                             break;
                         case CharjParser.POINTER_TYPE:
-                            System.out.println("puping a pointer type");
+                            //System.out.println("puping a pointer type");
                             pointerVarPup(idNode);
                             break;
                         case CharjParser.PROXY_TYPE:
-                            System.out.println("puping a proxy type");
+                            //System.out.println("puping a proxy type");
                             proxyVarPup(idNode);
                             break;
                         default:
index 21da725078ea11036fb81ce4482b713e92a581be..e1715260a3432205b8d1db64c98397328e617e82 100644 (file)
@@ -24,7 +24,7 @@ package charj.translator;
     LocalScope currentLocalScope = null;
     Translator translator;
 
-    AstModifier astmod;
+    AstModifier astmod = new AstModifier();
 }
 
 // Replace default ANTLR generated catch clauses with this action, allowing early failure.
@@ -143,8 +143,7 @@ variableDeclarator
 variableDeclaratorId
     :   ^(IDENT arrayDeclaratorList?)
         {
-            //if (currentClass != null)
-                astmod.varPup($IDENT);
+            astmod.varPup($IDENT);
         }
     ;
 
index 59dc01037b5993714a2e111af33f373b5e1b473f..6ac3ce6e593effffa8956b91b82fe590938ba52a 100644 (file)
@@ -199,7 +199,7 @@ scope ScopeStack;
             ^(VAR_DECLARATOR_LIST field[$objectType.type]+))
         {
             ClassSymbol type = $objectType.type;
-            if (type.isChare) currentClass.addExtern(type.getName());
+            if (type != null && type.isChare) currentClass.addExtern(type.getName());
         }
     |   ^(CONSTRUCTOR_DECL m=modifierList? g=genericTypeParameterList? IDENT f=formalParameterList 
             b=block)
@@ -345,9 +345,9 @@ String name = "";
     :   ^(QUALIFIED_TYPE_IDENT (typeIdent {name += $typeIdent.name;})+) 
         {
             $type = null;
-            System.out.println("trying to resolve type " + name + " in type " + currentClass);
+            /*System.out.println("trying to resolve type " + name + " in type " + currentClass);*/
             if (currentClass != null) $type = currentClass.resolveType(name);
-            System.out.println("got " + $type);
+            /*System.out.println("got " + $type);*/
             if ($type == null) $type = symtab.resolveBuiltinType(name);
             $QUALIFIED_TYPE_IDENT.symbol = $type;
         }
@@ -411,7 +411,7 @@ localVariableDeclaration
     |   ^(OBJECT_VAR_DECLARATION localModifierList? objectType variableDeclaratorList)
         {
             ClassSymbol type = $objectType.type;
-            System.out.println("looked up type " + type + " for declaration " + $objectType.text);
+            /*System.out.println("looked up type " + type + " for declaration " + $objectType.text);*/
             if (type != null && type.isChare && currentClass != null) currentClass.addExtern(type.getName());
         }
     ;