[vala/1270-remove-static-codecontext-access] FlowAnalyzer: use instance context's report log method



commit 6b92ebfd8773ad84bc1b00e782a61d904975060b
Author: Daniel Espinosa <esodan gmail com>
Date:   Wed Dec 29 00:24:01 2021 -0600

    FlowAnalyzer: use instance context's report log method
    
    Avoid to access static Report methods

 vala/valaflowanalyzer.vala | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)
---
diff --git a/vala/valaflowanalyzer.vala b/vala/valaflowanalyzer.vala
index a5a8be993..f6ebd227d 100644
--- a/vala/valaflowanalyzer.vala
+++ b/vala/valaflowanalyzer.vala
@@ -146,7 +146,7 @@ public class Vala.FlowAnalyzer : CodeVisitor {
                        if (!f.is_private_symbol () && (context.internal_header_filename != null || 
context.use_fast_vapi)) {
                                // do not warn if internal member may be used outside this compilation unit
                        } else {
-                               Report.warning (f.source_reference, "Field `%s' never used", f.get_full_name 
());
+                               context.report.log_warning (f.source_reference, "Field `%s' never used", 
f.get_full_name ());
                        }
                }
        }
@@ -175,7 +175,7 @@ public class Vala.FlowAnalyzer : CodeVisitor {
                            && m.get_attribute_bool ("DBus", "visible", true)) {
                                // do not warn if internal member is a visible DBus method
                        } else {
-                               Report.warning (m.source_reference, "Method `%s' never used", m.get_full_name 
());
+                               context.report.log_warning (m.source_reference, "Method `%s' never used", 
m.get_full_name ());
                        }
                }
 
