vala r1457 - in trunk: . vala



Author: jamiemcc
Date: Tue May 27 05:05:28 2008
New Revision: 1457
URL: http://svn.gnome.org/viewvc/vala?rev=1457&view=rev

Log:
2008-05-27  Jamie McCracken  <jamiemcc gnome org>

	* vala/valagenieparser.vala: 
	
	Improved performance of print statement


Modified:
   trunk/ChangeLog
   trunk/vala/valagenieparser.vala

Modified: trunk/vala/valagenieparser.vala
==============================================================================
--- trunk/vala/valagenieparser.vala	(original)
+++ trunk/vala/valagenieparser.vala	Tue May 27 05:05:28 2008
@@ -638,9 +638,22 @@
 					i++;
 					
 					if (p_expr != null) { 
-						string s = "\"\\n\"";
-						var rhs = new StringLiteral (s, get_src (begin));
-						p_expr = new BinaryExpression (BinaryOperator.PLUS, p_expr, rhs, get_src (begin));
+						string s = "\\n\"";
+						
+						if (p_expr is StringLiteral) {
+							var s_exp = (StringLiteral) p_expr;
+							var len = s_exp.value.size ();
+							
+							if (len > 2) {
+								var st =  s_exp.value.ndup (len-1);
+								st += s;
+								s_exp.value = st;
+							}
+						} else {
+							string s = "\"\\n\"";
+							var rhs = new StringLiteral (s, get_src (begin));
+							p_expr = new BinaryExpression (BinaryOperator.PLUS, p_expr, rhs, get_src (begin));
+						}
 					}
 				
 				} 



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