[vala/emit-let] codegen: Store ArrayType related information into GLibValue



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

    codegen: Store ArrayType related information into GLibValue

 codegen/valaccodebasemodule.vala         |   21 +++++++++++++++++++++
 codegen/valaccodememberaccessmodule.vala |    9 +++++++++
 2 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index fe12da3..a25b5fc 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -2976,6 +2976,9 @@ 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.no_array_length = ((GLibValue) expr.target_value).no_array_length;
+			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);
 		}
@@ -5985,6 +5988,21 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 		}
 		return glib_value.array_length_cvalues;
 	}
+
+	public bool get_no_array_length (TargetValue value) {
+		var glib_value = (GLibValue) value;
+		return glib_value.no_array_length;
+	}
+
+	public bool get_array_null_terminated (TargetValue value) {
+		var glib_value = (GLibValue) value;
+		return glib_value.array_null_terminated;
+	}
+
+	public string? get_array_length_cexpr (TargetValue value) {
+		var glib_value = (GLibValue) value;
+		return glib_value.array_length_cexpr;
+	}
 }
 
 public class Vala.GLibValue : TargetValue {
@@ -5992,6 +6010,9 @@ public class Vala.GLibValue : TargetValue {
 
 	public List<CCodeExpression> array_length_cvalues;
 	public CCodeExpression? array_size_cvalue;
+	public bool no_array_length;
+	public bool array_null_terminated;
+	public string? array_length_cexpr;
 
 	public CCodeExpression? delegate_target_cvalue;
 	public CCodeExpression? delegate_target_destroy_notify_cvalue;
diff --git a/codegen/valaccodememberaccessmodule.vala b/codegen/valaccodememberaccessmodule.vala
index 17c9719..2a7cdb4 100644
--- a/codegen/valaccodememberaccessmodule.vala
+++ b/codegen/valaccodememberaccessmodule.vala
@@ -340,6 +340,9 @@ 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.no_array_length = local.no_array_length;
+		result.array_null_terminated = local.array_null_terminated;
+		result.array_length_cexpr = local.get_array_length_cexpr ();
 
 		var array_type = local.variable_type as ArrayType;
 		var delegate_type = local.variable_type as DelegateType;
@@ -394,6 +397,9 @@ 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.no_array_length = param.no_array_length;
+		result.array_null_terminated = param.array_null_terminated;
+		result.array_length_cexpr = param.get_array_length_cexpr ();
 		if (param.captured || is_in_coroutine ()) {
 			result.value_type.value_owned = true;
 		}
@@ -498,6 +504,9 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
 	/* Returns lvalue access to the given field */
 	public override TargetValue get_field_cvalue (Field field, TargetValue? instance) {
 		var result = new GLibValue (field.variable_type.copy ());
+		result.no_array_length = field.no_array_length;
+		result.array_null_terminated = field.array_null_terminated;
+		result.array_length_cexpr = field.get_array_length_cexpr ();
 
 		var array_type = field.variable_type as ArrayType;
 		var delegate_type = field.variable_type as DelegateType;



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