@@ -230,7 +230,7 @@ public class Vala.FlowAnalyzer : CodeVisitor {
                        // end of method body reachable
 
                        if (m.has_result) {
-                               Report.error (m.source_reference, "missing return statement at end of 
subroutine body");
+                               context.report.log_error (m.source_reference, "missing return statement at 
end of subroutine body");
                                m.error = true;
                        }
 
@@ -424,10 +424,10 @@ public class Vala.FlowAnalyzer : CodeVisitor {
                                foreach (Variable variable in phi.operands) {
                                        if (variable == null) {
                                                if (used_var is LocalVariable) {
-                                                       Report.error (used_var.source_reference, "Use of 
possibly unassigned local variable `%s'", used_var.name);
+                                                       context.report.log_error (used_var.source_reference, 
"Use of possibly unassigned local variable `%s'", used_var.name);
                                                } else {
                                                        // parameter
-                                                       Report.warning (used_var.source_reference, "Use of 
possibly unassigned parameter `%s'", used_var.name);
+                                                       context.report.log_warning 
(used_var.source_reference, "Use of possibly unassigned parameter `%s'", used_var.name);
                                                }
                                                continue;
                                        }
@@ -460,10 +460,10 @@ public class Vala.FlowAnalyzer : CodeVisitor {
                                var variable_stack = var_map.get (var_symbol);
                                if (variable_stack == null || variable_stack.size == 0) {
                                        if (var_symbol is LocalVariable) {
-                                               Report.error (node.source_reference, "Use of possibly 
unassigned local variable `%s'", var_symbol.name);
+                                               context.report.log_error (node.source_reference, "Use of 
possibly unassigned local variable `%s'", var_symbol.name);
                                        } else {
                                                // parameter
-                                               Report.warning (node.source_reference, "Use of possibly 
unassigned parameter `%s'", var_symbol.name);
+                                               context.report.log_warning (node.source_reference, "Use of 
possibly unassigned parameter `%s'", var_symbol.name);
                                        }
                                        continue;
                                }
@@ -563,7 +563,7 @@ public class Vala.FlowAnalyzer : CodeVisitor {
                }
 
                if (!stmt.declaration.used) {
-                       Report.warning (stmt.declaration.source_reference, "Local variable `%s' declared but 
never used", stmt.declaration.name);
+                       context.report.log_warning (stmt.declaration.source_reference, "Local variable `%s' 
declared but never used", stmt.declaration.name);
                }
 
                current_block.add_node (stmt);
@@ -714,7 +714,7 @@ public class Vala.FlowAnalyzer : CodeVisitor {
                                // end of switch section reachable
                                // we don't allow fall-through
 
-                               Report.error (section.source_reference, "missing break statement at end of 
switch section");
+                               context.report.log_error (section.source_reference, "missing break statement 
at end of switch section");
                                section.error = true;
 
                                current_block.connect (after_switch_block);
@@ -735,7 +735,7 @@ public class Vala.FlowAnalyzer : CodeVisitor {
                                foreach (var val in remaining_values) {
                                        missing_vals += val.name;
                                }
-                               Report.warning (stmt.source_reference, "Switch does not handle `%s' of enum 
`%s'", string.joinv ("', `", missing_vals), en.get_full_name ());
+                               context.report.log_warning (stmt.source_reference, "Switch does not handle 
`%s' of enum `%s'", string.joinv ("', `", missing_vals), en.get_full_name ());
                        }
                }
 
@@ -847,7 +847,7 @@ public class Vala.FlowAnalyzer : CodeVisitor {
                        }
                }
 
-               Report.error (stmt.source_reference, "no enclosing loop or switch statement found");
+               context.report.log_error (stmt.source_reference, "no enclosing loop or switch statement 
found");
                stmt.error = true;
        }
 
@@ -870,7 +870,7 @@ public class Vala.FlowAnalyzer : CodeVisitor {
                        }
                }
 
-               Report.error (stmt.source_reference, "no enclosing loop found");
+               context.report.log_error (stmt.source_reference, "no enclosing loop found");
                stmt.error = true;
        }
 
@@ -899,7 +899,7 @@ public class Vala.FlowAnalyzer : CodeVisitor {
                        }
                }
 
-               Report.error (stmt.source_reference, "no enclosing loop found");
+               context.report.log_error (stmt.source_reference, "no enclosing loop found");
                stmt.error = true;
        }
 
@@ -1011,7 +1011,7 @@ public class Vala.FlowAnalyzer : CodeVisitor {
 
                        if (invalid_block.get_predecessors ().size > 0) {
                                // don't allow finally blocks with e.g. return statements
-                               Report.error (stmt.source_reference, "jump out of finally block not 
permitted");
+                               context.report.log_error (stmt.source_reference, "jump out of finally block 
not permitted");
                                stmt.error = true;
                                return;
                        }
@@ -1070,12 +1070,12 @@ public class Vala.FlowAnalyzer : CodeVisitor {
                                if (context.profile == Profile.GOBJECT) {
                                        if (prev_target.error_domain == jump_target.error_domain &&
                                            prev_target.error_code == jump_target.error_code) {
-                                               Report.error (stmt.source_reference, "double catch clause of 
same error detected");
+                                               context.report.log_error (stmt.source_reference, "double 
catch clause of same error detected");
                                                stmt.error = true;
                                                return;
                                        }
                                } else if (prev_target.error_class == jump_target.error_class) {
-                                       Report.error (stmt.source_reference, "double catch clause of same 
error detected");
+                                       context.report.log_error (stmt.source_reference, "double catch clause 
of same error detected");
                                        stmt.error = true;
                                        return;
                                }
@@ -1083,7 +1083,7 @@ public class Vala.FlowAnalyzer : CodeVisitor {
 
                        if (jump_target.basic_block.get_predecessors ().size == 0) {
                                // unreachable
-                               Report.warning (jump_target.catch_clause.source_reference, "unreachable catch 
clause detected");
+                               context.report.log_warning (jump_target.catch_clause.source_reference, 
"unreachable catch clause detected");
                        } else {
                                current_block = jump_target.basic_block;
                                current_block.add_node (jump_target.catch_clause);
@@ -1135,7 +1135,7 @@ public class Vala.FlowAnalyzer : CodeVisitor {
                if (current_block == null) {
                        node.unreachable = true;
                        if (!unreachable_reported) {
-                               Report.warning (node.source_reference, "unreachable code detected");
+                               context.report.log_warning (node.source_reference, "unreachable code 
detected");
                                unreachable_reported = true;
                        }
                        return true;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]