[vala] GAsync: Fix .begin on async methods that may throw errors



commit 0cf6216018471c6dbcf49cdf8e34d78dec801fdd
Author: Jürg Billeter <j bitron ch>
Date:   Mon Sep 14 18:01:42 2009 +0200

    GAsync: Fix .begin on async methods that may throw errors

 vala/valamethodcall.vala |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/vala/valamethodcall.vala b/vala/valamethodcall.vala
index d9e9681..44e9ee6 100644
--- a/vala/valamethodcall.vala
+++ b/vala/valamethodcall.vala
@@ -429,14 +429,18 @@ public class Vala.MethodCall : Expression {
 					Report.error (source_reference, "yield expression not available outside async method");
 				}
 			}
-			foreach (DataType error_type in m.get_error_types ()) {
-				may_throw = true;
+			if (m != null && m.coroutine && !is_yield_expression && ((MemberAccess) call).member_name != "end") {
+				// .begin call of async method, no error can happen here
+			} else {
+				foreach (DataType error_type in m.get_error_types ()) {
+					may_throw = true;
 
-				// ensure we can trace back which expression may throw errors of this type
-				var call_error_type = error_type.copy ();
-				call_error_type.source_reference = source_reference;
+					// ensure we can trace back which expression may throw errors of this type
+					var call_error_type = error_type.copy ();
+					call_error_type.source_reference = source_reference;
 
-				add_error_type (call_error_type);
+					add_error_type (call_error_type);
+				}
 			}
 		} else if (mtype is DelegateType) {
 			var d = ((DelegateType) mtype).delegate_symbol;



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