2008-02-12 Jürg Billeter <j@bitron.ch>
+ * vala/valaelementaccess.vala: fix crash when using prefix
+ increment in element access expression, fixes bug 515733
+
+2008-02-12 Jürg Billeter <j@bitron.ch>
+
* gobject/valaccodegenerator.vala: fix using instance methods as
delegates in the constructor
/* 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
* 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);
}
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 ()) {