vala r1387 - in trunk: . gobject vala



Author: juergbi
Date: Tue May 13 08:28:59 2008
New Revision: 1387
URL: http://svn.gnome.org/viewvc/vala?rev=1387&view=rev

Log:
2008-05-13  Juerg Billeter  <j bitron ch>

	* vala/valaarraytype.vala:
	* vala/valafield.vala:
	* vala/valainterfacewriter.vala:
	* vala/valamemorymanager.vala:
	* vala/valasemanticanalyzer.vala:
	* gobject/valaccodegenerator.vala:
	* gobject/valaccodememberaccessbinding.vala:

	Rename Field.type_reference to Field.field_type


Modified:
   trunk/ChangeLog
   trunk/gobject/valaccodegenerator.vala
   trunk/gobject/valaccodememberaccessbinding.vala
   trunk/vala/valaarraytype.vala
   trunk/vala/valafield.vala
   trunk/vala/valainterfacewriter.vala
   trunk/vala/valamemorymanager.vala
   trunk/vala/valasemanticanalyzer.vala

Modified: trunk/gobject/valaccodegenerator.vala
==============================================================================
--- trunk/gobject/valaccodegenerator.vala	(original)
+++ trunk/gobject/valaccodegenerator.vala	Tue May 13 08:28:59 2008
@@ -515,7 +515,7 @@
 		CCodeExpression lhs = null;
 		CCodeStruct st = null;
 		
-		string field_ctype = f.type_reference.get_cname ();
+		string field_ctype = f.field_type.get_cname ();
 		if (f.is_volatile) {
 			field_ctype = "volatile " + field_ctype;
 		}
@@ -534,7 +534,7 @@
 				header_type_member_declaration.append (cdecl);
 
 				var var_decl = new CCodeVariableDeclarator (f.get_cname ());
