[vala/wip/attributes: 72/119] Drop get_type_id from code nodes



commit 29d1e55df95f9d758e55c2619443396fe8c5d2bb
Author: Luca Bruno <lucabru src gnome org>
Date:   Wed Jun 29 22:13:44 2011 +0200

    Drop get_type_id from code nodes

 vala/valaarraytype.vala    |    8 --------
 vala/valaclass.vala        |   24 ------------------------
 vala/valadatatype.vala     |    8 --------
 vala/valadelegate.vala     |    4 ----
 vala/valadelegatetype.vala |    4 ----
 vala/valaenum.vala         |   20 --------------------
 vala/valaerrordomain.vala  |    4 ----
 vala/valaerrortype.vala    |    8 --------
 vala/valagenerictype.vala  |    4 ----
 vala/valagirparser.vala    |    6 +++---
 vala/valainterface.vala    |   17 -----------------
 vala/valapointertype.vala  |    4 ----
 vala/valastruct.vala       |   29 -----------------------------
 vala/valatypesymbol.vala   |   11 -----------
 vala/valavoidtype.vala     |    4 ----
 15 files changed, 3 insertions(+), 152 deletions(-)
---
diff --git a/vala/valaarraytype.vala b/vala/valaarraytype.vala
index 3b5e112..e5d5a84 100644
--- a/vala/valaarraytype.vala
+++ b/vala/valaarraytype.vala
@@ -243,14 +243,6 @@ public class Vala.ArrayType : ReferenceType {
 		return element_type.check (context);
 	}
 
