Commit 813b94f9 authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter

some fixes for abstract properties improve default cname

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
parent 3c28e23a
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
......
......@@ -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) {
......
......@@ -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 {
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment