[vala] Fix member access when overriding signal class handler



commit 0a2d6e9f056845bca9e21f62f8e75d25f67c29cf
Author: Jürg Billeter <j bitron ch>
Date:   Sun Mar 29 14:52:39 2009 +0200

    Fix member access when overriding signal class handler
    
    Fixes bug 575475.
---
 vala/valamemberaccess.vala |   10 +++++++++-
 vala/valamethod.vala       |    2 ++
 vala/valasignal.vala       |    4 +++-
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/vala/valamemberaccess.vala b/vala/valamemberaccess.vala
index 8a421b7..1ddb39d 100644
--- a/vala/valamemberaccess.vala
+++ b/vala/valamemberaccess.vala
@@ -412,7 +412,15 @@ public class Vala.MemberAccess : Expression {
 			if (m.base_method != null) {
 				// refer to base method to inherit default arguments
 				m = m.base_method;
-				symbol_reference = m;
+
+				if (m.signal_reference != null) {
+					// method is class/default handler for a signal
+					// let signal deal with member access
+					symbol_reference = m.signal_reference;
+				} else {
+					symbol_reference = m;
+				}
+
 				member = symbol_reference;
 			} else if (m.base_interface_method != null) {
 				// refer to base method to inherit default arguments
diff --git a/vala/valamethod.vala b/vala/valamethod.vala
index ae3207e..fc8ad15 100644
--- a/vala/valamethod.vala
+++ b/vala/valamethod.vala
@@ -198,6 +198,8 @@ public class Vala.Method : Member {
 	 */
 	public bool has_construct_function { get; set; default = true; }
 
+	public weak Signal signal_reference { get; set; }
+
 	public bool coroutine { get; set; }
 
 	private Gee.List<FormalParameter> parameters = new ArrayList<FormalParameter> ();
diff --git a/vala/valasignal.vala b/vala/valasignal.vala
index b4dcc7d..6e8e785 100644
--- a/vala/valasignal.vala
+++ b/vala/valasignal.vala
@@ -1,6 +1,6 @@
 /* valasignal.vala
  *
- * Copyright (C) 2006-2008  Jürg Billeter
+ * Copyright (C) 2006-2009  Jürg Billeter
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -210,8 +210,10 @@ public class Vala.Signal : Member, Lockable {
 
 		if (generated_method == null) {
 			generated_method = new Method (name, return_type, source_reference);
+			generated_method.access = access;
 			generated_method.is_virtual = true;
 			generated_method.vfunc_name = name;
+			generated_method.signal_reference = this;
 
 			foreach (FormalParameter param in parameters) {
 				generated_method.add_parameter (param);



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