vala r1173 - in trunk: . ccode



Author: juergbi
Date: Mon Apr  7 15:26:05 2008
New Revision: 1173
URL: http://svn.gnome.org/viewvc/vala?rev=1173&view=rev

Log:
2008-04-07  Juerg Billeter  <j bitron ch>

	* ccode/valaccodeblock.vala, ccode/valaccodeincludedirective.vala:
	  two small optimizations, patch by Jaap A. Haitsma, fixes bug 526243


Modified:
   trunk/ChangeLog
   trunk/ccode/valaccodeblock.vala
   trunk/ccode/valaccodeincludedirective.vala

Modified: trunk/ccode/valaccodeblock.vala
==============================================================================
--- trunk/ccode/valaccodeblock.vala	(original)
+++ trunk/ccode/valaccodeblock.vala	Mon Apr  7 15:26:05 2008
@@ -51,20 +51,19 @@
 	}
 	
 	public override void write (CCodeWriter! writer) {
+		// the last reachable statement
+		CCodeNode last_statement = null;
+
 		writer.write_begin_block ();
 		foreach (CCodeNode statement in statements) {
 			statement.write_declaration (writer);
-		}
 
-		// compute last reachable statement
-		CCodeNode last_statement = null;
-		foreach (CCodeNode statement in statements) {
-			if (statement is CCodeReturnStatement || statement is CCodeGotoStatement
-			|| statement is CCodeContinueStatement || statement is CCodeBreakStatement) {
-				last_statement = statement;
-			}
+			// determine last reachable statement
 			if (statement is CCodeLabel) {
 				last_statement = null;
+			} else if (statement is CCodeReturnStatement || statement is CCodeGotoStatement
+			|| statement is CCodeContinueStatement || statement is CCodeBreakStatement) {
+				last_statement = statement;
 			}
 		}
 

Modified: trunk/ccode/valaccodeincludedirective.vala
==============================================================================
--- trunk/ccode/valaccodeincludedirective.vala	(original)
+++ trunk/ccode/valaccodeincludedirective.vala	Mon Apr  7 15:26:05 2008
@@ -47,13 +47,11 @@
 		writer.write_string ("#include ");
 		if (local) {
 			writer.write_string ("\"");
-		} else {
-			writer.write_string ("<");
-		}
-		writer.write_string (filename);
-		if (local) {
+			writer.write_string (filename);
 			writer.write_string ("\"");
 		} else {
+			writer.write_string ("<");
+			writer.write_string (filename);
 			writer.write_string (">");
 		}
 		writer.write_newline ();



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