phase29an(p10): add exitmap feature facts scaffold
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
|
||||
use crate::ast::ASTNode;
|
||||
use crate::mir::builder::control_flow::plan::planner::Freeze;
|
||||
use std::collections::BTreeSet;
|
||||
|
||||
#[derive(Debug, Clone, Default, PartialEq, Eq)]
|
||||
pub(in crate::mir::builder) struct ExitUsageFacts {
|
||||
@ -10,9 +11,22 @@ pub(in crate::mir::builder) struct ExitUsageFacts {
|
||||
pub has_return: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub(in crate::mir::builder) enum ExitKindFacts {
|
||||
Return,
|
||||
Break,
|
||||
Continue,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub(in crate::mir::builder) struct ExitMapFacts {
|
||||
pub kinds_present: BTreeSet<ExitKindFacts>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, PartialEq, Eq)]
|
||||
pub(in crate::mir::builder) struct LoopFeatureFacts {
|
||||
pub exit_usage: ExitUsageFacts,
|
||||
pub exit_map: Option<ExitMapFacts>,
|
||||
pub value_join: Option<ValueJoinFacts>,
|
||||
pub cleanup: Option<CleanupFacts>,
|
||||
}
|
||||
@ -32,6 +46,7 @@ pub(in crate::mir::builder) fn try_extract_loop_feature_facts(
|
||||
}
|
||||
Ok(LoopFeatureFacts {
|
||||
exit_usage,
|
||||
exit_map: None,
|
||||
value_join: None,
|
||||
cleanup: None,
|
||||
})
|
||||
@ -102,6 +117,7 @@ mod tests {
|
||||
has_return: true,
|
||||
}
|
||||
);
|
||||
assert!(facts.exit_map.is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -115,5 +131,6 @@ mod tests {
|
||||
};
|
||||
let facts = try_extract_loop_feature_facts(&[nested]).expect("Ok");
|
||||
assert_eq!(facts.exit_usage, ExitUsageFacts::default());
|
||||
assert!(facts.exit_map.is_none());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user