[vala/wip/attributes: 80/100] Drop finish_real_cname



commit c97fd7291c076fd7277d727b1a18c191092f4335
Author: Luca Bruno <lucabru src gnome org>
Date:   Thu Jun 30 09:59:21 2011 +0200

    Drop finish_real_cname

 codegen/valaccodebasemodule.vala |   14 ++++++++++++++
 codegen/valagasyncmodule.vala    |    2 +-
 codegen/valagtypemodule.vala     |    6 +++---
 vala/valamethod.vala             |   14 --------------
 4 files changed, 18 insertions(+), 18 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index e53e01e..05143c7 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -5814,6 +5814,10 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 		return get_ccode_attribute(m).finish_vfunc_name;
 	}
 
+	public static string get_ccode_finish_real_name (Method m) {
+		return get_ccode_attribute(m).finish_real_name;
+	}
+
 	public static bool get_ccode_no_accessor_method (Property p) {
 		return p.get_attribute ("NoAccessorMethod") != null;
 	}
@@ -6422,6 +6426,15 @@ public class Vala.CCodeAttribute : AttributeCache {
 		}
 	}
 
+	public string finish_real_name {
+		get {
+			if (_finish_real_name == null) {
+				_finish_real_name = get_finish_name_for_basename (real_name);
+			}
+			return _finish_real_name;
+		}
+	}
+
 	public bool no_array_length { get; private set; }
 	public string? array_length_type { get; private set; }
 
@@ -6450,6 +6463,7 @@ public class Vala.CCodeAttribute : AttributeCache {
 	private string _vfunc_name;
 	private string _finish_name;
 	private string _finish_vfunc_name;
+	private string _finish_real_name;
 
 	public CCodeAttribute (CodeNode node) {
 		this.node = node;
diff --git a/codegen/valagasyncmodule.vala b/codegen/valagasyncmodule.vala
index 5f8603e..cc8b9a4 100644
--- a/codegen/valagasyncmodule.vala
+++ b/codegen/valagasyncmodule.vala
@@ -375,7 +375,7 @@ public class Vala.GAsyncModule : GSignalModule {
 
 		string dataname = Symbol.lower_case_to_camel_case (get_ccode_name (m)) + "Data";
 
-		var finishfunc = new CCodeFunction (m.get_finish_real_cname ());
+		var finishfunc = new CCodeFunction (get_ccode_finish_real_cname (m));
 
 		var cparam_map = new HashMap<int,CCodeParameter> (direct_hash, direct_equal);
 
diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala
index 4660cdd..cdf9ff3 100644
--- a/codegen/valagtypemodule.vala
+++ b/codegen/valagtypemodule.vala
@@ -1221,7 +1221,7 @@ public class Vala.GTypeModule : GErrorModule {
 				ccode.add_assignment (new CCodeMemberAccess.pointer (ccast, get_ccode_vfunc_name (m.base_method)), new CCodeIdentifier (m.get_real_cname ()));
 
 				if (m.coroutine) {
-					ccode.add_assignment (new CCodeMemberAccess.pointer (ccast, get_ccode_finish_vfunc_name (m.base_method)), new CCodeIdentifier (m.get_finish_real_cname ()));
+					ccode.add_assignment (new CCodeMemberAccess.pointer (ccast, get_ccode_finish_vfunc_name (m.base_method)), new CCodeIdentifier (get_ccode_finish_real_cname (m)));
 				}
 			}
 		}
@@ -1320,7 +1320,7 @@ public class Vala.GTypeModule : GErrorModule {
 				if (m.is_abstract || m.is_virtual) {
 					cfunc = new CCodeIdentifier (get_ccode_finish_name (m));
 				} else {
-					cfunc = new CCodeIdentifier (m.get_finish_real_cname ());
+					cfunc = new CCodeIdentifier (get_ccode_finish_real_cname (m));
 				}
 				ccode.add_assignment (new CCodeMemberAccess.pointer (ciface, get_ccode_finish_vfunc_name (m.base_interface_method)), cfunc);
 			}
@@ -2041,7 +2041,7 @@ public class Vala.GTypeModule : GErrorModule {
 				var cname = m.get_real_cname ();
 				ccode.add_assignment (new CCodeMemberAccess.pointer (ciface, get_ccode_vfunc_name (m)), new CCodeIdentifier (cname));
 				if (m.coroutine) {
-					ccode.add_assignment (new CCodeMemberAccess.pointer (ciface, get_ccode_finish_vfunc_name (m)), new CCodeIdentifier (m.get_finish_real_cname ()));
+					ccode.add_assignment (new CCodeMemberAccess.pointer (ciface, get_ccode_finish_vfunc_name (m)), new CCodeIdentifier (get_ccode_finish_real_cname (m)));
 				}
 			}
 		}
diff --git a/vala/valamethod.vala b/vala/valamethod.vala
index aedcbab..7b6856d 100644
--- a/vala/valamethod.vala
+++ b/vala/valamethod.vala
@@ -358,20 +358,6 @@ public class Vala.Method : Subroutine {
 		}
 	}
 
-	protected string get_finish_name_for_basename (string basename) {
-		string result = basename;
-		if (result.has_suffix ("_async")) {
-			result = result.substring (0, result.length - "_async".length);
-		}
-		result += "_finish";
-		return result;
-	}
-
-	public string get_finish_real_cname () {
-		assert (coroutine);
-		return get_finish_name_for_basename (get_real_cname ());
-	}
-
 	/**
 	 * Sets the name of this method as it is used in C code.
 	 *



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