]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Fix crash on array creation expressions throwing errors
authorJürg Billeter <j@bitron.ch>
Sun, 10 Jan 2010 14:06:23 +0000 (15:06 +0100)
committerJürg Billeter <j@bitron.ch>
Sun, 10 Jan 2010 14:13:53 +0000 (15:13 +0100)
Fixes bug 606503.

vala/valaarraycreationexpression.vala

index 34fbd4e7a620cb08c1754ad517b9811d0d4b4b33..c2cb9af9ac8e1aac14f196663618aa09ebae236d 100644 (file)
@@ -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;