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; + }
Attachment:
0001-don-t-emit-useless-code-past-goto-or-return-statemen.patch
Description: application/mbox