[vala/wip/issue/1121: 2/2] vala: Don't allow assigning GtkChild fields/properties
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/issue/1121: 2/2] vala: Don't allow assigning GtkChild fields/properties
- Date: Sat, 16 Jan 2021 11:22:41 +0000 (UTC)
commit 2cc0781d5906ecffc5a31b4bcb702dea5badd1e5
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sat Jan 16 10:05:30 2021 +0100
vala: Don't allow assigning GtkChild fields/properties
These are handled exclusively by GtkBuilder
See https://gitlab.gnome.org/GNOME/vala/issues/1121
vala/valaassignment.vala | 6 ++++++
vala/valaproperty.vala | 7 ++++++-
2 files changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/vala/valaassignment.vala b/vala/valaassignment.vala
index 79090ad9b..4ffc75735 100644
--- a/vala/valaassignment.vala
+++ b/vala/valaassignment.vala
@@ -178,6 +178,12 @@ public class Vala.Assignment : Expression {
return false;
}
+ if (ma.symbol_reference.get_attribute ("GtkChild") != null) {
+ error = true;
+ Report.error (source_reference, "Assignment of [GtkChild] `%s' is not
allowed", ma.symbol_reference.get_full_name ());
+ return false;
+ }
+
if (ma.symbol_reference is DynamicProperty) {
// target_type not available for dynamic properties
} else {
diff --git a/vala/valaproperty.vala b/vala/valaproperty.vala
index 2fc1b4d60..163a1bb0a 100644
--- a/vala/valaproperty.vala
+++ b/vala/valaproperty.vala
@@ -492,7 +492,12 @@ public class Vala.Property : Symbol, Lockable {
get_accessor.check (context);
}
if (set_accessor != null) {
- set_accessor.check (context);
+ if (get_attribute ("GtkChild") != null) {
+ Report.warning (set_accessor.source_reference, "[GtkChild] property `%s' is
not allowed to have `set' accessor", get_full_name ());
+ set_accessor = null;
+ } else {
+ set_accessor.check (context);
+ }
}
if (initializer != null && field == null && !is_abstract) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]