vala r1005 - in trunk: . gobject



Author: juergbi
Date: Tue Feb 12 17:39:06 2008
New Revision: 1005
URL: http://svn.gnome.org/viewvc/vala?rev=1005&view=rev

Log:
2008-02-12  Juerg Billeter  <j bitron ch>

	* gobject/valaccodegenerator.vala: fix using instance methods as
	  delegates in the constructor


Modified:
   trunk/ChangeLog
   trunk/gobject/valaccodegenerator.vala

Modified: trunk/gobject/valaccodegenerator.vala
==============================================================================
--- trunk/gobject/valaccodegenerator.vala	(original)
+++ trunk/gobject/valaccodegenerator.vala	Tue Feb 12 17:39:06 2008
@@ -77,6 +77,7 @@
 	private int current_try_id = 0;
 	private int next_try_id = 0;
 	public bool in_creation_method = false;
+	private bool in_constructor = false;
 	private bool current_method_inner_error = false;
 
 	public DataType bool_type;
@@ -752,9 +753,12 @@
 
 	public override void visit_constructor (Constructor! c) {
 		current_method_inner_error = false;
+		in_constructor = true;
 
 		c.accept_children (this);
 
+		in_constructor = false;
+
 		var cl = (Class) c.parent_symbol;
 	
 		function = new CCodeFunction ("%s_constructor".printf (cl.get_lower_case_cname (null)), "GObject *");
@@ -2406,7 +2410,7 @@
 			} else if (delegate_expr.symbol_reference is Method) {
 				var ma = (MemberAccess) delegate_expr;
 				if (ma.inner == null) {
-					if (current_method != null && current_method.instance) {
+					if ((current_method != null && current_method.instance) || in_constructor) {
 						return new CCodeIdentifier ("self");
 					} else {
 						return new CCodeConstant ("NULL");



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