forgekit_core/analysis/impact.rs
1//! Impact-analysis data types.
2//!
3//! Extracted from `mod.rs` (SPLIT-27). Pure data structs consumed by
4//! `AnalysisModule` impact/cross-reference/call-chain methods.
5
6use crate::types::Symbol;
7
8/// Detailed impact analysis result for a symbol.
9#[derive(Debug, Clone)]
10pub struct ImpactData {
11 /// Symbol that was analyzed
12 pub symbol: String,
13 /// Number of references to this symbol
14 pub ref_count: usize,
15 /// Number of call sites (for functions)
16 pub call_count: usize,
17 /// All symbols that reference this one
18 pub referenced_by: Vec<Symbol>,
19 /// All symbols this one references
20 pub references: Vec<Symbol>,
21 /// Total estimated impact score
22 pub impact_score: usize,
23}
24
25/// Impact analysis result.
26#[derive(Debug, Clone)]
27pub struct ImpactAnalysis {
28 /// Symbols that would be affected by a change
29 pub affected_symbols: Vec<Symbol>,
30 /// Total number of call sites
31 pub call_sites: usize,
32}
33
34/// Cross-reference information for a symbol.
35#[derive(Debug, Clone)]
36pub struct CrossReferences {
37 /// Symbols that call the target
38 pub callers: Vec<Symbol>,
39 /// Symbols called by the target
40 pub callees: Vec<Symbol>,
41}
42
43/// Chain of references from one symbol to another.
44#[derive(Debug, Clone)]
45pub struct ReferenceChain {
46 /// Starting symbol
47 pub from: String,
48 /// Ending symbol
49 pub to: String,
50 /// Chain of symbols connecting from to to
51 pub chain: Vec<Symbol>,
52 /// Length of the chain
53 pub length: usize,
54}
55
56/// Call chain showing all callers to a function.
57#[derive(Debug, Clone)]
58pub struct CallChain {
59 /// Target function
60 pub target: String,
61 /// All callers (direct and indirect)
62 pub callers: Vec<Symbol>,
63 /// Maximum depth of call chain
64 pub depth: usize,
65}