]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Fix C code generated for returns in closures in constructors
authorJürg Billeter <j@bitron.ch>
Thu, 11 Nov 2010 13:23:46 +0000 (14:23 +0100)
committerJürg Billeter <j@bitron.ch>
Thu, 11 Nov 2010 13:23:46 +0000 (14:23 +0100)
Fixes bug 634551.

codegen/valaccodebasemodule.vala

index 26437d2b962cf778fdc308ccdf2fd7fa2e8bcb36..89ab3cfdab4cf0a390d8f5b128cbadceadfc66cc 100644 (file)
@@ -131,6 +131,10 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
        }
 
        public bool is_in_constructor () {
+               if (current_method != null) {
+                       // make sure to not return true in lambda expression inside constructor
+                       return false;
+               }
                var sym = current_symbol;
                while (sym != null) {
                        if (sym is Constructor) {
@@ -142,6 +146,10 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
        }
 
        public bool is_in_destructor () {
+               if (current_method != null) {
+                       // make sure to not return true in lambda expression inside constructor
+                       return false;
+               }
                var sym = current_symbol;
                while (sym != null) {
                        if (sym is Destructor) {