[vala] codegen: Store array_null_terminated information into GLibValue



commit 8eb920394daa627882de1f7eec43dac2f42fafe5
Author: Luca Bruno <lucabru src gnome org>
Date:   Wed Mar 16 15:02:31 2011 +0100

    codegen: Store array_null_terminated information into GLibValue

 codegen/valaccodebasemodule.vala         |    8 ++++++++
 codegen/valaccodememberaccessmodule.vala |    3 +++
 2 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 64aebb8..867b35c 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -2983,6 +2983,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 		var value = new GLibValue (type, cvar);
 		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.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);
 		}
@@ -5988,6 +5989,11 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 		}
 		return glib_value.array_length_cvalues;
 	}
+
+	public bool get_array_null_terminated (TargetValue value) {
+		var glib_value = (GLibValue) value;
+		return glib_value.array_null_terminated;
+	}
 }
 
 public class Vala.GLibValue : TargetValue {
@@ -5995,6 +6001,7 @@ public class Vala.GLibValue : TargetValue {
 
 	public List<CCodeExpression> array_length_cvalues;
 	public CCodeExpression? array_size_cvalue;
+	public bool array_null_terminated;
 
 	public CCodeExpression? delegate_target_cvalue;
 	public CCodeExpression? delegate_target_destroy_notify_cvalue;
@@ -6020,6 +6027,7 @@ public class Vala.GLibValue : TargetValue {
 			}
 		}
 		result.array_size_cvalue = array_size_cvalue;
+		result.array_null_terminated = array_null_terminated;
 
 		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 2fb81fb..6c50e0f 100644
--- a/codegen/valaccodememberaccessmodule.vala
+++ b/codegen/valaccodememberaccessmodule.vala
@@ -340,6 +340,7 @@ 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;
@@ -394,6 +395,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
 	/* Returns access values to the given parameter */
 	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.captured || is_in_coroutine ()) {
 			result.value_type.value_owned = true;
 		}
@@ -503,6 +505,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
 		}
 
 		var result = new GLibValue (value_type);
+		result.array_null_terminated = field.array_null_terminated;
 
 		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]