Charj: fix namespace handling to use symbol table correctly
[charm.git] / src / langs / charj / src / charj / translator / ClassSymbol.java
index 270c1901798997e088858bcaca4b80a896c50340..c5e5835fd9cc1f24f922f6d39630ddb6082db4e1 100644 (file)
@@ -243,4 +243,23 @@ public class ClassSymbol extends SymbolWithScope implements Scope {
         return name;
     }
 
+    public String getNamespaceOpeningString() {
+        Scope currentScope = scope;
+        String namespace = "";
+        while (currentScope.getEnclosingScope() != null) {
+            namespace = "namespace " + currentScope.getScopeName() + " { " + namespace;
+            currentScope = currentScope.getEnclosingScope();
+        }
+        return namespace;
+    }
+
+    public String getNamespaceClosingString() {
+        Scope currentScope = scope;
+        String namespace = "";
+        while (currentScope.getEnclosingScope() != null) {
+            namespace += "} ";
+            currentScope = currentScope.getEnclosingScope();
+        }
+        return namespace;
+    }
 }