[vala] Fix crash on array creation expressions throwing errors



commit 3a8fa50dbd7235f193b072ec8736bf5abfe902a6
Author: Jürg Billeter <j bitron ch>
Date:   Sun Jan 10 15:06:23 2010 +0100

    Fix crash on array creation expressions throwing errors
    
    Fixes bug 606503.

 vala/valaarraycreationexpression.vala |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/vala/valaarraycreationexpression.vala b/vala/valaarraycreationexpression.vala
index 34fbd4e..c2cb9af 100644
--- a/vala/valaarraycreationexpression.vala
+++ b/vala/valaarraycreationexpression.vala
@@ -1,6 +1,6 @@
 /* valaarraycreationexpression.vala
  *
- * Copyright (C) 2006-2009  Jürg Billeter
+ * Copyright (C) 2006-2010  Jürg Billeter
  * Copyright (C) 2006-2008  Raffaele Sandrini
  *
  * This library is free software; you can redistribute it and/or
@@ -70,6 +70,9 @@ public class Vala.ArrayCreationExpression : Expression {
 	 */
 	public void append_size (Expression size) {
 		sizes.add (size);
+		if (size != null) {
+			size.parent_node = this;
+		}
 	}
 	
 	/**
@@ -110,6 +113,15 @@ public class Vala.ArrayCreationExpression : Expression {
 		return false;
 	}
 
+	public override void replace_expression (Expression old_node, Expression new_node) {
+		for (int i = 0; i < sizes.size; i++) {
+			if (sizes[i] == old_node) {
+				sizes[i] = new_node;
+				return;
+			}
+		}
+	}
+
 	public override void replace_type (DataType old_type, DataType new_type) {
 		if (element_type == old_type) {
 			element_type = new_type;



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