]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
vala: Run FlowAnalyzer on all given source-files
authorRico Tzschichholz <ricotz@ubuntu.com>
Sat, 14 Sep 2019 17:22:36 +0000 (19:22 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sat, 14 Sep 2019 18:12:30 +0000 (20:12 +0200)
This is a regression triggered by 8f3a0a0b64e0c7fbcc9231c3058247920dd6eeda
where we rely on information gathered by it and its changes to the AST.

Silence "never used" warnings for external-package symbols.

Fixes https://gitlab.gnome.org/GNOME/vala/issues/843

vala/valaflowanalyzer.vala

index dc7e471a324be8f7a512ea0e5cf36d40d6fedfba..29349e7a1bee81acd839b56f7e17f5329190ec05 100644 (file)
@@ -108,12 +108,9 @@ public class Vala.FlowAnalyzer : CodeVisitor {
                this.context = context;
                all_basic_blocks = new HashSet<BasicBlock> ();
 
-               /* we're only interested in non-pkg source files */
                var source_files = context.get_source_files ();
                foreach (SourceFile file in source_files) {
-                       if (file.file_type == SourceFileType.SOURCE) {
-                               file.accept (this);
-                       }
+                       file.accept (this);
                }
 
                all_basic_blocks = null;
@@ -145,7 +142,7 @@ public class Vala.FlowAnalyzer : CodeVisitor {
        }
 
        public override void visit_field (Field f) {
-               if (f.is_internal_symbol () && !f.used) {
+               if (f.is_internal_symbol () && !f.used && !f.external_package) {
                        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 {
@@ -169,7 +166,7 @@ public class Vala.FlowAnalyzer : CodeVisitor {
        }
 
        public override void visit_method (Method m) {
-               if (m.is_internal_symbol () && !m.used && !m.entry_point
+               if (m.is_internal_symbol () && !m.used && !m.entry_point && !m.external_package
                    && !m.overrides && (m.base_interface_method == null || m.base_interface_method == m)
                    && !(m is CreationMethod)) {
                        if (!m.is_private_symbol () && (context.internal_header_filename != null || context.use_fast_vapi)) {