[vala] GAsync: Fix calling async methods from async methods without yield



commit 4d481acb3acb39e3b202650ef1ac5130e66b46b4
Author: Jürg Billeter <j bitron ch>
Date:   Thu Sep 17 11:22:23 2009 +0200

    GAsync: Fix calling async methods from async methods without yield

 codegen/valaccodemethodcallmodule.vala |   20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)
---
diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala
index 8160fdb..2235152 100644
--- a/codegen/valaccodemethodcallmodule.vala
+++ b/codegen/valaccodemethodcallmodule.vala
@@ -642,18 +642,16 @@ internal class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
 			expr.ccodenode = ccall_expr;
 		}
 
-		if (m != null && m.coroutine && current_method != null && current_method.coroutine) {
-			if (ma.member_name != "begin" || ma.inner.symbol_reference != ma.symbol_reference) {
-				if (pre_statement_fragment == null) {
-					pre_statement_fragment = new CCodeFragment ();
-				}
-				pre_statement_fragment.append (new CCodeExpressionStatement (async_call));
-
-				int state = next_coroutine_state++;
-				pre_statement_fragment.append (new CCodeExpressionStatement (new CCodeAssignment (new CCodeMemberAccess.pointer (new CCodeIdentifier ("data"), "_state_"), new CCodeConstant (state.to_string ()))));
-				pre_statement_fragment.append (new CCodeReturnStatement (new CCodeConstant ("FALSE")));
-				pre_statement_fragment.append (new CCodeCaseStatement (new CCodeConstant (state.to_string ())));
+		if (expr.is_yield_expression) {
+			if (pre_statement_fragment == null) {
+				pre_statement_fragment = new CCodeFragment ();
 			}
+			pre_statement_fragment.append (new CCodeExpressionStatement (async_call));
+
+			int state = next_coroutine_state++;
+			pre_statement_fragment.append (new CCodeExpressionStatement (new CCodeAssignment (new CCodeMemberAccess.pointer (new CCodeIdentifier ("data"), "_state_"), new CCodeConstant (state.to_string ()))));
+			pre_statement_fragment.append (new CCodeReturnStatement (new CCodeConstant ("FALSE")));
+			pre_statement_fragment.append (new CCodeCaseStatement (new CCodeConstant (state.to_string ())));
 		}
 
 		if (m is ArrayResizeMethod) {



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