mod backward;
mod core;
pub use backward::BackAnalysis;
use crate::{Block, BlockId, MatchInfo, Statement, VarRemapping, VarUsage};
pub type StatementLocation = (BlockId, usize);
#[allow(unused_variables)]
pub trait Analyzer<'db, 'a> {
type Info: Clone;
fn visit_block_start(&mut self, info: &mut Self::Info, block_id: BlockId, block: &Block<'db>) {}
fn visit_stmt(
&mut self,
info: &mut Self::Info,
statement_location: StatementLocation,
stmt: &'a Statement<'db>,
) {
}
fn visit_goto(
&mut self,
info: &mut Self::Info,
statement_location: StatementLocation,
target_block_id: BlockId,
remapping: &'a VarRemapping<'db>,
) {
}
fn merge_match(
&mut self,
statement_location: StatementLocation,
match_info: &'a MatchInfo<'db>,
infos: impl Iterator<Item = Self::Info>,
) -> Self::Info;
fn info_from_return(
&mut self,
statement_location: StatementLocation,
vars: &'a [VarUsage<'db>],
) -> Self::Info;
fn info_from_panic(
&mut self,
statement_location: StatementLocation,
var: &VarUsage<'db>,
) -> Self::Info {
unreachable!("Panics should have been stripped in the `lower_panics` phase.");
}
}