[vala/staging] vala: Check for unused attributes unconditionally



commit 99ffbdfdafedb575ec8302872d34121b24b7a047
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Tue Mar 16 18:09:51 2021 +0100

    vala: Check for unused attributes unconditionally

 vala/valausedattr.vala | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)
---
diff --git a/vala/valausedattr.vala b/vala/valausedattr.vala
index b9d8ceb22..a2102acf4 100644
--- a/vala/valausedattr.vala
+++ b/vala/valausedattr.vala
@@ -132,17 +132,14 @@ public class Vala.UsedAttr : CodeVisitor {
        }
 
        void check_unused_attr (Symbol sym) {
-               // optimize by not looking at all the symbols
-               if (sym.used) {
-                       foreach (unowned Attribute attr in sym.attributes) {
-                               var set = marked.get (attr.name);
-                               if (set == null) {
-                                       Report.warning (attr.source_reference, "Attribute `%s' never used", 
attr.name);
-                               } else {
-                                       foreach (var arg in attr.args.get_keys()) {
-                                               if (!set.contains (arg)) {
-                                                       Report.warning (attr.source_reference, "Argument `%s' 
never used", arg);
-                                               }
+               foreach (unowned Attribute attr in sym.attributes) {
+                       var set = marked.get (attr.name);
+                       if (set == null) {
+                               Report.warning (attr.source_reference, "Attribute `%s' never used", 
attr.name);
+                       } else {
+                               foreach (var arg in attr.args.get_keys()) {
+                                       if (!set.contains (arg)) {
+                                               Report.warning (attr.source_reference, "Argument `%s' never 
used", arg);
                                        }
                                }
                        }


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