[vala] Fix .begin and .end on async methods using generic types



commit e63a6456521bf4c6202339a68a1bfa09015da5a8
Author: JÃrg Billeter <j bitron ch>
Date:   Fri Jun 17 12:48:32 2011 +0200

    Fix .begin and .end on async methods using generic types
    
    Fixes bug 652763.

 vala/valamethodcall.vala |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/vala/valamethodcall.vala b/vala/valamethodcall.vala
index 23329bd..1f6b6a8 100644
--- a/vala/valamethodcall.vala
+++ b/vala/valamethodcall.vala
@@ -184,6 +184,21 @@ public class Vala.MethodCall : Expression {
 						target_object_type = sig.inner.value_type;
 					}
 				}
+
+				// foo is relevant instance in foo.bar.begin (bar_ready) and foo.bar.end (result)
+				var m = ma.symbol_reference as Method;
+				if (m != null && m.coroutine) {
+					// begin or end call of async method
+					if (ma.member_name == "begin" || ma.member_name == "end") {
+						var method_access = ma.inner as MemberAccess;
+						if (method_access != null && method_access.inner != null) {
+							target_object_type = method_access.inner.value_type;
+						} else {
+							// static method
+							target_object_type = null;
+						}
+					}
+				}
 			}
 
 			if (ma.symbol_reference != null && ma.symbol_reference.get_attribute ("Assert") != null) {



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