]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Use builder API for dup0 functions
authorJürg Billeter <j@bitron.ch>
Sun, 10 Oct 2010 09:58:16 +0000 (11:58 +0200)
committerJürg Billeter <j@bitron.ch>
Sun, 10 Oct 2010 09:58:16 +0000 (11:58 +0200)
codegen/valaccodebasemodule.vala

index 2d1aa31f31a3c17625ed9990cf3a42b883d51125..d6cd20a36a551de582b6d74b577d6f3e49a002e8 100644 (file)
@@ -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);
                        }