[vala] Fix crash when creating structs in member initializer



commit accc2080755543a4b183549b47d268e3f329d85e
Author: Jürg Billeter <j bitron ch>
Date:   Sat Sep 5 14:09:06 2009 +0200

    Fix crash when creating structs in member initializer

 vala/valamemberinitializer.vala |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/vala/valamemberinitializer.vala b/vala/valamemberinitializer.vala
index 3ca96b6..2057e31 100644
--- a/vala/valamemberinitializer.vala
+++ b/vala/valamemberinitializer.vala
@@ -1,6 +1,6 @@
 /* valamemberinitializer.vala
  *
- * Copyright (C) 2007  Jürg Billeter
+ * Copyright (C) 2007-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
@@ -35,13 +35,21 @@ public class Vala.MemberInitializer : CodeNode {
 	/**
 	 * Initializer expression.
 	 */
-	public Expression initializer { get; set; }
+	public Expression initializer {
+		get { return _initializer; }
+		set {
+			_initializer = value;
+			_initializer.parent_node = this;
+		}
+	}
 
 	/**
 	 * The symbol this expression refers to.
 	 */
 	public weak Symbol symbol_reference { get; set; }
 
+	Expression _initializer;
+
 	/**
 	 * Creates a new member initializer.
 	 *
@@ -63,5 +71,11 @@ public class Vala.MemberInitializer : CodeNode {
 	public override bool check (SemanticAnalyzer analyzer) {
 		return initializer.check (analyzer);
 	}
+
+	public override void replace_expression (Expression old_node, Expression new_node) {
+		if (initializer == old_node) {
+			initializer = new_node;
+		}
+	}
 }
 



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