Use `const' in C for immutable classes where appropriate
authorJürg Billeter <j@bitron.ch>
Thu, 12 Jun 2008 16:50:57 +0000 (16:50 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Thu, 12 Jun 2008 16:50:57 +0000 (16:50 +0000)
2008-06-12  Jürg Billeter  <j@bitron.ch>

* vala/valaclass.vala:

Use `const' in C for immutable classes where appropriate

svn path=/trunk/; revision=1573

ChangeLog
vala/valaclass.vala

index 6cdaab5..6acc389 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2008-06-12  Jürg Billeter  <j@bitron.ch>
 
+       * vala/valaclass.vala:
+
+       Use `const' in C for immutable classes where appropriate
+
+2008-06-12  Jürg Billeter  <j@bitron.ch>
+
        * vala/valainterfacewriter.vala:
        * vapigen/valagidlparser.vala:
 
index 136fbb1..c7df296 100644 (file)
@@ -448,8 +448,12 @@ public class Vala.Class : ObjectTypeSymbol {
        }
 
        public override string get_cname (bool const_type = false) {
-               if (const_type && const_cname != null) {
-                       return const_cname;
+               if (const_type) {
+                       if (const_cname != null) {
+                               return const_cname;
+                       } else if (is_immutable) {
+                               return "const " + get_cname (false);
+                       }
                }
 
                if (cname == null) {