From: Jürg Billeter Date: Thu, 11 Nov 2010 13:23:46 +0000 (+0100) Subject: codegen: Fix C code generated for returns in closures in constructors X-Git-Tag: 0.11.3~77 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d770a14f2dda8488e6cc03a674c990ec2908dd07;p=thirdparty%2Fvala.git codegen: Fix C code generated for returns in closures in constructors Fixes bug 634551. --- diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala index 26437d2b9..89ab3cfda 100644 --- a/codegen/valaccodebasemodule.vala +++ b/codegen/valaccodebasemodule.vala @@ -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) {