-				var_decl.initializer = default_value_for_type (f.type_reference, true);
+				var_decl.initializer = default_value_for_type (f.field_type, true);
 
 				if (f.initializer != null) {
 					var init = (CCodeExpression) f.initializer.ccodenode;
@@ -578,17 +578,17 @@
 
 		if (f.binding == MemberBinding.INSTANCE)  {
 			st.add_field (field_ctype, f.get_cname ());
-			if (f.type_reference is ArrayType && !f.no_array_length) {
+			if (f.field_type is ArrayType && !f.no_array_length) {
 				// create fields to store array dimensions
-				var array_type = (ArrayType) f.type_reference;
+				var array_type = (ArrayType) f.field_type;
 				
 				for (int dim = 1; dim <= array_type.rank; dim++) {
 					var len_type = int_type.copy ();
 
 					st.add_field (len_type.get_cname (), get_array_length_cname (f.name, dim));
 				}
-			} else if (f.type_reference is DelegateType) {
-				var delegate_type = (DelegateType) f.type_reference;
+			} else if (f.field_type is DelegateType) {
+				var delegate_type = (DelegateType) f.field_type;
 				if (delegate_type.delegate_symbol.has_target) {
 					// create field to store delegate target
 					st.add_field ("gpointer", get_delegate_target_cname (f.name));
@@ -597,13 +597,13 @@
 
 			if (f.initializer != null) {
 				var rhs = (CCodeExpression) f.initializer.ccodenode;
-				rhs = get_implicit_cast_expression (rhs, f.initializer.value_type, f.type_reference);
+				rhs = get_implicit_cast_expression (rhs, f.initializer.value_type, f.field_type);
 
 				instance_init_fragment.append (new CCodeExpressionStatement (new CCodeAssignment (lhs, rhs)));
 
-				if (f.type_reference is ArrayType && !f.no_array_length &&
+				if (f.field_type is ArrayType && !f.no_array_length &&
 				    f.initializer is ArrayCreationExpression) {
-					var array_type = (ArrayType) f.type_reference;
+					var array_type = (ArrayType) f.field_type;
 					var ma = new MemberAccess.simple (f.name);
 					ma.symbol_reference = f;
 					
@@ -616,17 +616,17 @@
 				}
 			}
 			
-			if (f.type_reference.takes_ownership && instance_dispose_fragment != null) {
+			if (f.field_type.takes_ownership && instance_dispose_fragment != null) {
 				var ma = new MemberAccess.simple (f.name);
 				ma.symbol_reference = f;
-				instance_dispose_fragment.append (new CCodeExpressionStatement (get_unref_expression (lhs, f.type_reference, ma)));
+				instance_dispose_fragment.append (new CCodeExpressionStatement (get_unref_expression (lhs, f.field_type, ma)));
 			}
 		} else if (f.binding == MemberBinding.CLASS)  {
 			st.add_field (field_ctype, f.get_cname ());
 		} else {
 			/* add array length fields where necessary */
-			if (f.type_reference is ArrayType && !f.no_array_length) {
-				var array_type = (ArrayType) f.type_reference;
+			if (f.field_type is ArrayType && !f.no_array_length) {
+				var array_type = (ArrayType) f.field_type;
 
 				for (int dim = 1; dim <= array_type.rank; dim++) {
 					var len_type = int_type.copy ();
@@ -641,8 +641,8 @@
 						source_type_member_declaration.append (cdecl);
 					}
 				}
-			} else if (f.type_reference is DelegateType) {
-				var delegate_type = (DelegateType) f.type_reference;
+			} else if (f.field_type is DelegateType) {
+				var delegate_type = (DelegateType) f.field_type;
 				if (delegate_type.delegate_symbol.has_target) {
 					// create field to store delegate target
 					var cdecl = new CCodeDeclaration ("gpointer");

Modified: trunk/gobject/valaccodememberaccessbinding.vala
==============================================================================
--- trunk/gobject/valaccodememberaccessbinding.vala	(original)
+++ trunk/gobject/valaccodememberaccessbinding.vala	Tue May 13 08:28:59 2008
@@ -108,7 +108,7 @@
 				expr.ccodenode = new CCodeIdentifier (f.get_cname ());
 			}
 
-			if (f.type_reference.type_parameter != null && expr.value_type.type_parameter == null) {
+			if (f.field_type.type_parameter != null && expr.value_type.type_parameter == null) {
 				expr.ccodenode = codegen.convert_from_generic_pointer ((CCodeExpression) expr.ccodenode, expr.value_type);
 			}
 		} else if (expr.symbol_reference is Constant) {

Modified: trunk/vala/valaarraytype.vala
==============================================================================
--- trunk/vala/valaarraytype.vala	(original)
+++ trunk/vala/valaarraytype.vala	Tue May 13 08:28:59 2008
@@ -67,10 +67,10 @@
 			if (rank > 1) {
 				// length is an int[] containing the dimensions of the array, starting at 0
 				ValueType integer = new ValueType((Typesymbol) root_symbol.scope.lookup("int"));
-				length_field.type_reference = new ArrayType (integer, 1, source_reference);
-				length_field.type_reference.add_type_argument (integer);
+				length_field.field_type = new ArrayType (integer, 1, source_reference);
+				length_field.field_type.add_type_argument (integer);
 			} else {
-				length_field.type_reference = new ValueType ((Typesymbol) root_symbol.scope.lookup ("int"));
+				length_field.field_type = new ValueType ((Typesymbol) root_symbol.scope.lookup ("int"));
 			}
 
 		}

Modified: trunk/vala/valafield.vala
==============================================================================
--- trunk/vala/valafield.vala	(original)
+++ trunk/vala/valafield.vala	Tue May 13 08:28:59 2008
@@ -30,7 +30,7 @@
 	/**
 	 * The data type of this field.
 	 */
-	public DataType type_reference {
+	public DataType field_type {
 		get { return _data_type; }
 		set {
 			_data_type = value;
@@ -76,11 +76,11 @@
 	 * @param source reference to source code
 	 * @return       newly created field
 	 */
-	public Field (string name, DataType type_reference, Expression? initializer, SourceReference? source_reference = null) {
-		this.type_reference = type_reference;
+	public Field (string name, DataType field_type, Expression? initializer, SourceReference? source_reference = null) {
+		this.name = name;
+		this.field_type = field_type;
 		this.initializer = initializer;
 		this.source_reference = source_reference;
-		this.name = name;
 	}
 
 	public override void accept (CodeVisitor visitor) {
@@ -90,7 +90,7 @@
 	}
 
 	public override void accept_children (CodeVisitor visitor) {
-		type_reference.accept (visitor);
+		field_type.accept (visitor);
 		
 		if (initializer != null) {
 			initializer.accept (visitor);
@@ -165,8 +165,8 @@
 	}
 
 	public override void replace_type (DataType old_type, DataType new_type) {
-		if (type_reference == old_type) {
-			type_reference = new_type;
+		if (field_type == old_type) {
+			field_type = new_type;
 		}
 	}
 }

Modified: trunk/vala/valainterfacewriter.vala
==============================================================================
--- trunk/vala/valainterfacewriter.vala	(original)
+++ trunk/vala/valainterfacewriter.vala	Tue May 13 08:28:59 2008
@@ -457,7 +457,7 @@
 			write_string ("[CCode (cname = \"%s\")]".printf (f.get_cname ()));
 		}
 
-		if (f.no_array_length && f.type_reference is ArrayType) {
+		if (f.no_array_length && f.field_type is ArrayType) {
 			write_indent ();
 			write_string ("[NoArrayLength]");
 		}
@@ -465,13 +465,13 @@
 		write_indent ();
 		write_accessibility (f);
 
-		if (f.type_reference.data_type != null &&
-		    f.type_reference.data_type.is_reference_type () &&
-		    !f.type_reference.takes_ownership) {
+		if (f.field_type.data_type != null &&
+		    f.field_type.data_type.is_reference_type () &&
+		    !f.field_type.takes_ownership) {
 			write_string ("weak ");
 		}
 
-		write_type (f.type_reference);
+		write_type (f.field_type);
 			
 		write_string (" ");
 		write_identifier (f.name);

Modified: trunk/vala/valamemorymanager.vala
==============================================================================
--- trunk/vala/valamemorymanager.vala	(original)
+++ trunk/vala/valamemorymanager.vala	Tue May 13 08:28:59 2008
@@ -77,8 +77,8 @@
 
 	public override void visit_field (Field f) {
 		if (f.initializer != null) {
-			if (!(f.type_reference is PointerType)) {
-				if (f.type_reference.takes_ownership) {
+			if (!(f.field_type is PointerType)) {
+				if (f.field_type.takes_ownership) {
 					visit_possibly_missing_copy_expression (f.initializer);
 				} else {
 					visit_possibly_leaked_expression (f.initializer);

Modified: trunk/vala/valasemanticanalyzer.vala
==============================================================================
--- trunk/vala/valasemanticanalyzer.vala	(original)
+++ trunk/vala/valasemanticanalyzer.vala	Tue May 13 08:28:59 2008
@@ -343,7 +343,7 @@
 		}
 
 		if (!f.is_internal_symbol ()) {
-			current_source_file.add_type_dependency (f.type_reference, SourceFileDependencyType.HEADER_SHALLOW);
+			current_source_file.add_type_dependency (f.field_type, SourceFileDependencyType.HEADER_SHALLOW);
 		} else {
 			if (f.parent_symbol is Namespace) {
 				f.error = true;
@@ -351,7 +351,7 @@
 				return;
 			}
 
-			current_source_file.add_type_dependency (f.type_reference, SourceFileDependencyType.SOURCE);
+			current_source_file.add_type_dependency (f.field_type, SourceFileDependencyType.SOURCE);
 		}
 	}
 
@@ -911,7 +911,7 @@
 					}
 				}
 
-				e.expected_type = field.type_reference.copy ();
+				e.expected_type = field.field_type.copy ();
 			}
 		} else if (list.expected_type == null) {
 			list.error = true;
@@ -1386,7 +1386,7 @@
 	private DataType? get_value_type_for_symbol (Symbol sym) {
 		if (sym is Field) {
 			var f = (Field) sym;
-			return f.type_reference;
+			return f.field_type;
 		} else if (sym is Constant) {
 			var c = (Constant) sym;
 			return c.type_reference;
@@ -2460,7 +2460,7 @@
 		DataType member_type;
 		if (init.symbol_reference is Field) {
 			var f = (Field) init.symbol_reference;
-			member_type = f.type_reference;
+			member_type = f.field_type;
 		} else if (init.symbol_reference is Property) {
 			var prop = (Property) init.symbol_reference;
 			member_type = prop.type_reference;
@@ -3110,9 +3110,9 @@
 				var f = (Field) ma.symbol_reference;
 
 				if (a.right.symbol_reference is Method &&
-				    f.type_reference is DelegateType) {
+				    f.field_type is DelegateType) {
 					var m = (Method) a.right.symbol_reference;
-					var dt = (DelegateType) f.type_reference;
+					var dt = (DelegateType) f.field_type;
 					var cb = dt.delegate_symbol;
 
 					/* check whether method matches callback type */
@@ -3122,7 +3122,7 @@
 						return;
 					}
 
-					a.right.value_type = f.type_reference;
+					a.right.value_type = f.field_type;
 				} else {
 					a.error = true;
 					Report.error (a.source_reference, "Assignment: Invalid callback assignment attempt");



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