pub struct DefiniteAssignmentAnalyzer<'a> { /* private fields */ }Expand description
Analyzer that performs definite assignment analysis.
This performs a forward dataflow analysis over the control flow graph, tracking assignment states for variables at each program point.
Implementations§
Source§impl<'a> DefiniteAssignmentAnalyzer<'a>
impl<'a> DefiniteAssignmentAnalyzer<'a>
Sourcepub fn new(arena: &'a NodeArena, flow_arena: &'a FlowNodeArena) -> Self
pub fn new(arena: &'a NodeArena, flow_arena: &'a FlowNodeArena) -> Self
Create a new definite assignment analyzer.
Sourcepub fn track_variable(&mut self, var_decl: NodeIndex)
pub fn track_variable(&mut self, var_decl: NodeIndex)
Add a variable declaration to track during analysis.
Sourcepub fn analyze(
&mut self,
entry: FlowNodeId,
) -> &FxHashMap<FlowNodeId, AssignmentStateMap>
pub fn analyze( &mut self, entry: FlowNodeId, ) -> &FxHashMap<FlowNodeId, AssignmentStateMap>
Run the forward dataflow analysis starting from the given flow node.
Returns the assignment states at each flow node in the graph.
This performs a forward dataflow analysis that tracks variable assignment states through the control flow graph, properly handling:
- Loop back-edges (merging loop entry and loop body exit states)
- Control flow joins (merging states from multiple predecessors)
- Break/continue statements
- Try/catch/finally blocks
Sourcepub fn get_state_at(&self, flow_id: FlowNodeId) -> Option<&AssignmentStateMap>
pub fn get_state_at(&self, flow_id: FlowNodeId) -> Option<&AssignmentStateMap>
Get the assignment state at a specific flow node.
Sourcepub fn is_definitely_assigned(
&self,
var_id: NodeIndex,
flow_id: FlowNodeId,
) -> bool
pub fn is_definitely_assigned( &self, var_id: NodeIndex, flow_id: FlowNodeId, ) -> bool
Check if a variable is definitely assigned at a specific flow node.
Sourcepub const fn node_states(&self) -> &FxHashMap<FlowNodeId, AssignmentStateMap>
pub const fn node_states(&self) -> &FxHashMap<FlowNodeId, AssignmentStateMap>
Get a reference to all node states.
Auto Trait Implementations§
impl<'a> Freeze for DefiniteAssignmentAnalyzer<'a>
impl<'a> RefUnwindSafe for DefiniteAssignmentAnalyzer<'a>
impl<'a> Send for DefiniteAssignmentAnalyzer<'a>
impl<'a> Sync for DefiniteAssignmentAnalyzer<'a>
impl<'a> Unpin for DefiniteAssignmentAnalyzer<'a>
impl<'a> UnsafeUnpin for DefiniteAssignmentAnalyzer<'a>
impl<'a> UnwindSafe for DefiniteAssignmentAnalyzer<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more