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
}
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;
}
}
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 ();