vala r1951 - in trunk: . gobject vala



Author: juergbi
Date: Sun Nov  2 13:00:19 2008
New Revision: 1951
URL: http://svn.gnome.org/viewvc/vala?rev=1951&view=rev

Log:
2008-11-02  JÃrg Billeter  <j bitron ch>

	* vala/valamethodtype.vala:
	* gobject/valaccodegenerator.vala:

	Add member `begin' to coroutines


Modified:
   trunk/ChangeLog
   trunk/gobject/valaccodegenerator.vala
   trunk/vala/valamethodtype.vala

Modified: trunk/gobject/valaccodegenerator.vala
==============================================================================
--- trunk/gobject/valaccodegenerator.vala	(original)
+++ trunk/gobject/valaccodegenerator.vala	Sun Nov  2 13:00:19 2008
@@ -2685,18 +2685,16 @@
 			var cfrag = new CCodeFragment ();
 			stmt.ccodenode = cfrag;
 
-			if (current_method.coroutine) {
-				var idle_call = new CCodeFunctionCall (new CCodeIdentifier ("g_idle_add"));
-				idle_call.add_argument (new CCodeCastExpression (new CCodeIdentifier (current_method.get_real_cname ()), "GSourceFunc"));
-				idle_call.add_argument (new CCodeIdentifier ("data"));
-
-				int state = next_coroutine_state++;
-
-				cfrag.append (new CCodeExpressionStatement (idle_call));
-				cfrag.append (new CCodeExpressionStatement (new CCodeAssignment (new CCodeMemberAccess.pointer (new CCodeIdentifier ("data"), "state"), new CCodeConstant (state.to_string ()))));
-				cfrag.append (new CCodeReturnStatement (new CCodeConstant ("FALSE")));
-				cfrag.append (new CCodeCaseStatement (new CCodeConstant (state.to_string ())));
-			}
+			var idle_call = new CCodeFunctionCall (new CCodeIdentifier ("g_idle_add"));
+			idle_call.add_argument (new CCodeCastExpression (new CCodeIdentifier (current_method.get_real_cname ()), "GSourceFunc"));
+			idle_call.add_argument (new CCodeIdentifier ("data"));
+
+			int state = next_coroutine_state++;
+
+			cfrag.append (new CCodeExpressionStatement (idle_call));
+			cfrag.append (new CCodeExpressionStatement (new CCodeAssignment (new CCodeMemberAccess.pointer (new CCodeIdentifier ("data"), "state"), new CCodeConstant (state.to_string ()))));
+			cfrag.append (new CCodeReturnStatement (new CCodeConstant ("FALSE")));
+			cfrag.append (new CCodeCaseStatement (new CCodeConstant (state.to_string ())));
 
 			return;
 		}

Modified: trunk/vala/valamethodtype.vala
==============================================================================
--- trunk/vala/valamethodtype.vala	(original)
+++ trunk/vala/valamethodtype.vala	Sun Nov  2 13:00:19 2008
@@ -66,4 +66,11 @@
 	public override string? get_cname () {
 		return "gpointer";
 	}
+
+	public override Symbol? get_member (string member_name) {
+		if (method_symbol.coroutine && member_name == "begin") {
+			return method_symbol;
+		}
+		return null;
+	}
 }



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