[vala] GAsync: Fix capturing type parameters in async methods



commit 2fa23f280466366c33f14c36bb7803c87892f79f
Author: Luca Bruno <lucabru src gnome org>
Date:   Sun Jul 10 14:02:36 2011 +0200

    GAsync: Fix capturing type parameters in async methods
    
    Fixes bug 654337.

 codegen/valaccodebasemodule.vala  |    6 +++---
 tests/Makefile.am                 |    1 +
 tests/asynchronous/bug654337.vala |    6 ++++++
 3 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 92f0274..cc3efcd 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -1780,13 +1780,13 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 						string func_name;
 
 						func_name = "%s_type".printf (type_param.name.down ());
-						ccode.add_assignment (new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), func_name), new CCodeIdentifier (func_name));
+						ccode.add_assignment (new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), func_name), get_variable_cexpression (func_name));
 
 						func_name = "%s_dup_func".printf (type_param.name.down ());
-						ccode.add_assignment (new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), func_name), new CCodeIdentifier (func_name));
+						ccode.add_assignment (new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), func_name), get_variable_cexpression (func_name));
 
 						func_name = "%s_destroy_func".printf (type_param.name.down ());
-						ccode.add_assignment (new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), func_name), new CCodeIdentifier (func_name));
+						ccode.add_assignment (new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), func_name), get_variable_cexpression (func_name));
 					}
 				}
 			}
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 75eaf17..7bc47e4 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -126,6 +126,7 @@ TESTS = \
 	asynchronous/bug652252.vala \
 	asynchronous/bug653861.vala \
 	asynchronous/bug654336.vala \
+	asynchronous/bug654337.vala \
 	asynchronous/closures.vala \
 	dbus/basic-types.test \
 	dbus/arrays.test \
diff --git a/tests/asynchronous/bug654337.vala b/tests/asynchronous/bug654337.vala
new file mode 100644
index 0000000..227a816
--- /dev/null
+++ b/tests/asynchronous/bug654337.vala
@@ -0,0 +1,6 @@
+async void foo<T>() {
+    SourceFunc c = () => foo.callback ();
+}
+
+void main() {
+}



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