pub struct AdvancedReuseAnalyzer {
pub analysis_stats: ReuseAnalysisStats,
/* private fields */
}Expand description
Advanced node reuse analyzer with sophisticated matching algorithms
Fields§
§analysis_stats: ReuseAnalysisStatsStatistics for reuse analysis
Implementations§
Source§impl AdvancedReuseAnalyzer
impl AdvancedReuseAnalyzer
Sourcepub fn with_config(_config: ReuseConfig) -> Self
pub fn with_config(_config: ReuseConfig) -> Self
Create analyzer with custom configuration
Sourcepub fn analyze_reuse_opportunities(
&mut self,
old_tree: &Node,
new_tree: &Node,
edits: &EditSet,
config: &ReuseConfig,
) -> ReuseAnalysisResult
pub fn analyze_reuse_opportunities( &mut self, old_tree: &Node, new_tree: &Node, edits: &EditSet, config: &ReuseConfig, ) -> ReuseAnalysisResult
Analyze potential node reuse between old and new trees
Returns a mapping of old node positions to reuse strategies, enabling intelligent tree reconstruction with maximum node reuse.
Sourcepub fn map_old_position_to_new(&self, old_pos: usize, edits: &EditSet) -> usize
pub fn map_old_position_to_new(&self, old_pos: usize, edits: &EditSet) -> usize
Map an old-tree byte position to its corresponding position in the new
tree, using the supplied EditSet to apply byte shifts.
Semantics:
- If
old_posprecedes the first edit’sstart_byte, returnsold_posunchanged. - If
old_posfalls inside an edit’s old range[start_byte, old_end_byte), returns that edit’snew_end_byte(i.e. the position is consumed by the edit and snaps to the edit’s new boundary). - Otherwise the position is shifted by the cumulative byte shift of all
prior edits whose
old_end_byte <= old_pos.
Edits in EditSet are sorted by start_byte, so iteration short-
circuits as soon as the next edit starts past old_pos.
Sourcepub fn try_register_match(
&self,
reuse_map: &mut HashMap<usize, ReuseStrategy>,
old_pos: usize,
new_pos: usize,
reuse_type: ReuseType,
confidence: f64,
) -> bool
pub fn try_register_match( &self, reuse_map: &mut HashMap<usize, ReuseStrategy>, old_pos: usize, new_pos: usize, reuse_type: ReuseType, confidence: f64, ) -> bool
Attempt to register an old_pos -> new_pos reuse claim, enforcing the
one-to-one invariant: at most one old position may map to any given
new position.
Returns true if the registration was inserted, false if some other
old_pos has already claimed the same new_pos (in which case the
existing claim is left unchanged).