pub struct BranchLabelInfo {
pub common_predecessor: FlowId,
pub has_name_assigns: bool,
pub has_index_assigns: bool,
pub has_casts_or_implfunc: bool,
pub has_inner_conditions: bool,
}Expand description
Metadata for BranchLabel nodes that enables the merge-skip optimisation.
When the backward flow walk hits a BranchLabel, it normally merges the types
from every antecedent branch. For variables NOT modified in any branch (and
all branches are alive), the merge is guaranteed to produce the same type as
the node before the branch (common_predecessor). The walk can skip
directly to that predecessor, turning an O(branches × depth) merge into O(1).
Fields§
§common_predecessor: FlowIdFlowId of the node immediately before the if/elseif/else split.
has_name_assigns: booltrue when any Assignment(_, NameOnly|Mixed) node was created inside
the branches — meaning a local/global name may have been reassigned.
has_index_assigns: booltrue when any Assignment(_, IndexOnly|Mixed) node was created inside
the branches — meaning a field/index may have been reassigned.
has_casts_or_implfunc: booltrue when any ImplFunc or TagCast node was created inside
the branches — these can modify the type of a named or indexed variable.
has_inner_conditions: booltrue when any TrueCondition or FalseCondition node was created
inside the branch blocks (not the outer if’s condition). Assert-like
patterns create inner conditions that can narrow variables beyond what
the outer condition/merge would cancel out.
Trait Implementations§
Source§impl Clone for BranchLabelInfo
impl Clone for BranchLabelInfo
Source§fn clone(&self) -> BranchLabelInfo
fn clone(&self) -> BranchLabelInfo
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for BranchLabelInfo
impl RefUnwindSafe for BranchLabelInfo
impl Send for BranchLabelInfo
impl Sync for BranchLabelInfo
impl Unpin for BranchLabelInfo
impl UnsafeUnpin for BranchLabelInfo
impl UnwindSafe for BranchLabelInfo
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more