[vala/wip/attributes: 109/119] Use new methods



commit 9da59870a15873144e6816ec7f13b74df405f685
Author: Luca Bruno <lucabru src gnome org>
Date:   Sun Jul 3 16:45:35 2011 +0200

    Use new methods

 codegen/valaccodebasemodule.vala |   38 +++++++-------------------------------
 1 files changed, 7 insertions(+), 31 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index b3ef49b..c566a5a 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -5706,30 +5706,18 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 	}
 
 	public static bool get_ccode_has_copy_function (Struct st) {
-		var a = st.get_attribute ("CCode");
-		if (a != null && a.has_argument ("has_copy_function")) {
-			return a.get_bool ("has_copy_function");
-		}
-		return true;
+		return st.get_attribute_bool ("CCode", "has_copy_function", true);
 	}
 
 	public static bool get_ccode_has_destroy_function (Struct st) {
-		var a = st.get_attribute ("CCode");
-		if (a != null && a.has_argument ("has_destroy_function")) {
-			return a.get_bool ("has_destroy_function");
-		}
-		return true;
+		return st.get_attribute_bool ("CCode", "has_destroy_function", true);
 	}
 
 	public static double get_ccode_instance_pos (CodeNode node) {
-		var a = node.get_attribute ("CCode");
-		if (a != null && a.has_argument ("instance_pos")) {
-			return a.get_double ("instance_pos");
-		}
 		if (node is Delegate) {
-			return -2;
+			return node.get_attribute_double ("CCode", "instance_pos", -2);
 		} else {
-			return 0;
+			return node.get_attribute_double ("CCode", "instance_pos", 0);
 		}
 	}
 
@@ -5833,19 +5821,11 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 	}
 
 	public static bool get_ccode_has_type_id (TypeSymbol sym) {
-		var a = sym.get_attribute ("CCode");
-		if (a != null && a.has_argument ("has_type_id")) {
-			return a.get_bool ("has_type_id");
-		}
-		return true;
+		return sym.get_attribute_bool ("CCode", "has_type_id", true);
 	}
 
 	public static bool get_ccode_has_new_function (Method m) {
-		var a = m.get_attribute ("CCode");
-		if (a != null && a.has_argument ("has_new_function")) {
-			return a.get_bool ("has_new_function");
-		}
-		return true;
+		return m.get_attribute_bool ("CCode", "has_new_function", true);
 	}
 
 	public static bool get_ccode_has_generic_type_parameter (Method m) {
@@ -5866,11 +5846,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 	}
 
 	public static bool get_ccode_notify (Property prop) {
-		var a = prop.get_attribute ("CCode");
-		if (a != null && a.has_argument ("notify")) {
-			return a.get_bool ("notify");
-		}
-		return true;
+		return prop.get_attribute_bool ("CCode", "notify", true);
 	}
 
 	public CCodeConstant get_signal_canonical_constant (Signal sig, string? detail = null) {



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