two small optimizations, patch by Jaap A. Haitsma, fixes bug 526243
authorJuerg Billeter <j@bitron.ch>
Mon, 7 Apr 2008 14:26:05 +0000 (14:26 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Mon, 7 Apr 2008 14:26:05 +0000 (14:26 +0000)
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

svn path=/trunk/; revision=1173

ChangeLog
ccode/valaccodeblock.vala
ccode/valaccodeincludedirective.vala

index ad16e8b..85d22d4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2008-04-07  Jürg Billeter  <j@bitron.ch>
 
+       * ccode/valaccodeblock.vala, ccode/valaccodeincludedirective.vala:
+         two small optimizations, patch by Jaap A. Haitsma, fixes bug 526243
+
+2008-04-07  Jürg Billeter  <j@bitron.ch>
+
        * vala/valasemanticanalyzer.vala: fix spurious error when
          overriding abstract method in derived abstract class,
          fixes bug 523263
index 8ac4d74..2aa5bd1 100644 (file)
@@ -51,20 +51,19 @@ public class Vala.CCodeBlock : CCodeStatement {
        }
        
        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;
                        }
                }
 
index 18cf052..b7a6311 100644 (file)
@@ -47,13 +47,11 @@ public class Vala.CCodeIncludeDirective : CCodeNode {
                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 ();