From d7e4926ec6d1cf972a41a4383090f22bdf487f91 Mon Sep 17 00:00:00 2001 From: Luca Bruno Date: Sat, 28 May 2011 10:49:02 +0200 Subject: [PATCH] Enable control flow analysis for variable declarations Fixes bug 651311. --- vala/valaflowanalyzer.vala | 8 ++++++++ 1 file changed, 8 insertions(+) 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); -- 2.47.2