[vala/wip/attributes: 111/121] Drop has_emitter



commit 3b891bc8f9a35fbac293b9a65eee890703e58dec
Author: Luca Bruno <lucabru src gnome org>
Date:   Sun Jul 3 19:23:04 2011 +0200

    Drop has_emitter

 codegen/valaccodebasemodule.vala       |    4 ++++
 codegen/valaccodemethodcallmodule.vala |    2 +-
 codegen/valagsignalmodule.vala         |    2 +-
 vala/valacodewriter.vala               |    7 ++-----
 vala/valagirparser.vala                |    2 +-
 vala/valasignal.vala                   |    9 +--------
 vapigen/valagidlparser.vala            |    2 +-
 7 files changed, 11 insertions(+), 17 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index c566a5a..1fce524 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -5875,6 +5875,10 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 		return new CCodeConstant (str.str);
 	}
 
+	public bool get_signal_has_emitter (Signal sig) {
+		return sig.get_attribute ("HasEmitter") != null;
+	}
+
 	public CCodeConstant get_property_canonical_cconstant (Property prop) {
 		return new CCodeConstant ("\"%s\"".printf (prop.name.replace ("_", "-")));
 	}
diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala
index d9361ed..742f951 100644
--- a/codegen/valaccodemethodcallmodule.vala
+++ b/codegen/valaccodemethodcallmodule.vala
@@ -618,7 +618,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
 
 			if (ma != null && ma.inner is BaseAccess && sig.is_virtual) {
 				// normal return value for base access
-			} else if (!sig.has_emitter) {
+			} else if (!get_signal_has_emitter (sig)) {
 				return_result_via_out_param = true;
 			}
 		}
diff --git a/codegen/valagsignalmodule.vala b/codegen/valagsignalmodule.vala
index 99b17bc..fade595 100644
--- a/codegen/valagsignalmodule.vala
+++ b/codegen/valagsignalmodule.vala
@@ -479,7 +479,7 @@ public class Vala.GSignalModule : GObjectModule {
 				return;
 			}
 
-			if (sig.has_emitter) {
+			if (get_signal_has_emitter (sig)) {
 				var ccall = new CCodeFunctionCall (new CCodeIdentifier ("%s_%s".printf (get_ccode_lower_case_name (cl), sig.name)));
 
 				ccall.add_argument (pub_inst);
diff --git a/vala/valacodewriter.vala b/vala/valacodewriter.vala
index 819a5b7..047187b 100644
--- a/vala/valacodewriter.vala
+++ b/vala/valacodewriter.vala
@@ -971,13 +971,10 @@ public class Vala.CodeWriter : CodeVisitor {
 			return;
 		}
 		
-		if (sig.has_emitter) {
-			write_indent ();
-			write_string ("[HasEmitter]");
-		}
-
 		emit_deprecated_attribute (sig);
 		emit_experimental_attribute (sig);
+
+		write_attributes (sig);
 		
 		write_indent ();
 		write_accessibility (sig);
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index e3a67ae..c4e7d0b 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -667,7 +667,7 @@ public class Vala.GirParser : CodeVisitor {
 							if (m.is_virtual) {
 								sig.is_virtual = true;
 							} else {
-								sig.has_emitter = true;
+								sig.set_attribute ("HasEmitter", true);
 							}
 							parser.assume_parameter_names (sig, m, false);
 							merged = true;
diff --git a/vala/valasignal.vala b/vala/valasignal.vala
index 27be146..a9d31ba 100644
--- a/vala/valasignal.vala
+++ b/vala/valasignal.vala
@@ -48,11 +48,6 @@ public class Vala.Signal : Symbol, Lockable {
 	}
 
 	/**
-	 * Specifies whether this signal has an emitter wrapper function.
-	 */
-	public bool has_emitter { get; set; }
-	
-	/**
 	 * Specifies whether this signal has virtual method handler.
 	 */
 	public bool is_virtual { get; set; }
@@ -210,9 +205,7 @@ public class Vala.Signal : Symbol, Lockable {
 	 */
 	public void process_attributes () {
 		foreach (Attribute a in attributes) {
-			if (a.name == "HasEmitter") {
-				has_emitter = true;
-			} else if (a.name == "Signal") {
+			if (a.name == "Signal") {
 				process_signal_attribute (a);
 			}
 		}
diff --git a/vapigen/valagidlparser.vala b/vapigen/valagidlparser.vala
index b3d0f56..c29cbfc 100644
--- a/vapigen/valagidlparser.vala
+++ b/vapigen/valagidlparser.vala
@@ -2898,7 +2898,7 @@ public class Vala.GIdlParser : CodeVisitor {
 					sig.set_attribute_string ("CCode", "cname", sig.name);
 					sig.name = eval (nv[1]);
 				} else if (nv[0] == "has_emitter" && eval (nv[1]) == "1") {
-					sig.has_emitter = true;
+					sig.set_attribute ("HasEmitter", true);
 				} else if (nv[0] == "hidden") {
 					if (eval (nv[1]) == "1") {
 						return null;



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