-	public override string? get_type_id () {
-		if (element_type.data_type == CodeContext.get ().root.scope.lookup ("string")) {
-			return "G_TYPE_STRV";
-		} else {
-			return null;
-		}
-	}
-
 	public override DataType get_actual_type (DataType? derived_instance_type, MemberAccess? method_access, CodeNode node_reference) {
 		if (derived_instance_type == null && method_access == null) {
 			return this;
diff --git a/vala/valaclass.vala b/vala/valaclass.vala
index b4e96a6..f2eb555 100644
--- a/vala/valaclass.vala
+++ b/vala/valaclass.vala
@@ -83,7 +83,6 @@ public class Vala.Class : ObjectTypeSymbol {
 	public string const_cname { get; set; }
 	private string lower_case_cprefix;
 	private string lower_case_csuffix;
-	private string type_id;
 	private bool _is_compact;
 	private bool _is_immutable;
 
@@ -630,9 +629,6 @@ public class Vala.Class : ObjectTypeSymbol {
 	}
 	
 	private void process_ccode_attribute (Attribute a) {
-		if (a.has_argument ("type_id")) {
-			type_id = a.get_string ("type_id");
-		}
 		if (a.has_argument ("const_cname")) {
 			const_cname = a.get_string ("const_cname");
 		}
@@ -665,26 +661,6 @@ public class Vala.Class : ObjectTypeSymbol {
 		}
 	}
 
-	public string? get_default_type_id () {
-		if (is_compact) {
-			return "G_TYPE_POINTER";
-		}
-
-		return get_upper_case_cname ("TYPE_");
-	}
-
-	public override string? get_type_id () {
-		if (type_id == null) {
-			type_id = get_default_type_id ();
-		}
-
-		return type_id;
-	}
-
-	public void set_type_id (string type_id) {
-		this.type_id = type_id;
-	}
-
 	public bool is_fundamental () {
 		if (!is_compact && base_class == null) {
 			return true;
diff --git a/vala/valadatatype.vala b/vala/valadatatype.vala
index c879dcf..534888d 100644
--- a/vala/valadatatype.vala
+++ b/vala/valadatatype.vala
@@ -474,14 +474,6 @@ public abstract class Vala.DataType : CodeNode {
 		return is_real_struct_type () && !nullable;
 	}
 
-	public virtual string? get_type_id () {
-		if (data_type != null) {
-			return data_type.get_type_id ();
-		} else {
-			return null;
-		}
-	}
-
 	/**
 	 * Returns whether the value needs to be disposed, i.e. whether
 	 * allocated memory or other resources need to be released when
diff --git a/vala/valadelegate.vala b/vala/valadelegate.vala
index e1f9bbe..17cf00d 100644
--- a/vala/valadelegate.vala
+++ b/vala/valadelegate.vala
@@ -325,10 +325,6 @@ public class Vala.Delegate : TypeSymbol {
 		return false;
 	}
 
-	public override string? get_type_id () {
-		return "G_TYPE_POINTER";
-	}
-
 	public override void replace_type (DataType old_type, DataType new_type) {
 		if (return_type == old_type) {
 			return_type = new_type;
diff --git a/vala/valadelegatetype.vala b/vala/valadelegatetype.vala
index 11648ca..2c4c9e1 100644
--- a/vala/valadelegatetype.vala
+++ b/vala/valadelegatetype.vala
@@ -119,10 +119,6 @@ public class Vala.DelegateType : DataType {
 		return delegate_symbol.is_accessible (sym);
 	}
 
-	public override string? get_type_id () {
-		return "G_TYPE_POINTER";
-	}
-
 	public override bool check (CodeContext context) {
 		return delegate_symbol.check (context);
 	}
diff --git a/vala/valaenum.vala b/vala/valaenum.vala
index 870120e..d8e6999 100644
--- a/vala/valaenum.vala
+++ b/vala/valaenum.vala
@@ -43,7 +43,6 @@ public class Vala.Enum : TypeSymbol {
 	private string cprefix;
 	private string lower_case_cprefix;
 	private string lower_case_csuffix;
-	private string type_id;
 
 	/**
 	 * Creates a new enum.
@@ -232,9 +231,6 @@ public class Vala.Enum : TypeSymbol {
 		if (a.has_argument ("has_type_id")) {
 			has_type_id = a.get_bool ("has_type_id");
 		}
-		if (a.has_argument ("type_id")) {
-			type_id = a.get_string ("type_id");
-		}
 	}
 	
 	/**
@@ -252,22 +248,6 @@ public class Vala.Enum : TypeSymbol {
 		}
 	}
 
-	public void set_type_id (string? type_id) {
-		this.type_id = type_id;
-	}
-
-	public override string? get_type_id () {
-		if (type_id == null) {
-			if (has_type_id) {
-				type_id = get_upper_case_cname ("TYPE_");
-			} else {
-				type_id = is_flags ? "G_TYPE_UINT" : "G_TYPE_INT";
-			}
-		}
-
-		return type_id;
-	}
-	
 	public override string? get_default_value () {
 		return "0";
 	}
diff --git a/vala/valaerrordomain.vala b/vala/valaerrordomain.vala
index 6b8aeb1..768768d 100644
--- a/vala/valaerrordomain.vala
+++ b/vala/valaerrordomain.vala
@@ -197,10 +197,6 @@ public class Vala.ErrorDomain : TypeSymbol {
 		}
 	}
 
-	public override string? get_type_id () {
-		return "G_TYPE_POINTER";
-	}
-	
 	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
diff --git a/vala/valaerrortype.vala b/vala/valaerrortype.vala
index 33f5e41..3ce744f 100644
--- a/vala/valaerrortype.vala
+++ b/vala/valaerrortype.vala
@@ -135,14 +135,6 @@ public class Vala.ErrorType : ReferenceType {
 		return gerror_symbol.scope.lookup (member_name);
 	}
 
-	public override string? get_type_id () {
-		if (source_reference != null && source_reference.file.context.require_glib_version (2, 26)) {
-			return "G_TYPE_ERROR";
-		} else {
-			return "G_TYPE_POINTER";
-		}
-	}
-
 	public override bool is_reference_type_or_type_parameter () {
 		return true;
 	}
diff --git a/vala/valagenerictype.vala b/vala/valagenerictype.vala
index 3e881e5..15a2121 100644
--- a/vala/valagenerictype.vala
+++ b/vala/valagenerictype.vala
@@ -54,10 +54,6 @@ public class Vala.GenericType : DataType {
 		}
 	}
 
-	public override string? get_type_id () {
-		return "G_TYPE_POINTER";
-	}
-
 	public override string to_qualified_string (Scope? scope = null) {
 		return type_parameter.name;
 	}
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index b2934f8..b8054a0 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -2183,7 +2183,7 @@ public class Vala.GirParser : CodeVisitor {
 		var parent = reader.get_attribute ("parent");
 		if (current.new_symbol) {
 			cl = new Class (current.name, current.source_reference);
-			cl.set_type_id ("%s ()".printf (reader.get_attribute ("glib:get-type")));
+			cl.set_attribute_string ("CCode", "type_id", "%s ()".printf (reader.get_attribute ("glib:get-type")));
 			var cname = reader.get_attribute ("c:type");
 			if (cname != null) {
 				cl.set_cname (cname);
@@ -2272,7 +2272,7 @@ public class Vala.GirParser : CodeVisitor {
 			}
 			var typeid = reader.get_attribute ("glib:get-type");
 			if (typeid != null) {
-				iface.set_type_id ("%s ()".printf (typeid));
+				iface.set_attribute_string ("CCode", "type_id", "%s ()".printf (typeid));
 			}
 
 			current.symbol = iface;
@@ -2608,7 +2608,7 @@ public class Vala.GirParser : CodeVisitor {
 			}
 			var typeid = reader.get_attribute ("glib:get-type");
 			if (typeid != null) {
-				cl.set_type_id ("%s ()".printf (typeid));
+				cl.set_attribute_string ("CCode", "type_id", "%s ()".printf (typeid));
 				cl.set_attribute_string ("CCode", "free_function", "g_boxed_free");
 				cl.set_attribute_string ("Ccode", "copy_function", "g_boxed_copy");
 			}
diff --git a/vala/valainterface.vala b/vala/valainterface.vala
index d5975ff..136f67d 100644
--- a/vala/valainterface.vala
+++ b/vala/valainterface.vala
@@ -43,7 +43,6 @@ public class Vala.Interface : ObjectTypeSymbol {
 	private string cname;
 	private string lower_case_csuffix;
 	private string type_cname;
-	private string type_id;
 
 	/**
 	 * Returns a copy of the list of classes.
@@ -487,22 +486,6 @@ public class Vala.Interface : ObjectTypeSymbol {
 		this.type_cname = type_cname;
 	}
 
-	public string? get_default_type_id () {
-		return get_upper_case_cname ("TYPE_");
-	}
-
-	public override string? get_type_id () {
-		if (type_id == null) {
-			type_id = get_default_type_id ();
-		}
-		
-		return type_id;
-	}
-
-	public void set_type_id (string type_id) {
-		this.type_id = type_id;
-	}
-
 	public override void replace_type (DataType old_type, DataType new_type) {
 		for (int i = 0; i < prerequisites.size; i++) {
 			if (prerequisites[i] == old_type) {
diff --git a/vala/valapointertype.vala b/vala/valapointertype.vala
index d7da3d8..3294091 100644
--- a/vala/valapointertype.vala
+++ b/vala/valapointertype.vala
@@ -122,10 +122,6 @@ public class Vala.PointerType : DataType {
 		return base_type.is_accessible (sym);
 	}
 
-	public override string? get_type_id () {
-		return "G_TYPE_POINTER";
-	}
-
 	public override void accept_children (CodeVisitor visitor) {
 		base_type.accept (visitor);
 	}
diff --git a/vala/valastruct.vala b/vala/valastruct.vala
index a50180e..b85cfb8 100644
--- a/vala/valastruct.vala
+++ b/vala/valastruct.vala
@@ -35,7 +35,6 @@ public class Vala.Struct : TypeSymbol {
 
 	private string cname;
 	private string const_cname;
-	private string type_id;
 	private string lower_case_cprefix;
 	private string lower_case_csuffix;
 	private bool? boolean_type;
@@ -432,9 +431,6 @@ public class Vala.Struct : TypeSymbol {
 		if (a.has_argument ("has_type_id")) {
 			has_type_id = a.get_bool ("has_type_id");
 		}
-		if (a.has_argument ("type_id")) {
-			set_type_id (a.get_string ("type_id"));
-		}
 		if (a.has_argument ("default_value")) {
 			set_default_value (a.get_string ("default_value"));
 		}
@@ -485,31 +481,6 @@ public class Vala.Struct : TypeSymbol {
 		}
 	}
 
-	public override string? get_type_id () {
-		if (type_id == null) {
-			if (!has_type_id) {
-				if (base_type != null) {
-					var st = base_struct;
-					if (st != null) {
-						return st.get_type_id ();
-					}
-				}
-				if (is_simple_type ()) {
-					return null;
-				} else {
-					return "G_TYPE_POINTER";
-				}
-			} else {
-				type_id = get_upper_case_cname ("TYPE_");
-			}
-		}
-		return type_id;
-	}
-	
-	public void set_type_id (string? name) {
-		this.type_id = name;
-	}
-
 	public override string? get_default_value () {
 		if (default_value != null) {
 			return default_value;
diff --git a/vala/valatypesymbol.vala b/vala/valatypesymbol.vala
index 8d709b3..ed9a1b5 100644
--- a/vala/valatypesymbol.vala
+++ b/vala/valatypesymbol.vala
@@ -50,17 +50,6 @@ public abstract class Vala.TypeSymbol : Symbol {
 	}
 	
 	/**
-	 * Returns the C symbol representing the runtime type id for this data
-	 * type. The specified symbol must express a registered GType.
-	 *
-	 * @return the name of the GType name in C code or null if this data
-	 *         type is not registered with GType
-	 */
-	public virtual string? get_type_id () {
-		return null;
-	}
-	
-	/**
 	 * Returns the C name of this data type in upper case. Words are
 	 * separated by underscores. The upper case C name of the namespace is
 	 * prefix of the result.
diff --git a/vala/valavoidtype.vala b/vala/valavoidtype.vala
index b328f55..89771c5 100644
--- a/vala/valavoidtype.vala
+++ b/vala/valavoidtype.vala
@@ -45,8 +45,4 @@ public class Vala.VoidType : DataType {
 	public override DataType copy () {
 		return new VoidType (source_reference);
 	}
-
-	public override string? get_type_id () {
-		return "G_TYPE_NONE";
-	}
 }



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