[vala/wip/attributes: 50/100] gidlparser: Drop usage of get_finish_cname and set_finish_cname



commit 71a234c0019071edf15f97a6ec63fc6e45cdc140
Author: Luca Bruno <lucabru src gnome org>
Date:   Wed Jun 29 15:07:58 2011 +0200

    gidlparser: Drop usage of get_finish_cname and set_finish_cname

 vapigen/valagidlparser.vala |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/vapigen/valagidlparser.vala b/vapigen/valagidlparser.vala
index c6759b6..96c8c2c 100644
--- a/vapigen/valagidlparser.vala
+++ b/vapigen/valagidlparser.vala
@@ -195,6 +195,18 @@ public class Vala.GIdlParser : CodeVisitor {
 		}
 	}
 
+	private string get_finish_cname (Method m) {
+		var finish_cname = sym.get_attribute_string ("CCode", "finish_name");
+		if (finish_cname != null) {
+			returnf finish_cname;
+		}
+		var result = get_cname (m);
+		if (result.has_suffix ("_async")) {
+			result = result.substring (0, result.length - "_async".length);
+		}
+		return result + "_finish";
+	}
+
 	private string get_lower_case_cname (Symbol sym) {
 		var lower_case_csuffix = Symbol.camel_case_to_lower_case (sym.name);
 		if (sym is ObjectTypeSymbol) {
@@ -1672,7 +1684,7 @@ public class Vala.GIdlParser : CodeVisitor {
 
 				// check if the method is using non-standard finish method name
 				if (finish_method == null) {
-					var method_cname = m.get_finish_cname ();
+					var method_cname = get_finish_cname (m);
 					foreach (Method method in type_symbol.get_methods ()) {
 						if (get_cname (method) == method_cname) {
 							finish_method = method;
@@ -2192,7 +2204,7 @@ public class Vala.GIdlParser : CodeVisitor {
 				} else if (nv[0] == "vfunc_name") {
 					m.vfunc_name = eval (nv[1]);
 				} else if (nv[0] == "finish_name") {
-					m.set_finish_cname (eval (nv[1]));
+					m.set_attribute_string ("CCode", "finish_name", eval (nv[1]));
 				} else if (nv[0] == "async") {
 					if (eval (nv[1]) == "1") {
 						// force async function, even if it doesn't end in _async



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