vala r1067 - in trunk: . vala



Author: juergbi
Date: Fri Feb 29 21:41:44 2008
New Revision: 1067
URL: http://svn.gnome.org/viewvc/vala?rev=1067&view=rev

Log:
2008-02-29  Juerg Billeter  <j bitron ch>

	* vala/valabinaryexpression.vala, vala/valaunaryexpression.vala:
	  support binary expressions in default arguments


Modified:
   trunk/ChangeLog
   trunk/vala/valabinaryexpression.vala
   trunk/vala/valaunaryexpression.vala

Modified: trunk/vala/valabinaryexpression.vala
==============================================================================
--- trunk/vala/valabinaryexpression.vala	(original)
+++ trunk/vala/valabinaryexpression.vala	Fri Feb 29 21:41:44 2008
@@ -1,6 +1,6 @@
 /* valabinaryexpression.vala
  *
- * Copyright (C) 2006-2007  JÃrg Billeter
+ * Copyright (C) 2006-2008  JÃrg Billeter
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -94,6 +94,36 @@
 		}
 	}
 
+	private string! get_operator_string () {
+		switch (_operator) {
+		case BinaryOperator.PLUS: return "+";
+		case BinaryOperator.MINUS: return "-";
+		case BinaryOperator.MUL: return "*";
+		case BinaryOperator.DIV: return "/";
+		case BinaryOperator.MOD: return "%";
+		case BinaryOperator.SHIFT_LEFT: return "<<";
+		case BinaryOperator.SHIFT_RIGHT: return ">>";
+		case BinaryOperator.LESS_THAN: return "<";
+		case BinaryOperator.GREATER_THAN: return ">";
+		case BinaryOperator.LESS_THAN_OR_EQUAL: return "<=";
+		case BinaryOperator.GREATER_THAN_OR_EQUAL: return ">=";
+		case BinaryOperator.EQUALITY: return "==";
+		case BinaryOperator.INEQUALITY: return "!+";
+		case BinaryOperator.BITWISE_AND: return "&";
+		case BinaryOperator.BITWISE_OR: return "|";
+		case BinaryOperator.BITWISE_XOR: return "^";
+		case BinaryOperator.AND: return "&&";
+		case BinaryOperator.OR: return "||";
+		case BinaryOperator.IN: return "in";
+		}
+
+		assert_not_reached ();
+	}
+
+	public override string! to_string () {
+		return _left.to_string () + get_operator_string () + _right.to_string ();
+	}
+
 	public override bool is_pure () {
 		return left.is_pure () && right.is_pure ();
 	}

Modified: trunk/vala/valaunaryexpression.vala
==============================================================================
--- trunk/vala/valaunaryexpression.vala	(original)
+++ trunk/vala/valaunaryexpression.vala	Fri Feb 29 21:41:44 2008
@@ -1,6 +1,6 @@
 /* valaunaryexpression.vala
  *
- * Copyright (C) 2006-2007  JÃrg Billeter
+ * Copyright (C) 2006-2008  JÃrg Billeter
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -74,25 +74,23 @@
 		}
 	}
 
-	public string! operator_string {
-		get {
-			switch (_operator) {
-				case UnaryOperator.PLUS: return "+";
-				case UnaryOperator.MINUS: return "-";
-				case UnaryOperator.LOGICAL_NEGATION: return "!";
-				case UnaryOperator.BITWISE_COMPLEMENT: return "~";
-				case UnaryOperator.INCREMENT: return "++";
-				case UnaryOperator.DECREMENT: return "--";
-				case UnaryOperator.REF: return "ref ";
-				case UnaryOperator.OUT: return "out ";
-			}
-
-			assert_not_reached ();
+	private string! get_operator_string () {
+		switch (_operator) {
+		case UnaryOperator.PLUS: return "+";
+		case UnaryOperator.MINUS: return "-";
+		case UnaryOperator.LOGICAL_NEGATION: return "!";
+		case UnaryOperator.BITWISE_COMPLEMENT: return "~";
+		case UnaryOperator.INCREMENT: return "++";
+		case UnaryOperator.DECREMENT: return "--";
+		case UnaryOperator.REF: return "ref ";
+		case UnaryOperator.OUT: return "out ";
 		}
+
+		assert_not_reached ();
 	}
 
 	public override string! to_string () {
-		return operator_string + _inner.to_string ();
+		return get_operator_string () + _inner.to_string ();
 	}
 
 	public override bool is_pure () {



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