]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Fix crash with certain default arguments
authorJürg Billeter <j@bitron.ch>
Mon, 31 Aug 2009 19:44:35 +0000 (21:44 +0200)
committerJürg Billeter <j@bitron.ch>
Mon, 31 Aug 2009 19:44:35 +0000 (21:44 +0200)
Fixes bug 593499.

vala/valaformalparameter.vala

index 021ecbe344758ce4595cd03ee15bc4dfdfdb89a9..fe22e2830e0892ffc3e66584a233ce7089736000 100644 (file)
@@ -58,7 +58,15 @@ public class Vala.FormalParameter : Symbol {
         * Specifies the expression used when the caller doesn't supply an
         * argument for this parameter.
         */
-       public Expression default_expression { get; set; }
+       public Expression? default_expression {
+               get { return _default_expression; }
+               set {
+                       _default_expression = value;
+                       if (_default_expression != null) {
+                               _default_expression.parent_node = this;
+                       }
+               }
+       }
        
        /**
         * Specifies whether the array length should be passed implicitly
@@ -100,6 +108,7 @@ public class Vala.FormalParameter : Symbol {
        public string? ctype { get; set; }
 
        private DataType _data_type;
+       private Expression? _default_expression;
 
        /**
         * Creates a new formal parameter.
@@ -147,6 +156,12 @@ public class Vala.FormalParameter : Symbol {
                }
        }
 
+       public override void replace_expression (Expression old_node, Expression new_node) {
+               if (default_expression == old_node) {
+                       default_expression = new_node;
+               }
+       }
+
        private void process_ccode_attribute (Attribute a) {
                if (a.has_argument ("type")) {
                        ctype = a.get_string ("type");