support nested namespaces, fixes bug 516584
authorJuerg Billeter <j@bitron.ch>
Sat, 22 Mar 2008 22:19:49 +0000 (22:19 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Sat, 22 Mar 2008 22:19:49 +0000 (22:19 +0000)
2008-03-22  Juerg Billeter  <j@bitron.ch>

* vala/parser.y, vala/valanamespace.vala: support nested namespaces,
  fixes bug 516584

svn path=/trunk/; revision=1151

ChangeLog
vala/parser.y
vala/valanamespace.vala

index e7ae469..537e779 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2008-03-22  Jürg Billeter  <j@bitron.ch>
 
+       * vala/parser.y, vala/valanamespace.vala: support nested namespaces,
+         fixes bug 516584
+
+2008-03-22  Jürg Billeter  <j@bitron.ch>
+
        * ccode/valaccodedeclaration.vala, gobject/valaccodegenerator.vala:
          use extern appropriately for static fields,
          based on patch by Daniel Silverstone, fixes bug 523768
index dc1ab85..9afa0ac 100644 (file)
@@ -2630,8 +2630,7 @@ outer_declarations
        ;
 
 outer_declaration
-       : namespace_declaration
-       | namespace_member_declaration
+       : namespace_member_declaration
        ;
 
 opt_namespace_member_declarations
@@ -2645,7 +2644,8 @@ namespace_member_declarations
        ;
 
 namespace_member_declaration
-       : class_declaration
+       : namespace_declaration
+       | class_declaration
        | struct_declaration
        | interface_declaration
        | enum_declaration
index c08423f..9fd827f 100644 (file)
@@ -260,7 +260,7 @@ public class Vala.Namespace : Symbol {
                if (cprefixes.size > 0) {
                        return cprefixes[0];
                } else if (null != name) {
-                       return name;
+                       return parent_symbol.get_cprefix () + name;
                } else {
                        return "";
                }
@@ -295,7 +295,7 @@ public class Vala.Namespace : Symbol {
                        if (name == null) {
                                lower_case_cprefix = "";
                        } else {
-                               lower_case_cprefix = "%s_".printf (camel_case_to_lower_case (name));
+                               lower_case_cprefix = "%s%s_".printf (parent_symbol.get_lower_case_cprefix (), camel_case_to_lower_case (name));
                        }
                }
                return lower_case_cprefix;
@@ -347,7 +347,7 @@ public class Vala.Namespace : Symbol {
        
        private void process_ccode_attribute (Attribute! a) {
                if (a.has_argument ("cprefix")) {
-                       foreach(string name in a.get_string ("cprefix").split (","))
+                       foreach (string name in a.get_string ("cprefix").split (","))
                                add_cprefix (name);
                }
                if (a.has_argument ("lower_case_cprefix")) {