[vala/0.12] codegen: Do not initialize temp variable when getting delegate property



commit bcc80151eefaefab1d927878f9e6932bb3d11308
Author: Luca Bruno <lucabru src gnome org>
Date:   Sat May 28 09:30:52 2011 +0200

    codegen: Do not initialize temp variable when getting delegate property
    
    Fixes bug 641182.

 codegen/valaccodememberaccessmodule.vala |    2 +-
 tests/Makefile.am                        |    1 +
 tests/asynchronous/bug641182.vala        |   16 ++++++++++++++++
 3 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/codegen/valaccodememberaccessmodule.vala b/codegen/valaccodememberaccessmodule.vala
index 6d7e581..199f9d4 100644
--- a/codegen/valaccodememberaccessmodule.vala
+++ b/codegen/valaccodememberaccessmodule.vala
@@ -264,7 +264,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));
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 723baa8..4826795 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -98,6 +98,7 @@ TESTS = \
 	asynchronous/bug613484.vala \
 	asynchronous/bug620740.vala \
 	asynchronous/bug639591.vala \
+	asynchronous/bug641182.vala \
 	asynchronous/closures.vala \
 	dbus/basic-types.test \
 	dbus/arrays.test \
diff --git a/tests/asynchronous/bug641182.vala b/tests/asynchronous/bug641182.vala
new file mode 100644
index 0000000..af7e396
--- /dev/null
+++ b/tests/asynchronous/bug641182.vala
@@ -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 ();
+}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]