[vala/wip/attributes: 79/100] Drop finish_cname



commit e6bf0b12e6e5c9d62e1dd9cebb6db087bdb98b17
Author: Luca Bruno <lucabru src gnome org>
Date:   Thu Jun 30 09:56:31 2011 +0200

    Drop finish_cname

 vala/valagirparser.vala |   14 +++++++++++++-
 vala/valamethod.vala    |   19 -------------------
 2 files changed, 13 insertions(+), 20 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index faeb515..bddce1d 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -629,6 +629,18 @@ public class Vala.GirParser : CodeVisitor {
 			}
 		}
 
+		public string get_finish_cname () {
+			var finish_cname = symbol.get_attribute_string ("CCode", "finish_name");
+			if (finish_cname != null) {
+				returnf finish_cname;
+			}
+			var result = get_cname ();
+			if (result.has_suffix ("_async")) {
+				result = result.substring (0, result.length - "_async".length);
+			}
+			return result + "_finish";
+		}
+
 		public void process (GirParser parser) {
 			if (processed) {
 				return;
@@ -3095,7 +3107,7 @@ public class Vala.GirParser : CodeVisitor {
 
 		// check if the method is using non-standard finish method name
 		if (finish_method_node == null) {
-			var method_cname = m.get_finish_cname ();
+			var method_cname = node.get_finish_cname ();
 			foreach (var n in node.parent.members) {
 				if (n.symbol is Method && n.get_cname () == method_cname) {
 					finish_method_node = n;
diff --git a/vala/valamethod.vala b/vala/valamethod.vala
index 3cae883..aedcbab 100644
--- a/vala/valamethod.vala
+++ b/vala/valamethod.vala
@@ -205,7 +205,6 @@ public class Vala.Method : Subroutine {
 
 	private List<Parameter> parameters = new ArrayList<Parameter> ();
 	private string cname;
-	private string finish_name;
 	private string _sentinel;
 	private List<Expression> preconditions;
 	private List<Expression> postconditions;
@@ -327,17 +326,6 @@ public class Vala.Method : Subroutine {
 		return cname;
 	}
 
-	public string get_finish_cname () {
-		assert (coroutine);
-		if (finish_name == null) {
-			finish_name = get_default_finish_cname ();
-		}
-		return finish_name;
-	}
-
-	public void set_finish_cname (string name) {
-		finish_name = name;
-	}
 
 	/**
 	 * Returns the default interface name of this method as it is used in C
@@ -384,10 +372,6 @@ public class Vala.Method : Subroutine {
 		return get_finish_name_for_basename (get_real_cname ());
 	}
 
-	public string get_default_finish_cname () {
-		return get_finish_name_for_basename (get_cname ());
-	}
-	
 	/**
 	 * Sets the name of this method as it is used in C code.
 	 *
@@ -401,9 +385,6 @@ public class Vala.Method : Subroutine {
 		if (a.has_argument ("cname")) {
 			set_cname (a.get_string ("cname"));
 		}
-		if (a.has_argument ("finish_name")) {
-			this.finish_name = a.get_string ("finish_name");
-		}
 		if (a.has_argument ("sentinel")) {
 			this.sentinel = a.get_string ("sentinel");
 		}



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