struct ReconstructCtx<'a> {
body: &'a ExprBody,
exits_info: ExitsInfo,
explored: HashSet<BlockId>,
parent_loops: Vec<BlockId>,
switch_exit_blocks: HashSet<BlockId>,
}Fields§
§body: &'a ExprBody§exits_info: ExitsInfo§explored: HashSet<BlockId>§parent_loops: Vec<BlockId>§switch_exit_blocks: HashSet<BlockId>Implementations§
Source§impl<'a> ReconstructCtx<'a>
impl<'a> ReconstructCtx<'a>
fn build( ctx: &mut TransformCtx, src_body: &'a ExprBody, ) -> Result<Self, Irreducible>
fn get_goto_kind(&self, next_block_id: BlockId) -> GotoKind
Sourcefn translate_child_block(
&mut self,
parent_span: Span,
child_id: BlockId,
) -> Block
fn translate_child_block( &mut self, parent_span: Span, child_id: BlockId, ) -> Block
parent_span: we need some span data for the new statement.
We use the one for the parent terminator.
fn translate_statement(&self, st: &Statement) -> Option<Statement>
fn translate_terminator(&mut self, terminator: &Terminator) -> Block
Sourcefn translate_block(&mut self, block_id: BlockId) -> Block
fn translate_block(&mut self, block_id: BlockId) -> Block
Remark: some values are boxed (here, the returned statement) so that they are allocated on the heap. This reduces stack usage (we had problems with stack overflows in the past). A more efficient solution would be to use loops to make this code constant space, but that would require a serious rewriting.
Auto Trait Implementations§
impl<'a> Freeze for ReconstructCtx<'a>
impl<'a> RefUnwindSafe for ReconstructCtx<'a>
impl<'a> Send for ReconstructCtx<'a>
impl<'a> Sync for ReconstructCtx<'a>
impl<'a> Unpin for ReconstructCtx<'a>
impl<'a> UnwindSafe for ReconstructCtx<'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
§impl<I, T> ExtractContext<I, ()> for T
impl<I, T> ExtractContext<I, ()> for T
§fn extract_context(self, _original_input: I)
fn extract_context(self, _original_input: I)
Given the context attached to a nom error, and given the original
input to the nom parser, extract more the useful context information. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
Converts
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>
Converts
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§impl<I> RecreateContext<I> for I
impl<I> RecreateContext<I> for I
§fn recreate_context(_original_input: I, tail: I) -> I
fn recreate_context(_original_input: I, tail: I) -> I
Given the original input, as well as the context reported by nom,
recreate a context in the original string where the error occurred. Read more