summaryrefslogtreecommitdiff
path: root/vala
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2021-01-16 17:11:14 +0100
committerRico Tzschichholz <ricotz@ubuntu.com>2021-01-17 13:11:08 +0100
commit6e7be51cb5455e9c5c721d4ba5121a6ab04673dd (patch)
tree5ffbed98ce6ab8a0e1e501a763a34ae3a84bdaf3 /vala
parentf78932e3dbcdba5660800b816e7dc8752771f0d5 (diff)
downloadvala-6e7be51cb5455e9c5c721d4ba5121a6ab04673dd.tar.gz
vala: Don't allow assigning GtkChild fields/properties
These are handled exclusively by GtkBuilder See https://gitlab.gnome.org/GNOME/vala/issues/1121
Diffstat (limited to 'vala')
-rw-r--r--vala/valaassignment.vala6
-rw-r--r--vala/valaproperty.vala3
-rw-r--r--vala/valaunaryexpression.vala5
3 files changed, 14 insertions, 0 deletions
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..0a2e437d5 100644
--- a/vala/valaproperty.vala
+++ b/vala/valaproperty.vala
@@ -492,6 +492,9 @@ public class Vala.Property : Symbol, Lockable {
get_accessor.check (context);
}
if (set_accessor != null) {
+ 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.check (context);
}
diff --git a/vala/valaunaryexpression.vala b/vala/valaunaryexpression.vala
index 76c31cd7a..4bf6d4bc4 100644
--- a/vala/valaunaryexpression.vala
+++ b/vala/valaunaryexpression.vala
@@ -229,6 +229,11 @@ public class Vala.UnaryExpression : Expression {
Report.error (source_reference, "ref and out method arguments can only be used with fields, parameters, local variables, and array element access");
return false;
}
+ if (inner.symbol_reference.get_attribute ("GtkChild") != null) {
+ error = true;
+ Report.error (source_reference, "Assignment of [GtkChild] `%s' is not allowed", inner.symbol_reference.get_full_name ());
+ return false;
+ }
break;
default:
error = true;