[vala] Fix return without value for preconditions in constructors



commit efa9f941479c0b744eca30bf67c617c4838af51d
Author: Jürg Billeter <j bitron ch>
Date:   Wed Jan 20 09:49:02 2010 +0100

    Fix return without value for preconditions in constructors

 codegen/valaccodemethodmodule.vala |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/codegen/valaccodemethodmodule.vala b/codegen/valaccodemethodmodule.vala
index b2c28ef..e83eb84 100644
--- a/codegen/valaccodemethodmodule.vala
+++ b/codegen/valaccodemethodmodule.vala
@@ -1034,7 +1034,10 @@ internal class Vala.CCodeMethodModule : CCodeStructModule {
 
 		ccheck.add_argument ((CCodeExpression) precondition.ccodenode);
 
-		if (ret_type is VoidType) {
+		if (method_node is CreationMethod) {
+			ccheck.call = new CCodeIdentifier ("g_return_val_if_fail");
+			ccheck.add_argument (new CCodeConstant ("NULL"));
+		} else if (ret_type is VoidType) {
 			/* void function */
 			ccheck.call = new CCodeIdentifier ("g_return_if_fail");
 		} else {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]