Re: [Vala] don't emit code past return or goto statements
- From: pancake <pancake youterm com>
- To: vala paldo org
- Subject: Re: [Vala] don't emit code past return or goto statements
- Date: Tue, 6 Nov 2007 22:22:49 +0100
Thanks!
This was one of the things I wanted to fix and was unable to find the right place.
I have not much time to read sources these days... :"
I'll try later this patch.
On Tue, Nov 06, 2007 at 08:17:27PM +0100, Ond?ej Jirman wrote:
This is just a little code emitor improvement.
o.j.
From 7356dd2ca01728c2717c88c56634aa68ce498e3f Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <ondrej jirman zonio net>
Date: Tue, 30 Oct 2007 17:23:59 +0100
Subject: [PATCH] don't emit useless code past goto or return statements
---
ccode/valaccodeblock.vala | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/ccode/valaccodeblock.vala b/ccode/valaccodeblock.vala
index d3df316..bf4a02e 100644
--- a/ccode/valaccodeblock.vala
+++ b/ccode/valaccodeblock.vala
@@ -55,8 +55,18 @@ public class Vala.CCodeBlock : CCodeStatement {
foreach (CCodeNode statement in statements) {
statement.write_declaration (writer);
}
+ weak 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;
+ if (statement is CCodeLabel)
+ last_statement = null;
+ }
_______________________________________________
Vala mailing list
Vala paldo org
http://www.paldo.org/mailman/listinfo/vala
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]