[vala] codegen: Use append_array_size for reference transfer expressions
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] codegen: Use append_array_size for reference transfer expressions
- Date: Mon, 18 Oct 2010 08:05:07 +0000 (UTC)
commit 1fe73849db172a30d8933a2e4ae9d6a92c02684a
Author: Jürg Billeter <j bitron ch>
Date: Sun Oct 17 17:36:02 2010 +0200
codegen: Use append_array_size for reference transfer expressions
codegen/valaccodearraymodule.vala | 3 ---
codegen/valaccodebasemodule.vala | 16 ++++++++++++++++
codegen/valaccodedelegatemodule.vala | 5 -----
3 files changed, 16 insertions(+), 8 deletions(-)
---
diff --git a/codegen/valaccodearraymodule.vala b/codegen/valaccodearraymodule.vala
index 14f0aaf..e57793e 100644
--- a/codegen/valaccodearraymodule.vala
+++ b/codegen/valaccodearraymodule.vala
@@ -161,9 +161,6 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
if (unary_expr.operator == UnaryOperator.OUT || unary_expr.operator == UnaryOperator.REF) {
is_out = true;
}
- } else if (array_expr is ReferenceTransferExpression) {
- var reftransfer_expr = (ReferenceTransferExpression) array_expr;
- array_expr = reftransfer_expr.inner;
}
List<CCodeExpression> size = get_array_sizes (array_expr);
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index c5b1eb9..f5a55a1 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -4611,6 +4611,22 @@ public class Vala.CCodeBaseModule : CodeGenerator {
ccode.add_expression (new CCodeAssignment (get_cvalue (expr.inner), new CCodeConstant ("NULL")));
set_cvalue (expr, cvar);
+
+ var array_type = expr.value_type as ArrayType;
+ if (array_type != null) {
+ for (int dim = 1; dim <= array_type.rank; dim++) {
+ append_array_size (expr, get_array_length_cexpression (expr.inner, dim));
+ }
+ }
+
+ var delegate_type = expr.value_type as DelegateType;
+ if (delegate_type != null && delegate_type.delegate_symbol.has_target) {
+ CCodeExpression target_destroy_notify;
+ set_delegate_target (expr, get_delegate_target_cexpression (expr.inner, out target_destroy_notify));
+ if (target_destroy_notify != null) {
+ set_delegate_target_destroy_notify (expr, target_destroy_notify);
+ }
+ }
}
public override void visit_binary_expression (BinaryExpression expr) {
diff --git a/codegen/valaccodedelegatemodule.vala b/codegen/valaccodedelegatemodule.vala
index c1259c4..86734f2 100644
--- a/codegen/valaccodedelegatemodule.vala
+++ b/codegen/valaccodedelegatemodule.vala
@@ -131,11 +131,6 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
public override CCodeExpression get_delegate_target_cexpression (Expression delegate_expr, out CCodeExpression delegate_target_destroy_notify) {
delegate_target_destroy_notify = new CCodeConstant ("NULL");
- if (delegate_expr is ReferenceTransferExpression) {
- var reftransfer_expr = (ReferenceTransferExpression) delegate_expr;
- delegate_expr = reftransfer_expr.inner;
- }
-
if (get_delegate_target_destroy_notify (delegate_expr) != null) {
delegate_target_destroy_notify = get_delegate_target_destroy_notify (delegate_expr);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]