]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Don't create duplicated complete-async code
authorRico Tzschichholz <ricotz@ubuntu.com>
Mon, 13 Feb 2017 16:30:29 +0000 (17:30 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Mon, 13 Feb 2017 16:30:29 +0000 (17:30 +0100)
Treat methods with non-void return-type special while they require a return
statement. This does not account for a trailing superfluous "return" which
will still trigger this code-duplication.

https://bugzilla.gnome.org/show_bug.cgi?id=778302

codegen/valaccodemethodmodule.vala

index 1f47af9c8045b884b60e9b6c5c98145db326f033..f28fe86d06d5e422c197d35fd003af7ddeaed0cb 100644 (file)
@@ -769,7 +769,8 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
                                        }
                                }
 
-                               if (m.coroutine) {
+                               // For non-void return-types GAsyncModule.visit_return_statement () will take care of this
+                               if (m.return_type is VoidType && m.coroutine) {
                                        // epilogue
                                        complete_async ();
                                }