]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
GAsync: Fix capturing type parameters in async methods
authorLuca Bruno <lucabru@src.gnome.org>
Sun, 10 Jul 2011 12:02:36 +0000 (14:02 +0200)
committerLuca Bruno <lucabru@src.gnome.org>
Sun, 10 Jul 2011 12:03:39 +0000 (14:03 +0200)
Fixes bug 654337.

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

index 92f0274c96a3ba6a286ced2d5bf4202500a88d03..cc3efcdc0f80347c565edb4d722ea3b8f19aceb2 100644 (file)
@@ -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));
                                        }
                                }
                        }
index 75eaf17dca02e94154df281b8ec472b8c29e81e6..7bc47e4f3aa851c5b8b142e63b5e71be374844ed 100644 (file)
@@ -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 (file)
index 0000000..227a816
--- /dev/null
@@ -0,0 +1,6 @@
+async void foo<T>() {
+    SourceFunc c = () => foo.callback ();
+}
+
+void main() {
+}