]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Fix static property access in instance methods
authorJürg Billeter <j@bitron.ch>
Wed, 28 Oct 2009 14:18:54 +0000 (15:18 +0100)
committerJürg Billeter <j@bitron.ch>
Wed, 28 Oct 2009 14:18:54 +0000 (15:18 +0100)
Fixes bug 599892.

codegen/valaccodememberaccessmodule.vala
tests/Makefile.am
tests/methods/bug599892.vala [new file with mode: 0644]

index 3768b3b2dfc4af7c0118a5babe5b2294a41bd556..c6d9e2fb5bd4c93e875c5903262bb4b06bf390be 100644 (file)
@@ -220,7 +220,8 @@ internal class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
                                }
                        }
 
-                       if (prop.get_accessor.automatic_body &&
+                       if (prop.binding == MemberBinding.INSTANCE &&
+                           prop.get_accessor.automatic_body &&
                            current_type_symbol == prop.parent_symbol &&
                            prop.base_property == null &&
                            prop.base_interface_property == null &&
index 012da55766f3e041d4e0431ac3dacd56257f1fb7..fa289a392566d33424717815c510201346ae32a8 100644 (file)
@@ -30,6 +30,7 @@ TESTS = \
        methods/bug596726.vala \
        methods/bug597426.vala \
        methods/bug598738.vala \
+       methods/bug599892.vala \
        control-flow/break.vala \
        control-flow/expressions-conditional.vala \
        control-flow/for.vala \
diff --git a/tests/methods/bug599892.vala b/tests/methods/bug599892.vala
new file mode 100644 (file)
index 0000000..c1aea47
--- /dev/null
@@ -0,0 +1,14 @@
+class Foo {
+       public static int bar { get; set; }
+
+       public void do_foo () {
+               int i = 42;
+               bar = i;
+               assert (bar == 42);
+       }
+}
+
+void main () {
+       var foo = new Foo ();
+       foo.do_foo ();
+}