Commit 316765b7 authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter
Browse files

correct invocation of setter method of inherited properties, fixes bug

2007-06-05  Jürg Billeter  <j@bitron.ch>

	* gobject/valacodegeneratorassignment.vala: correct invocation of setter
	  method of inherited properties, fixes bug 443527
	* gobject/valacodegeneratormemberaccess.vala: remove outdated comment

svn path=/trunk/; revision=320
parent 4b4798f1
2007-06-05 Jürg Billeter <j@bitron.ch>
* gobject/valacodegeneratorassignment.vala: correct invocation of setter
method of inherited properties, fixes bug 443527
* gobject/valacodegeneratormemberaccess.vala: remove outdated comment
2007-06-05 Jürg Billeter <j@bitron.ch>
* vala/valainvocationexpression.vala: support storing sizes of array
......
......@@ -261,8 +261,15 @@ public class Vala.CodeGenerator {
var cl = (Class) prop.symbol.parent_symbol.node;
var set_func = "g_object_set";
var base_property = prop;
if (!prop.no_accessor_method) {
set_func = "%s_set_%s".printf (cl.get_lower_case_cname (null), prop.name);
if (prop.base_property != null) {
base_property = prop.base_property;
} else if (prop.base_interface_property != null) {
base_property = prop.base_interface_property;
}
var base_property_type = (DataType) base_property.symbol.parent_symbol.node;
set_func = "%s_set_%s".printf (base_property_type.get_lower_case_cname (null), base_property.name);
}
var ccall = new CCodeFunctionCall (new CCodeIdentifier (set_func));
......@@ -274,16 +281,16 @@ public class Vala.CodeGenerator {
if (ma.inner == null) {
instance = new CCodeIdentifier ("self");
/* require casts for inherited properties */
req_cast = (prop.symbol.parent_symbol != current_type_symbol);
req_cast = (base_property.symbol.parent_symbol != current_type_symbol);
} else {
instance = (CCodeExpression) ma.inner.ccodenode;
/* require casts if the type of the used instance is
* different than the type which declared the property */
req_cast = prop.symbol.parent_symbol.node != ma.inner.static_type.data_type;
req_cast = base_property.symbol.parent_symbol.node != ma.inner.static_type.data_type;
}
if (req_cast && ((DataType) prop.symbol.parent_symbol.node).is_reference_type ()) {
var ccast = new CCodeFunctionCall (new CCodeIdentifier (((DataType) prop.symbol.parent_symbol.node).get_upper_case_cname (null)));
var ccast = new CCodeFunctionCall (new CCodeIdentifier (((DataType) base_property.symbol.parent_symbol.node).get_upper_case_cname (null)));
ccast.add_argument (instance);
instance = ccast;
}
......
......@@ -95,10 +95,7 @@ public class Vala.CodeGenerator {
var base_property_type = (DataType) base_property.symbol.parent_symbol.node;
var ccall = new CCodeFunctionCall (new CCodeIdentifier ("%s_get_%s".printf (base_property_type.get_lower_case_cname (null), base_property.name)));
/* explicitly use strong reference as ccast
* gets unrefed at the end of the inner block
*/
ref CCodeExpression typed_pub_inst = pub_inst;
CCodeExpression typed_pub_inst = pub_inst;
/* cast if necessary */
if (base_property_type != base_type) {
......
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