some fixes for abstract properties improve default cname
authorJürg Billeter <j@bitron.ch>
Tue, 3 Apr 2007 11:23:40 +0000 (11:23 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Tue, 3 Apr 2007 11:23:40 +0000 (11:23 +0000)
2007-04-03  Jürg Billeter  <j@bitron.ch>

* vala/valasymbolbuilder.vala, vala/valacodegenerator.vala: some fixes
  for abstract properties
* vala/valamethod.vala: improve default cname

svn path=/trunk/; revision=271

vala/ChangeLog
vala/vala/valacodegenerator.vala
vala/vala/valamethod.vala
vala/vala/valasymbolbuilder.vala

index 787b45c..d152495 100644 (file)
@@ -1,5 +1,11 @@
 2007-04-03  Jürg Billeter  <j@bitron.ch>
 
+       * vala/valasymbolbuilder.vala, vala/valacodegenerator.vala: some fixes
+         for abstract properties
+       * vala/valamethod.vala: improve default cname
+
+2007-04-03  Jürg Billeter  <j@bitron.ch>
+
        * vapi/glib-2.0.vala: extend unicode support, add GRegex
 
 2007-03-28  Raffaele Sandrini  <rasa@gmx.ch>
index 2685aaa..91ddf2a 100644 (file)
@@ -536,7 +536,7 @@ public class Vala.CodeGenerator : CodeVisitor {
                /* create properties */
                var props = cl.get_properties ();
                foreach (Property prop in props) {
-                       if (prop.base_property != null || prop.base_interface_property != null) {
+                       if (prop.overrides || prop.base_interface_property != null) {
                                var cinst = new CCodeFunctionCall (new CCodeIdentifier ("g_object_class_override_property"));
                                cinst.add_argument (ccall);
                                cinst.add_argument (new CCodeConstant (prop.get_upper_case_cname ()));
@@ -724,7 +724,7 @@ public class Vala.CodeGenerator : CodeVisitor {
                var cswitch = new CCodeSwitchStatement (new CCodeIdentifier ("property_id"));
                var props = cl.get_properties ();
                foreach (Property prop in props) {
-                       if (prop.get_accessor == null) {
+                       if (prop.get_accessor == null || prop.is_abstract) {
                                continue;
                        }
 
@@ -772,7 +772,7 @@ public class Vala.CodeGenerator : CodeVisitor {
                var cswitch = new CCodeSwitchStatement (new CCodeIdentifier ("property_id"));
                var props = cl.get_properties ();
                foreach (Property prop in props) {
-                       if (prop.set_accessor == null) {
+                       if (prop.set_accessor == null || prop.is_abstract) {
                                continue;
                        }
 
@@ -1537,9 +1537,7 @@ public class Vala.CodeGenerator : CodeVisitor {
        }
 
        public override void visit_end_property (Property! prop) {
-               if (!prop.is_abstract) {
-                       prop_enum.add_value (prop.get_upper_case_cname (), null);
-               }
+               prop_enum.add_value (prop.get_upper_case_cname (), null);
        }
 
        public override void visit_begin_property_accessor (PropertyAccessor! acc) {
index 91c8808..0e9dd4e 100644 (file)
@@ -219,7 +219,11 @@ public class Vala.Method : Member, Invokable {
        public virtual ref string! get_default_cname () {
                var parent = symbol.parent_symbol.node;
                if (parent is DataType) {
-                       return "%s%s".printf (((DataType) parent).get_lower_case_cprefix (), name);
+                       if (name.has_prefix ("_")) {
+                               return "_%s%s".printf (((DataType) parent).get_lower_case_cprefix (), name.offset (1));
+                       } else {
+                               return "%s%s".printf (((DataType) parent).get_lower_case_cprefix (), name);
+                       }
                } else if (parent is Namespace) {
                        return "%s%s".printf (((Namespace) parent).get_lower_case_cprefix (), name);
                } else {
index 29fd518..9336241 100644 (file)
@@ -295,7 +295,7 @@ public class Vala.SymbolBuilder : CodeVisitor {
                        
                        var prop = (Property) acc.symbol.parent_symbol.node;
                
-                       if (prop.interface_only || prop.symbol.parent_symbol.node is Interface) {
+                       if (prop.interface_only || prop.is_abstract) {
                                return;
                        }