From: Jürg Billeter Date: Mon, 14 Sep 2009 16:01:42 +0000 (+0200) Subject: GAsync: Fix .begin on async methods that may throw errors X-Git-Tag: 0.7.6~90 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0cf6216018471c6dbcf49cdf8e34d78dec801fdd;p=thirdparty%2Fvala.git GAsync: Fix .begin on async methods that may throw errors --- diff --git a/vala/valamethodcall.vala b/vala/valamethodcall.vala index d9e9681bc..44e9ee686 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;