rapx/analysis/senryx/
inter_record.rs

1use std::collections::HashMap;
2
3use super::contracts::abstract_state::AbstractStateItem;
4
5#[derive(Debug, Clone)]
6pub struct InterAnalysisRecord<'tcx> {
7    pub pre_analysis_state: HashMap<usize, AbstractStateItem<'tcx>>,
8    pub post_analysis_state: HashMap<usize, AbstractStateItem<'tcx>>,
9    pub ret_state: AbstractStateItem<'tcx>,
10}
11
12impl<'tcx> InterAnalysisRecord<'tcx> {
13    pub fn new(
14        pre_analysis_state: HashMap<usize, AbstractStateItem<'tcx>>,
15        post_analysis_state: HashMap<usize, AbstractStateItem<'tcx>>,
16        ret_state: AbstractStateItem<'tcx>,
17    ) -> Self {
18        Self {
19            pre_analysis_state,
20            post_analysis_state,
21            ret_state,
22        }
23    }
24
25    pub fn is_pre_state_same(
26        &self,
27        other_pre_state: &HashMap<usize, AbstractStateItem<'tcx>>,
28    ) -> bool {
29        self.pre_analysis_state == *other_pre_state
30    }
31}