From: Luca Bruno Date: Fri, 25 Jun 2010 21:06:00 +0000 (+0200) Subject: Do not allow .begin() and .end() in yield statement X-Git-Tag: 0.9.3~72 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=96f0532cc503085b902c7a43a29b622be4a5b1a9;p=thirdparty%2Fvala.git Do not allow .begin() and .end() in yield statement Fixes bug 622707. --- diff --git a/vala/valamethodcall.vala b/vala/valamethodcall.vala index 79b7ecf13..268432762 100644 --- a/vala/valamethodcall.vala +++ b/vala/valamethodcall.vala @@ -276,16 +276,21 @@ public class Vala.MethodCall : Expression { if (mtype is MethodType) { var m = ((MethodType) mtype).method_symbol; - if (m != null && m.coroutine && !is_yield_expression) { - // begin or end call of async method + if (m != null && m.coroutine) { var ma = (MemberAccess) call; - if (ma.member_name != "end") { - // begin (possibly implicit) - params = m.get_async_begin_parameters (); - ret_type = new VoidType (); - } else { - // end - params = m.get_async_end_parameters (); + if (!is_yield_expression) { + // begin or end call of async method + if (ma.member_name != "end") { + // begin (possibly implicit) + params = m.get_async_begin_parameters (); + ret_type = new VoidType (); + } else { + // end + params = m.get_async_end_parameters (); + } + } else if (ma.member_name == "begin" || ma.member_name == "end") { + error = true; + Report.error (ma.source_reference, "use of `%s' not allowed in yield statement".printf (ma.member_name)); } }