diff options
author | Daniel Espinosa <esodan@gmail.com> | 2018-10-16 17:09:58 -0500 |
---|---|---|
committer | Daniel Espinosa <esodan@gmail.com> | 2019-10-10 15:08:01 -0500 |
commit | 32d8d6a584ac29771914c92d58443865ef5e0246 (patch) | |
tree | 614076d8978161d4320044df050255b0e3d4d313 | |
parent | f695d27860e58971877c20455e35b62e3f6fdc38 (diff) | |
download | vala-685-remove-context-from-semantic-analyzer.tar.gz |
vala: remove CodeContext reference in FlowAnalyzer685-remove-context-from-semantic-analyzer
-rw-r--r-- | vala/valaflowanalyzer.vala | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/vala/valaflowanalyzer.vala b/vala/valaflowanalyzer.vala index 978ab94f8..785742705 100644 --- a/vala/valaflowanalyzer.vala +++ b/vala/valaflowanalyzer.vala @@ -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"); |