vala r1006 - in trunk: . vala



Author: juergbi
Date: Tue Feb 12 18:00:47 2008
New Revision: 1006
URL: http://svn.gnome.org/viewvc/vala?rev=1006&view=rev

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

	* vala/valaelementaccess.vala: fix crash when using prefix
	  increment in element access expression, fixes bug 515733


Modified:
   trunk/ChangeLog
   trunk/vala/valaelementaccess.vala

Modified: trunk/vala/valaelementaccess.vala
==============================================================================
--- trunk/vala/valaelementaccess.vala	(original)
+++ trunk/vala/valaelementaccess.vala	Tue Feb 12 18:00:47 2008
@@ -1,6 +1,6 @@
 /* valaelementaccess.vala
  *
- * Copyright (C) 2006-2007  Raffaele Sandrini, JÃrg Billeter
+ * Copyright (C) 2006-2008  Raffaele Sandrini, 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
@@ -37,11 +37,12 @@
 	 * Expressions representing the indices we want to access inside the container.
 	 */
 	private Gee.List<Expression>! indices = new ArrayList<Expression> ();
-	
+
 	public void append_index (Expression! index) {
 		indices.add (index);
+		index.parent_node = this;
 	}
-	
+
 	public Gee.List<Expression> get_indices () {
 		return new ReadOnlyList<Expression> (indices);
 	}
@@ -58,6 +59,18 @@
 		visitor.visit_element_access (this);
 	}
 
+	public override void replace_expression (Expression! old_node, Expression! new_node) {
+		if (container == old_node) {
+			container = new_node;
+		}
+		
+		int index = indices.index_of (old_node);
+		if (index >= 0 && new_node.parent_node == null) {
+			indices[index] = new_node;
+			new_node.parent_node = this;
+		}
+	}
+
 	public override bool is_pure () {
 		foreach (Expression index in indices) {
 			if (!index.is_pure ()) {



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