[vala] codegen: Do not set accessor vfunc for NoAccessorMethod properties
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] codegen: Do not set accessor vfunc for NoAccessorMethod properties
- Date: Thu, 29 Sep 2011 20:33:18 +0000 (UTC)
commit 7e22d9f8237f29a98cf0648a628ae1841f23b3c2
Author: Luca Bruno <lucabru src gnome org>
Date: Thu Sep 1 16:43:48 2011 +0200
codegen: Do not set accessor vfunc for NoAccessorMethod properties
Partially fixes bug 658006.
codegen/valagtypemodule.vala | 56 ++++++++++++++++++++++-------------------
1 files changed, 30 insertions(+), 26 deletions(-)
---
diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala
index 99900c6..753d761 100644
--- a/codegen/valagtypemodule.vala
+++ b/codegen/valagtypemodule.vala
@@ -1250,13 +1250,15 @@ public class Vala.GTypeModule : GErrorModule {
var ccast = new CCodeFunctionCall (new CCodeIdentifier ("%s_CLASS".printf (get_ccode_upper_case_name (base_type))));
ccast.add_argument (new CCodeIdentifier ("klass"));
- if (prop.get_accessor != null) {
- string cname = CCodeBaseModule.get_ccode_real_name (prop.get_accessor);
- ccode.add_assignment (new CCodeMemberAccess.pointer (ccast, "get_%s".printf (prop.name)), new CCodeIdentifier (cname));
- }
- if (prop.set_accessor != null) {
- string cname = CCodeBaseModule.get_ccode_real_name (prop.set_accessor);
- ccode.add_assignment (new CCodeMemberAccess.pointer (ccast, "set_%s".printf (prop.name)), new CCodeIdentifier (cname));
+ if (!get_ccode_no_accessor_method (prop.base_property)) {
+ if (prop.get_accessor != null) {
+ string cname = CCodeBaseModule.get_ccode_real_name (prop.get_accessor);
+ ccode.add_assignment (new CCodeMemberAccess.pointer (ccast, "get_%s".printf (prop.name)), new CCodeIdentifier (cname));
+ }
+ if (prop.set_accessor != null) {
+ string cname = CCodeBaseModule.get_ccode_real_name (prop.set_accessor);
+ ccode.add_assignment (new CCodeMemberAccess.pointer (ccast, "set_%s".printf (prop.name)), new CCodeIdentifier (cname));
+ }
}
}
@@ -1371,29 +1373,31 @@ public class Vala.GTypeModule : GErrorModule {
var ciface = new CCodeIdentifier ("iface");
- if (prop.get_accessor != null) {
- string cname = CCodeBaseModule.get_ccode_real_name (prop.get_accessor);
- if (prop.is_abstract || prop.is_virtual) {
- cname = CCodeBaseModule.get_ccode_name (prop.get_accessor);
- }
+ if (!get_ccode_no_accessor_method (prop.base_interface_property)) {
+ if (prop.get_accessor != null) {
+ string cname = CCodeBaseModule.get_ccode_real_name (prop.get_accessor);
+ if (prop.is_abstract || prop.is_virtual) {
+ cname = CCodeBaseModule.get_ccode_name (prop.get_accessor);
+ }
- CCodeExpression cfunc = new CCodeIdentifier (cname);
- if (prop.is_abstract || prop.is_virtual) {
- cfunc = cast_property_accessor_pointer (prop.get_accessor, cfunc, base_type);
- }
- ccode.add_assignment (new CCodeMemberAccess.pointer (ciface, "get_%s".printf (prop.name)), cfunc);
- }
- if (prop.set_accessor != null) {
- string cname = CCodeBaseModule.get_ccode_real_name (prop.set_accessor);
- if (prop.is_abstract || prop.is_virtual) {
- cname = CCodeBaseModule.get_ccode_name (prop.set_accessor);
+ CCodeExpression cfunc = new CCodeIdentifier (cname);
+ if (prop.is_abstract || prop.is_virtual) {
+ cfunc = cast_property_accessor_pointer (prop.get_accessor, cfunc, base_type);
+ }
+ ccode.add_assignment (new CCodeMemberAccess.pointer (ciface, "get_%s".printf (prop.name)), cfunc);
}
+ if (prop.set_accessor != null) {
+ string cname = CCodeBaseModule.get_ccode_real_name (prop.set_accessor);
+ if (prop.is_abstract || prop.is_virtual) {
+ cname = CCodeBaseModule.get_ccode_name (prop.set_accessor);
+ }
- CCodeExpression cfunc = new CCodeIdentifier (cname);
- if (prop.is_abstract || prop.is_virtual) {
- cfunc = cast_property_accessor_pointer (prop.set_accessor, cfunc, base_type);
+ CCodeExpression cfunc = new CCodeIdentifier (cname);
+ if (prop.is_abstract || prop.is_virtual) {
+ cfunc = cast_property_accessor_pointer (prop.set_accessor, cfunc, base_type);
+ }
+ ccode.add_assignment (new CCodeMemberAccess.pointer (ciface, "set_%s".printf (prop.name)), cfunc);
}
- ccode.add_assignment (new CCodeMemberAccess.pointer (ciface, "set_%s".printf (prop.name)), cfunc);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]