]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Do not initialize temp variable when getting delegate property
authorLuca Bruno <lucabru@src.gnome.org>
Sat, 28 May 2011 07:30:52 +0000 (09:30 +0200)
committerLuca Bruno <lucabru@src.gnome.org>
Sat, 28 May 2011 07:34:47 +0000 (09:34 +0200)
Fixes bug 641182.

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

index 8dd8b2ff782ebb46f24acc2596a919172d509dcd..6f2478bdcc5a59289d7df60cc3d0afa03e95bfa0 100644 (file)
@@ -268,7 +268,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
                                        } else {
                                                delegate_type = base_property.property_type as DelegateType;
                                                if (delegate_type != null && delegate_type.delegate_symbol.has_target) {
-                                                       temp_var = get_temp_variable (new PointerType (new VoidType ()));
+                                                       temp_var = get_temp_variable (new PointerType (new VoidType ()), false, expr, false);
                                                        ctemp = get_variable_cexpression (temp_var.name);
                                                        emit_temp_var (temp_var);
                                                        ccall.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, ctemp));
index b02a449f4291fa06e3f7fb57a2afe4143bf248bf..91b8c752c7dfa083e70fcfebf9230634aeef66a6 100644 (file)
@@ -104,6 +104,7 @@ TESTS = \
        asynchronous/bug613484.vala \
        asynchronous/bug620740.vala \
        asynchronous/bug639591.vala \
+       asynchronous/bug641182.vala \
        asynchronous/bug646945.vala \
        asynchronous/closures.vala \
        dbus/basic-types.test \
diff --git a/tests/asynchronous/bug641182.vala b/tests/asynchronous/bug641182.vala
new file mode 100644 (file)
index 0000000..af7e396
--- /dev/null
@@ -0,0 +1,16 @@
+public delegate void Bar ();
+
+class Foo {
+        public Bar bar { get; set; }
+}
+
+async void test () {
+        var foo = new Foo ();
+        var i = 0;
+        foo.bar = () => { i++; };
+        foo.bar ();
+}
+
+void main() {
+        test ();
+}