[vala/0.42] vala: Don't emit member access of assignments on static properties
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.42] vala: Don't emit member access of assignments on static properties
- Date: Thu, 6 Dec 2018 11:27:29 +0000 (UTC)
commit be15a49ecf62236271af88d62f213c634009ee65
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Wed Nov 28 13:53:29 2018 +0100
vala: Don't emit member access of assignments on static properties
Fixes https://gitlab.gnome.org/GNOME/vala/issues/573
tests/Makefile.am | 1 +
tests/objects/property-static.vala | 41 ++++++++++++++++++++++++++++++++++++++
vala/valaassignment.vala | 2 +-
3 files changed, 43 insertions(+), 1 deletion(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index e2d6ca276..135428889 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -264,6 +264,7 @@ TESTS = \
objects/properties.vala \
objects/property-notify.vala \
objects/property-read-only-auto.vala \
+ objects/property-static.vala \
objects/regex.vala \
objects/signals.vala \
objects/signals-delegate.vala \
diff --git a/tests/objects/property-static.vala b/tests/objects/property-static.vala
new file mode 100644
index 000000000..b5596bd6b
--- /dev/null
+++ b/tests/objects/property-static.vala
@@ -0,0 +1,41 @@
+class Foo {
+ static int _bar;
+ static int _baz;
+
+ public static int bar {
+ get { assert_not_reached (); }
+ set { _bar = value; assert (_bar == 23); }
+ }
+
+ public static int baz {
+ set { _baz = value; assert (_baz == 42); }
+ }
+
+ public static int boo { set; }
+}
+
+struct Bar {
+ static int _bar;
+ static int _baz;
+
+ public static int bar {
+ get { assert_not_reached (); }
+ set { _bar = value; assert (_bar == 23); }
+ }
+
+ public static int baz {
+ set { _baz = value; assert (_baz == 42); }
+ }
+
+ public static int boo { set; }
+}
+
+void main () {
+ Foo.bar = 23;
+ Foo.baz = 42;
+ Foo.boo = 4711;
+
+ Bar.bar = 23;
+ Bar.baz = 42;
+ Bar.boo = 4711;
+}
diff --git a/vala/valaassignment.vala b/vala/valaassignment.vala
index af12f1754..08e3fa49b 100644
--- a/vala/valaassignment.vala
+++ b/vala/valaassignment.vala
@@ -533,7 +533,7 @@ public class Vala.Assignment : Expression {
if (instance && ma.inner != null && property != null) {
ma.inner.emit (codegen);
- } else {
+ } else if (property == null) {
// always process full lvalue
// current codegen depends on it
// should be removed when moving codegen from
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]