[vala] codegen: Use builder API for dup0 functions



commit f2965311d5dedf28716c1d04eb9fe5a288002824
Author: Jürg Billeter <j bitron ch>
Date:   Sun Oct 10 11:58:16 2010 +0200

    codegen: Use builder API for dup0 functions

 codegen/valaccodebasemodule.vala |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 2d1aa31..d6cd20a 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -3680,12 +3680,15 @@ public class Vala.CCodeBaseModule : CodeGenerator {
 				var dup0_fun = new CCodeFunction (dup0_func, pointer_cname);
 				dup0_fun.add_parameter (new CCodeFormalParameter ("self", pointer_cname));
 				dup0_fun.modifiers = CCodeModifiers.STATIC;
-				dup0_fun.block = new CCodeBlock ();
+
+				push_function (dup0_fun);
 
 				var dup_call = new CCodeFunctionCall (dupexpr);
 				dup_call.add_argument (new CCodeIdentifier ("self"));
 
-				dup0_fun.block.add_statement (new CCodeReturnStatement (new CCodeConditionalExpression (new CCodeIdentifier ("self"), dup_call, new CCodeConstant ("NULL"))));
+				ccode.add_return (new CCodeConditionalExpression (new CCodeIdentifier ("self"), dup_call, new CCodeConstant ("NULL")));
+
+				pop_function ();
 
 				cfile.add_function (dup0_fun);
 			}



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