[vala] codegen: Use builder API for struct copy function
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] codegen: Use builder API for struct copy function
- Date: Sun, 10 Oct 2010 16:39:48 +0000 (UTC)
commit 52395cb3c894b8be53fe7c5d225f45dd5376d869
Author: Jürg Billeter <j bitron ch>
Date: Sun Oct 10 12:07:39 2010 +0200
codegen: Use builder API for struct copy function
codegen/valaccodebasemodule.vala | 14 +++++---------
1 files changed, 5 insertions(+), 9 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 22b95a4..baf58a6 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -5492,10 +5492,7 @@ public class Vala.CCodeBaseModule : CodeGenerator {
function.add_parameter (new CCodeFormalParameter ("dest", st.get_cname () + "*"));
push_context (new EmitContext ());
-
- var cblock = new CCodeBlock ();
- var cfrag = new CCodeFragment ();
- cblock.add_statement (cfrag);
+ push_function (function);
foreach (Field f in st.get_fields ()) {
if (f.binding == MemberBinding.INSTANCE) {
@@ -5525,25 +5522,24 @@ public class Vala.CCodeBaseModule : CodeGenerator {
array_copy_call.add_argument (dest);
array_copy_call.add_argument (copy);
array_copy_call.add_argument (size);
- cblock.add_statement (new CCodeExpressionStatement (array_copy_call));
+ ccode.add_expression (array_copy_call);
} else {
- cblock.add_statement (new CCodeExpressionStatement (new CCodeAssignment (dest, copy)));
+ ccode.add_expression (new CCodeAssignment (dest, copy));
if (array_type != null && !f.no_array_length) {
for (int dim = 1; dim <= array_type.rank; dim++) {
var len_src = new CCodeMemberAccess.pointer (new CCodeIdentifier ("self"), get_array_length_cname (f.name, dim));
var len_dest = new CCodeMemberAccess.pointer (new CCodeIdentifier ("dest"), get_array_length_cname (f.name, dim));
- cblock.add_statement (new CCodeExpressionStatement (new CCodeAssignment (len_dest, len_src)));
+ ccode.add_expression (new CCodeAssignment (len_dest, len_src));
}
}
}
}
}
+ pop_function ();
pop_context ();
- function.block = cblock;
-
cfile.add_function_declaration (function);
cfile.add_function (function);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]