[vala] Fix crash with certain default arguments



commit 4b06a6761786b321e3be7293dbc4f6192569f711
Author: Jürg Billeter <j bitron ch>
Date:   Mon Aug 31 21:44:35 2009 +0200

    Fix crash with certain default arguments
    
    Fixes bug 593499.

 vala/valaformalparameter.vala |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/vala/valaformalparameter.vala b/vala/valaformalparameter.vala
index 021ecbe..fe22e28 100644
--- a/vala/valaformalparameter.vala
+++ b/vala/valaformalparameter.vala
@@ -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");



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