vala r809 - in trunk: . gobject tests



Author: juergbi
Date: Tue Jan  8 17:49:49 2008
New Revision: 809
URL: http://svn.gnome.org/viewvc/vala?rev=809&view=rev

Log:
2008-01-08  Juerg Billeter  <j bitron ch>

	* gobject/valaccodegenerator.vala: fix memory management with simple
	  conditional expressions, fixes bug 501587

	* tests/expressions-conditional.exp, tests/expressions-conditional.vala:
	  test conditional expression with strings


Modified:
   trunk/ChangeLog
   trunk/gobject/valaccodegenerator.vala
   trunk/tests/expressions-conditional.exp
   trunk/tests/expressions-conditional.vala

Modified: trunk/gobject/valaccodegenerator.vala
==============================================================================
--- trunk/gobject/valaccodegenerator.vala	(original)
+++ trunk/gobject/valaccodegenerator.vala	Tue Jan  8 17:49:49 2008
@@ -2665,6 +2665,8 @@
 
 	public override void visit_conditional_expression (ConditionalExpression! expr) {
 		expr.ccodenode = new CCodeConditionalExpression ((CCodeExpression) expr.condition.ccodenode, (CCodeExpression) expr.true_expression.ccodenode, (CCodeExpression) expr.false_expression.ccodenode);
+
+		visit_expression (expr);
 	}
 
 	public override void visit_lambda_expression (LambdaExpression! l) {

Modified: trunk/tests/expressions-conditional.exp
==============================================================================
--- trunk/tests/expressions-conditional.exp	(original)
+++ trunk/tests/expressions-conditional.exp	Tue Jan  8 17:49:49 2008
@@ -1 +1 @@
-Conditional Expression Test: 1 2 3
+Conditional Expression Test: 1 2 3 4 5

Modified: trunk/tests/expressions-conditional.vala
==============================================================================
--- trunk/tests/expressions-conditional.vala	(original)
+++ trunk/tests/expressions-conditional.vala	Tue Jan  8 17:49:49 2008
@@ -1,13 +1,21 @@
 using GLib;
 
 class Maman.Bar : Object {
+	private static string get_number () {
+		return false ? "BAD" : "4";
+	}
+
 	static int main (string[] args) {
 		stdout.printf ("Conditional Expression Test: 1");
-		
+
 		stdout.printf (" %d", false ? -1 : 2);
-		
-		stdout.printf (" 3\n");
-		
+
+		stdout.printf (" 3");
+
+		stdout.printf (" %s", get_number ());
+
+		stdout.printf (" 5\n");
+
 		return 0;
 	}
 }



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