Class: Necropsy::Analyzers::Static::CHA
- Inherits:
-
Necropsy::Analyzer
- Object
- Necropsy::Analyzer
- Necropsy::Analyzers::Static::CHA
- Defined in:
- lib/necropsy/analyzers/static/cha.rb
Instance Method Summary collapse
Instance Method Details
#analyze(graph, _project) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/necropsy/analyzers/static/cha.rb', line 7 def analyze(graph, _project) edge_evidences = graph.call_sites.flat_map do |site| candidates(graph, site).map do |candidate| EdgeEvidence.new( caller_id: site.caller_id, callee_id: candidate.id, evidence: evidence( kind: :call_edge, details: "CHA candidate at #{site.file}:#{site.line}", metadata: site.to_h ) ) end end AnalyzerResult.new( edge_evidences: edge_evidences, alive_evidences: [], uncertainties: {}, observation: {} ) end |
#candidates(graph, site) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/necropsy/analyzers/static/cha.rb', line 39 def candidates(graph, site) case site.receiver_kind when :constant constant_targets(graph, site) when :instance instance_targets(graph, site) when :self, :implicit self_targets(graph, site) else graph.resolve_call_site(site) end.uniq(&:id) end |
#profile ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/necropsy/analyzers/static/cha.rb', line 30 def profile AnalyzerProfile.new( name: :cha, kind: :static, soundness: :conservative, description: 'Expands call targets through class hierarchy, descendants, and included/prepended modules.' ) end |