]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
GASync: Do not declare async data struct too early
authorJürg Billeter <j@bitron.ch>
Tue, 27 Oct 2009 16:35:58 +0000 (17:35 +0100)
committerJürg Billeter <j@bitron.ch>
Tue, 27 Oct 2009 16:38:04 +0000 (17:38 +0100)
Async data struct declaration depends on declarations of local
variable types and thus must be appended after visiting the method
body.

Fixes bug 599767.

codegen/valagasyncmodule.vala

index a02f76f3555d99241a81135a82d9bbd794e48a02..3d6f9feddc7ebf7a15ea270e4088c5505f375991 100644 (file)
@@ -305,7 +305,6 @@ internal class Vala.GAsyncModule : GSignalModule {
 
                        if (!m.is_abstract) {
                                var data = generate_data_struct (m);
-                               append_struct (data);
 
                                append_function (generate_free_function (m));
                                source_type_member_definition.append (generate_async_function (m));
@@ -316,6 +315,10 @@ internal class Vala.GAsyncModule : GSignalModule {
                                closure_struct = data;
                                base.visit_method (m);
                                closure_struct = null;
+
+                               // only append data struct here to make sure all struct member
+                               // types are declared before the struct definition
+                               append_struct (data);
                        }
 
                        if (m.is_abstract || m.is_virtual) {