]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
flowanalyzer: Add helper to query visible version of variable
authorTimm Bäder <mail@baedert.org>
Tue, 8 Nov 2016 06:24:44 +0000 (07:24 +0100)
committerTimm Bäder <mail@baedert.org>
Tue, 8 Nov 2016 06:24:44 +0000 (07:24 +0100)
vala/valaflowanalyzer.vala

index 4f44177f5794747a691e9726b6ffc64ac96c022c..e96d0b173063c27891d0170434b2a6663680717b 100644 (file)
@@ -1099,4 +1099,12 @@ public class Vala.FlowAnalyzer : CodeVisitor {
                current_block = null;
                unreachable_reported = false;
        }
+
+       public Variable get_visible_variable (Variable variable) {
+               var variable_stack = var_map.get (variable);
+               if (variable_stack == null || variable_stack.size == 0)
+                       return variable;
+
+               return variable_stack.get (variable_stack.size - 1);
+       }
 }