struct IndexVisitor<'a> {
locals: &'a mut Locals,
statements: Vec<Statement>,
place_mutability_stack: Vec<bool>,
span: Span,
}
Expand description
Visitor to transform the operands by introducing intermediate let statements.
We explore the statements without diving into substatements, and in particular explore the places and operands. Places always appear as destinations we are writing to. While we explore the places/operands present in a statement, We temporarily store the new statements inside the visitor. Once we’ve finished exploring the statement, we insert those before the statement.
Fields§
§locals: &'a mut Locals
§statements: Vec<Statement>
§place_mutability_stack: Vec<bool>
§span: Span
Implementations§
source§impl<'a> IndexVisitor<'a>
impl<'a> IndexVisitor<'a>
fn fresh_var(&mut self, name: Option<String>, ty: Ty) -> Place
fn transform_place(&mut self, mut_access: bool, place: &mut Place)
sourcefn visit_inner_with_mutability<T>(
&mut self,
x: &mut T,
mutability: bool,
) -> ControlFlow<Infallible>where
T: for<'s> DriveMut<'s, BodyVisitableWrapper<Self>>,
fn visit_inner_with_mutability<T>(
&mut self,
x: &mut T,
mutability: bool,
) -> ControlFlow<Infallible>where
T: for<'s> DriveMut<'s, BodyVisitableWrapper<Self>>,
Calls self.visit_inner()
with mutability
pushed on the stack.
Trait Implementations§
source§impl VisitBodyMut for IndexVisitor<'_>
impl VisitBodyMut for IndexVisitor<'_>
The visitor methods.
source§fn exit_place(&mut self, place: &mut Place)
fn exit_place(&mut self, place: &mut Place)
We explore places from the inside-out.
source§fn visit_llbc_block(&mut self, _: &mut Block) -> ControlFlow<Infallible>
fn visit_llbc_block(&mut self, _: &mut Block) -> ControlFlow<Infallible>
Overrideable method called when visiting a
$ty
. When overriding this method,
call self.visit_inner(x)
to keep recursively visiting the type, or don’t call
it if the contents of x
should not be visited. Read moresource§fn visit_operand(&mut self, x: &mut Operand) -> ControlFlow<Infallible>
fn visit_operand(&mut self, x: &mut Operand) -> ControlFlow<Infallible>
Overrideable method called when visiting a
$ty
. When overriding this method,
call self.visit_inner(x)
to keep recursively visiting the type, or don’t call
it if the contents of x
should not be visited. Read moresource§fn visit_call(&mut self, x: &mut Call) -> ControlFlow<Infallible>
fn visit_call(&mut self, x: &mut Call) -> ControlFlow<Infallible>
Overrideable method called when visiting a
$ty
. When overriding this method,
call self.visit_inner(x)
to keep recursively visiting the type, or don’t call
it if the contents of x
should not be visited. Read moresource§fn visit_fn_operand(&mut self, x: &mut FnOperand) -> ControlFlow<Infallible>
fn visit_fn_operand(&mut self, x: &mut FnOperand) -> ControlFlow<Infallible>
Overrideable method called when visiting a
$ty
. When overriding this method,
call self.visit_inner(x)
to keep recursively visiting the type, or don’t call
it if the contents of x
should not be visited. Read moresource§fn visit_rvalue(&mut self, x: &mut Rvalue) -> ControlFlow<Infallible>
fn visit_rvalue(&mut self, x: &mut Rvalue) -> ControlFlow<Infallible>
Overrideable method called when visiting a
$ty
. When overriding this method,
call self.visit_inner(x)
to keep recursively visiting the type, or don’t call
it if the contents of x
should not be visited. Read moresource§fn visit<'a, T: BodyVisitable>(
&'a mut self,
x: &mut T,
) -> ControlFlow<Self::Break>
fn visit<'a, T: BodyVisitable>( &'a mut self, x: &mut T, ) -> ControlFlow<Self::Break>
Visit a visitable type. This calls the appropriate method of this trait on
x
(visit_$ty
if it exists, visit_inner
if not).source§fn visit_by_val<T: BodyVisitable>(
self,
x: &mut T,
) -> ControlFlow<Self::Break, Self>
fn visit_by_val<T: BodyVisitable>( self, x: &mut T, ) -> ControlFlow<Self::Break, Self>
Convenience alias for method chaining.
source§fn visit_by_val_infallible<T: BodyVisitable>(self, x: &mut T) -> Selfwhere
Self: Visitor<Break = Infallible> + Sized,
fn visit_by_val_infallible<T: BodyVisitable>(self, x: &mut T) -> Selfwhere
Self: Visitor<Break = Infallible> + Sized,
Convenience when the visitor does not return early.
source§fn visit_inner<T>(&mut self, x: &mut T) -> ControlFlow<Self::Break>where
T: for<'s> DriveMut<'s, BodyVisitableWrapper<Self>>,
fn visit_inner<T>(&mut self, x: &mut T) -> ControlFlow<Self::Break>where
T: for<'s> DriveMut<'s, BodyVisitableWrapper<Self>>,
Visit the contents of
x
. This calls self.visit()
on each field of T
. This
is available for any type whose contents are all #trait_name
.source§fn visit_aggregate_kind(
&mut self,
x: &mut AggregateKind,
) -> ControlFlow<Self::Break>
fn visit_aggregate_kind( &mut self, x: &mut AggregateKind, ) -> ControlFlow<Self::Break>
Overrideable method called when visiting a
$ty
. When overriding this method,
call self.visit_inner(x)
to keep recursively visiting the type, or don’t call
it if the contents of x
should not be visited. Read moresource§fn enter_aggregate_kind(&mut self, x: &mut AggregateKind)
fn enter_aggregate_kind(&mut self, x: &mut AggregateKind)
Called when starting to visit a
$ty
(unless visit_$ty
is overriden).source§fn exit_aggregate_kind(&mut self, x: &mut AggregateKind)
fn exit_aggregate_kind(&mut self, x: &mut AggregateKind)
Called when finished visiting a
$ty
(unless visit_$ty
is overriden).source§fn enter_call(&mut self, x: &mut Call)
fn enter_call(&mut self, x: &mut Call)
Called when starting to visit a
$ty
(unless visit_$ty
is overriden).source§fn exit_call(&mut self, x: &mut Call)
fn exit_call(&mut self, x: &mut Call)
Called when finished visiting a
$ty
(unless visit_$ty
is overriden).source§fn enter_fn_operand(&mut self, x: &mut FnOperand)
fn enter_fn_operand(&mut self, x: &mut FnOperand)
Called when starting to visit a
$ty
(unless visit_$ty
is overriden).source§fn exit_fn_operand(&mut self, x: &mut FnOperand)
fn exit_fn_operand(&mut self, x: &mut FnOperand)
Called when finished visiting a
$ty
(unless visit_$ty
is overriden).source§fn visit_fn_ptr(&mut self, x: &mut FnPtr) -> ControlFlow<Self::Break>
fn visit_fn_ptr(&mut self, x: &mut FnPtr) -> ControlFlow<Self::Break>
Overrideable method called when visiting a
$ty
. When overriding this method,
call self.visit_inner(x)
to keep recursively visiting the type, or don’t call
it if the contents of x
should not be visited. Read moresource§fn enter_fn_ptr(&mut self, x: &mut FnPtr)
fn enter_fn_ptr(&mut self, x: &mut FnPtr)
Called when starting to visit a
$ty
(unless visit_$ty
is overriden).source§fn exit_fn_ptr(&mut self, x: &mut FnPtr)
fn exit_fn_ptr(&mut self, x: &mut FnPtr)
Called when finished visiting a
$ty
(unless visit_$ty
is overriden).source§fn enter_operand(&mut self, x: &mut Operand)
fn enter_operand(&mut self, x: &mut Operand)
Called when starting to visit a
$ty
(unless visit_$ty
is overriden).source§fn exit_operand(&mut self, x: &mut Operand)
fn exit_operand(&mut self, x: &mut Operand)
Called when finished visiting a
$ty
(unless visit_$ty
is overriden).source§fn visit_place(&mut self, x: &mut Place) -> ControlFlow<Self::Break>
fn visit_place(&mut self, x: &mut Place) -> ControlFlow<Self::Break>
Overrideable method called when visiting a
$ty
. When overriding this method,
call self.visit_inner(x)
to keep recursively visiting the type, or don’t call
it if the contents of x
should not be visited. Read moresource§fn enter_place(&mut self, x: &mut Place)
fn enter_place(&mut self, x: &mut Place)
Called when starting to visit a
$ty
(unless visit_$ty
is overriden).source§fn visit_projection_elem(
&mut self,
x: &mut ProjectionElem,
) -> ControlFlow<Self::Break>
fn visit_projection_elem( &mut self, x: &mut ProjectionElem, ) -> ControlFlow<Self::Break>
Overrideable method called when visiting a
$ty
. When overriding this method,
call self.visit_inner(x)
to keep recursively visiting the type, or don’t call
it if the contents of x
should not be visited. Read moresource§fn enter_projection_elem(&mut self, x: &mut ProjectionElem)
fn enter_projection_elem(&mut self, x: &mut ProjectionElem)
Called when starting to visit a
$ty
(unless visit_$ty
is overriden).source§fn exit_projection_elem(&mut self, x: &mut ProjectionElem)
fn exit_projection_elem(&mut self, x: &mut ProjectionElem)
Called when finished visiting a
$ty
(unless visit_$ty
is overriden).source§fn enter_rvalue(&mut self, x: &mut Rvalue)
fn enter_rvalue(&mut self, x: &mut Rvalue)
Called when starting to visit a
$ty
(unless visit_$ty
is overriden).source§fn exit_rvalue(&mut self, x: &mut Rvalue)
fn exit_rvalue(&mut self, x: &mut Rvalue)
Called when finished visiting a
$ty
(unless visit_$ty
is overriden).source§fn enter_llbc_block(&mut self, x: &mut Block)
fn enter_llbc_block(&mut self, x: &mut Block)
Called when starting to visit a
$ty
(unless visit_$ty
is overriden).source§fn exit_llbc_block(&mut self, x: &mut Block)
fn exit_llbc_block(&mut self, x: &mut Block)
Called when finished visiting a
$ty
(unless visit_$ty
is overriden).source§fn visit_llbc_statement(
&mut self,
x: &mut Statement,
) -> ControlFlow<Self::Break>
fn visit_llbc_statement( &mut self, x: &mut Statement, ) -> ControlFlow<Self::Break>
Overrideable method called when visiting a
$ty
. When overriding this method,
call self.visit_inner(x)
to keep recursively visiting the type, or don’t call
it if the contents of x
should not be visited. Read moresource§fn enter_llbc_statement(&mut self, x: &mut Statement)
fn enter_llbc_statement(&mut self, x: &mut Statement)
Called when starting to visit a
$ty
(unless visit_$ty
is overriden).source§fn exit_llbc_statement(&mut self, x: &mut Statement)
fn exit_llbc_statement(&mut self, x: &mut Statement)
Called when finished visiting a
$ty
(unless visit_$ty
is overriden).source§fn visit_ullbc_statement(
&mut self,
x: &mut Statement,
) -> ControlFlow<Self::Break>
fn visit_ullbc_statement( &mut self, x: &mut Statement, ) -> ControlFlow<Self::Break>
Overrideable method called when visiting a
$ty
. When overriding this method,
call self.visit_inner(x)
to keep recursively visiting the type, or don’t call
it if the contents of x
should not be visited. Read moresource§fn enter_ullbc_statement(&mut self, x: &mut Statement)
fn enter_ullbc_statement(&mut self, x: &mut Statement)
Called when starting to visit a
$ty
(unless visit_$ty
is overriden).source§fn exit_ullbc_statement(&mut self, x: &mut Statement)
fn exit_ullbc_statement(&mut self, x: &mut Statement)
Called when finished visiting a
$ty
(unless visit_$ty
is overriden).source§fn visit_ullbc_terminator(
&mut self,
x: &mut Terminator,
) -> ControlFlow<Self::Break>
fn visit_ullbc_terminator( &mut self, x: &mut Terminator, ) -> ControlFlow<Self::Break>
Overrideable method called when visiting a
$ty
. When overriding this method,
call self.visit_inner(x)
to keep recursively visiting the type, or don’t call
it if the contents of x
should not be visited. Read moresource§fn enter_ullbc_terminator(&mut self, x: &mut Terminator)
fn enter_ullbc_terminator(&mut self, x: &mut Terminator)
Called when starting to visit a
$ty
(unless visit_$ty
is overriden).source§fn exit_ullbc_terminator(&mut self, x: &mut Terminator)
fn exit_ullbc_terminator(&mut self, x: &mut Terminator)
Called when finished visiting a
$ty
(unless visit_$ty
is overriden).source§fn visit_ullbc_block_id(&mut self, x: &mut BlockId) -> ControlFlow<Self::Break>
fn visit_ullbc_block_id(&mut self, x: &mut BlockId) -> ControlFlow<Self::Break>
Overrideable method called when visiting a
$ty
. When overriding this method,
call self.visit_inner(x)
to keep recursively visiting the type, or don’t call
it if the contents of x
should not be visited. Read moresource§fn enter_ullbc_block_id(&mut self, x: &mut BlockId)
fn enter_ullbc_block_id(&mut self, x: &mut BlockId)
Called when starting to visit a
$ty
(unless visit_$ty
is overriden).source§fn exit_ullbc_block_id(&mut self, x: &mut BlockId)
fn exit_ullbc_block_id(&mut self, x: &mut BlockId)
Called when finished visiting a
$ty
(unless visit_$ty
is overriden).source§impl<'a> Visitor for IndexVisitor<'a>
impl<'a> Visitor for IndexVisitor<'a>
source§type Break = Infallible
type Break = Infallible
The type used for early-return, if the visitor supports it. Use an empty type like
std::convert::Infallible
if the visitor does not short-circuit.Auto Trait Implementations§
impl<'a> Freeze for IndexVisitor<'a>
impl<'a> RefUnwindSafe for IndexVisitor<'a>
impl<'a> Send for IndexVisitor<'a>
impl<'a> Sync for IndexVisitor<'a>
impl<'a> Unpin for IndexVisitor<'a>
impl<'a> !UnwindSafe for IndexVisitor<'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