[vala/wip/transform: 50/50] codegen: Do not emit empty blocks
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/transform: 50/50] codegen: Do not emit empty blocks
- Date: Fri, 13 Apr 2012 13:11:27 +0000 (UTC)
commit 0058fd6295e8ad20f39014a6d365efdeae99a65e
Author: Luca Bruno <lucabru src gnome org>
Date: Fri Apr 13 15:06:16 2012 +0200
codegen: Do not emit empty blocks
ccode/valaccodeblock.vala | 4 ++++
vala/valablock.vala | 1 -
2 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/ccode/valaccodeblock.vala b/ccode/valaccodeblock.vala
index 5c8f2c7..1b87089 100644
--- a/ccode/valaccodeblock.vala
+++ b/ccode/valaccodeblock.vala
@@ -50,6 +50,10 @@ public class Vala.CCodeBlock : CCodeStatement {
}
public override void write (CCodeWriter writer) {
+ if (statements.size == 0) {
+ return;
+ }
+
// the last reachable statement
CCodeNode last_statement = null;
diff --git a/vala/valablock.vala b/vala/valablock.vala
index 488c499..465b4ab 100644
--- a/vala/valablock.vala
+++ b/vala/valablock.vala
@@ -175,7 +175,6 @@ public class Vala.Block : Symbol, Statement {
if (source_reference == null) {
source_reference = this.source_reference;
}
- // use get_statements () instead of statement_list to not miss errors within StatementList objects
foreach (Statement stmt in this) {
stmt.get_error_types (collection, source_reference);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]