]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
vala: remove CodeContext reference in FlowAnalyzer 685-remove-context-from-semantic-analyzer 32d8d6a584ac29771914c92d58443865ef5e0246 20/head
authorDaniel Espinosa <esodan@gmail.com>
Tue, 16 Oct 2018 22:09:58 +0000 (17:09 -0500)
committerDaniel Espinosa <esodan@gmail.com>
Thu, 10 Oct 2019 20:08:01 +0000 (15:08 -0500)
vala/valaflowanalyzer.vala

index 978ab94f8f8f46dbde7c6d998cb14e022f1e6b5f..785742705cc89d452342e65b9f7797cae91e7526 100644 (file)
@@ -85,7 +85,6 @@ public class Vala.FlowAnalyzer : CodeVisitor {
                }
        }
 
-       private CodeContext context;
        private BasicBlock current_block;
        private bool unreachable_reported;
        private List<JumpTarget> jump_stack = new ArrayList<JumpTarget> ();
@@ -105,7 +104,6 @@ public class Vala.FlowAnalyzer : CodeVisitor {
         * @param context a code context
         */
        public void analyze (CodeContext context) {
-               this.context = context;
                all_basic_blocks = new HashSet<BasicBlock> ();
 
                var source_files = context.get_source_files ();
@@ -114,7 +112,6 @@ public class Vala.FlowAnalyzer : CodeVisitor {
                }
 
                all_basic_blocks = null;
-               this.context = null;
        }
 
        public override void visit_source_file (SourceFile source_file) {
@@ -143,7 +140,7 @@ public class Vala.FlowAnalyzer : CodeVisitor {
 
        public override void visit_field (Field f) {
                if (f.is_internal_symbol () && !f.used && !f.external_package) {
-                       if (!f.is_private_symbol () && (context.internal_header_filename != null || context.use_fast_vapi)) {
+                       if (!f.is_private_symbol () && (CodeContext.get ().internal_header_filename != null || CodeContext.get ().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".printf (f.get_full_name ()));
@@ -169,7 +166,7 @@ public class Vala.FlowAnalyzer : CodeVisitor {
                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)) {
+                       if (!m.is_private_symbol () && (CodeContext.get ().internal_header_filename != null || CodeContext.get ().use_fast_vapi)) {
                                // do not warn if internal member may be used outside this compilation unit
                        } else if (m.parent_symbol != null && m.parent_symbol.get_attribute ("DBus") != null
                            && m.get_attribute_bool ("DBus", "visible", true)) {
@@ -882,7 +879,7 @@ public class Vala.FlowAnalyzer : CodeVisitor {
                                                mark_unreachable ();
                                                break;
                                        } else if (jump_target.is_error_target) {
-                                               if (context.profile == Profile.GOBJECT) {
+                                               if (CodeContext.get ().profile == Profile.GOBJECT) {
                                                        if (jump_target.error_domain == null
                                                            || (jump_target.error_domain == error_type.error_domain
                                                                && (jump_target.error_code == null
@@ -988,7 +985,7 @@ public class Vala.FlowAnalyzer : CodeVisitor {
                        all_basic_blocks.add (error_block);
 
                        if (catch_clause.error_type != null) {
-                               if (context.profile == Profile.GOBJECT) {
+                               if (CodeContext.get ().profile == Profile.GOBJECT) {
                                        unowned ErrorType error_type = (ErrorType) catch_clause.error_type;
                                        jump_stack.add (new JumpTarget.error_target (error_block, catch_clause, catch_clause.error_type.type_symbol as ErrorDomain, error_type.error_code, null));
                                } else {
@@ -1026,7 +1023,7 @@ public class Vala.FlowAnalyzer : CodeVisitor {
                                        break;
                                }
 
-                               if (context.profile == Profile.GOBJECT) {
+                               if (CodeContext.get ().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");