[vala] codegen: Add array_length_cexpr in GLibValue



commit 29dee9bb21c46011446aeb8ed9006a97c19174b4
Author: Luca Bruno <lucabru src gnome org>
Date:   Wed May 4 10:46:36 2011 +0200

    codegen: Add array_length_cexpr in GLibValue

 codegen/valaccodebasemodule.vala         |    9 +++++++++
 codegen/valaccodememberaccessmodule.vala |    7 ++++++-
 2 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index ecf6522..bcf748b 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -2968,6 +2968,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 		if (expr != null && expr.target_value != null) {
 			value.array_length_cvalues = ((GLibValue) expr.target_value).array_length_cvalues;
 			value.array_null_terminated = ((GLibValue) expr.target_value).array_null_terminated;
+			value.array_length_cexpr = ((GLibValue) expr.target_value).array_length_cexpr;
 			value.delegate_target_cvalue = get_delegate_target_cvalue (expr.target_value);
 			value.delegate_target_destroy_notify_cvalue = get_delegate_target_destroy_notify_cvalue (expr.target_value);
 		}
@@ -3847,6 +3848,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 		if (expr != null && expr.target_value != null) {
 			value.array_length_cvalues = ((GLibValue) expr.target_value).array_length_cvalues;
 			value.array_null_terminated = ((GLibValue) expr.target_value).array_null_terminated;
+			value.array_length_cexpr = ((GLibValue) expr.target_value).array_length_cexpr;
 			value.delegate_target_cvalue = get_delegate_target_cvalue (expr.target_value);
 			value.delegate_target_destroy_notify_cvalue = get_delegate_target_destroy_notify_cvalue (expr.target_value);
 		}
@@ -5993,6 +5995,11 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 		var glib_value = (GLibValue) value;
 		return glib_value.array_null_terminated;
 	}
+
+	public CCodeExpression get_array_length_cexpr (TargetValue value) {
+		var glib_value = (GLibValue) value;
+		return glib_value.array_length_cexpr;
+	}
 }
 
 public class Vala.GLibValue : TargetValue {
@@ -6001,6 +6008,7 @@ public class Vala.GLibValue : TargetValue {
 	public List<CCodeExpression> array_length_cvalues;
 	public CCodeExpression? array_size_cvalue;
 	public bool array_null_terminated;
+	public CCodeExpression? array_length_cexpr;
 
 	public CCodeExpression? delegate_target_cvalue;
 	public CCodeExpression? delegate_target_destroy_notify_cvalue;
@@ -6027,6 +6035,7 @@ public class Vala.GLibValue : TargetValue {
 		}
 		result.array_size_cvalue = array_size_cvalue;
 		result.array_null_terminated = array_null_terminated;
+		result.array_length_cexpr = array_length_cexpr;
 
 		result.delegate_target_cvalue = delegate_target_cvalue;
 		result.delegate_target_destroy_notify_cvalue = delegate_target_destroy_notify_cvalue;
diff --git a/codegen/valaccodememberaccessmodule.vala b/codegen/valaccodememberaccessmodule.vala
index 6c50e0f..fb8ed35 100644
--- a/codegen/valaccodememberaccessmodule.vala
+++ b/codegen/valaccodememberaccessmodule.vala
@@ -340,7 +340,6 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
 	/* Returns lvalue access to the given local variable */
 	public override TargetValue get_local_cvalue (LocalVariable local) {
 		var result = new GLibValue (local.variable_type.copy ());
-		result.array_null_terminated = local.array_null_terminated;
 
 		var array_type = local.variable_type as ArrayType;
 		var delegate_type = local.variable_type as DelegateType;
@@ -396,6 +395,9 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
 	public override TargetValue get_parameter_cvalue (Parameter param) {
 		var result = new GLibValue (param.variable_type.copy ());
 		result.array_null_terminated = param.array_null_terminated;
+		if (param.has_array_length_cexpr) {
+			result.array_length_cexpr = new CCodeConstant (param.get_array_length_cexpr ());
+		}
 		if (param.captured || is_in_coroutine ()) {
 			result.value_type.value_owned = true;
 		}
@@ -506,6 +508,9 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
 
 		var result = new GLibValue (value_type);
 		result.array_null_terminated = field.array_null_terminated;
+		if (field.has_array_length_cexpr) {
+			result.array_length_cexpr = new CCodeConstant (field.get_array_length_cexpr ());
+		}
 
 		var array_type = result.value_type as ArrayType;
 		var delegate_type = result.value_type as DelegateType;



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