From: Luca Bruno Date: Sat, 28 May 2011 08:49:02 +0000 (+0200) Subject: Enable control flow analysis for variable declarations X-Git-Tag: 0.12.1~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d7e4926ec6d1cf972a41a4383090f22bdf487f91;p=thirdparty%2Fvala.git Enable control flow analysis for variable declarations Fixes bug 651311. --- diff --git a/vala/valaflowanalyzer.vala b/vala/valaflowanalyzer.vala index c57ade730..c17b77b6c 100644 --- a/vala/valaflowanalyzer.vala +++ b/vala/valaflowanalyzer.vala @@ -517,6 +517,8 @@ public class Vala.FlowAnalyzer : CodeVisitor { } public override void visit_declaration_statement (DeclarationStatement stmt) { + stmt.accept_children (this); + if (unreachable (stmt)) { stmt.declaration.unreachable = true; return; @@ -534,6 +536,12 @@ public class Vala.FlowAnalyzer : CodeVisitor { } } + public override void visit_local_variable (LocalVariable local) { + if (local.initializer != null) { + local.initializer.accept (this); + } + } + public override void visit_expression_statement (ExpressionStatement stmt) { stmt.accept_children (this);