module AdLint::Cc1::UndefinableContextTracing
Public Instance Methods
emit_context_messages(report, loc)
click to toggle source
# File lib/adlint/cc1/trace.rb, line 136 def emit_context_messages(report, loc) traced = Set.new msgs = trace_positive_paths(report, loc, traced) + trace_negative_paths(report, loc, traced) unless msgs.empty? [report.C(:C1000, Location.new)] + msgs.sort { |a, b| a.location <=> b.location } else [] end end
Private Instance Methods
trace_positive_paths(report, loc, traced)
click to toggle source
# File lib/adlint/cc1/trace.rb, line 150 def trace_positive_paths(report, loc, traced) # TODO: Evidence of the test result might have two or more contributors. # All the evidences should be complemented by context messages? unless pos_trans = sample_positive_transition return [] end pos_trans.each_with_object([]) do |ss, msgs| if src = ss.tag.by.find { |node| node.kind_of?(VariableDefinition) } if src.location && src.location < loc && !traced.include?(src) if ss.value.test_may_be_undefined.true? msgs.push(report.C(:C1003, src.location)) traced.add(src) end end end end end