charon_lib::ast::gast

Struct GExprBody

source
pub struct GExprBody<T> {
    pub span: Span,
    pub locals: Locals,
    pub comments: Vec<(usize, Vec<String>)>,
    pub body: T,
}
Expand description

An expression body. TODO: arg_count should be stored in GFunDecl below. But then, the print is obfuscated and Aeneas may need some refactoring.

Fields§

§span: Span§locals: Locals

The local variables.

§comments: Vec<(usize, Vec<String>)>

For each line inside the body, we record any whole-line // comments found before it. They are added to statements in the late recover_body_comments pass.

§body: T

Implementations§

source§

impl GExprBody<Vector<BlockId, BlockData>>

source

pub fn transform_sequences<F>(&mut self, f: &mut F)
where F: FnMut(&mut Locals, &mut [Statement]) -> Vec<(usize, Vec<Statement>)>,

source

pub fn visit_statements<F: FnMut(&mut Statement)>(&mut self, f: &mut F)

Apply a function to all the statements, in a bottom-up manner.

Trait Implementations§

source§

impl<T: Clone> Clone for GExprBody<T>

source§

fn clone(&self) -> GExprBody<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: Debug> Debug for GExprBody<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de, T> Deserialize<'de> for GExprBody<T>
where T: Deserialize<'de>,

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<'s, T, V> Drive<'s, V> for GExprBody<T>
where V: Visitor + Visit<'s, Span> + Visit<'s, Locals> + Visit<'s, T>,

source§

fn drive_inner(&'s self, visitor: &mut V) -> ControlFlow<V::Break>

Call v.visit() on the immediate contents of self.
source§

impl<'s, T, V> DriveMut<'s, V> for GExprBody<T>
where V: Visitor + VisitMut<'s, Span> + VisitMut<'s, Locals> + VisitMut<'s, T>,

source§

fn drive_inner_mut(&'s mut self, visitor: &mut V) -> ControlFlow<V::Break>

Call v.visit() on the immediate contents of self.
source§

impl<T, C> FmtWithCtx<C> for GExprBody<T>
where C: for<'a> SetLocals<'a>, for<'a, 'a, 'b> <C as SetLocals<'a>>::C: AstFormatter + Formatter<&'b T>,

source§

fn fmt_with_ctx(&self, ctx: &C) -> String

source§

fn fmt_with_ctx_and_indent(&self, tab: &str, ctx: &C) -> String

source§

fn with_ctx<'a>(&'a self, ctx: &'a C) -> impl Display + 'a

Returns a struct that implements Display. This allows the following: Read more
source§

impl<'a> Formatter<&GExprBody<Block>> for FmtCtx<'a>

source§

impl<'a> Formatter<&GExprBody<Vector<BlockId, BlockData>>> for FmtCtx<'a>

source§

impl<T> Serialize for GExprBody<T>
where T: Serialize,

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl<T> Freeze for GExprBody<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for GExprBody<T>
where T: RefUnwindSafe,

§

impl<T> Send for GExprBody<T>
where T: Send,

§

impl<T> Sync for GExprBody<T>
where T: Sync,

§

impl<T> Unpin for GExprBody<T>
where T: Unpin,

§

impl<T> UnwindSafe for GExprBody<T>
where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<I, T> ExtractContext<I, ()> for T

§

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
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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

§

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
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> TyVisitable for T
where T: AstVisitable,

source§

fn substitute(&mut self, generics: &GenericArgs)

source§

fn move_under_binder(self) -> Self

Move under one binder.
source§

fn move_under_binders(self, depth: DeBruijnId) -> Self

Move under depth binders.
source§

fn move_from_under_binders(self, depth: DeBruijnId) -> Option<Self>

Move the value out of depth binders. Returns None if it contains a variable bound in one of these depth binders.
source§

fn visit_db_id<B>( &mut self, f: impl FnMut(&mut DeBruijnId) -> ControlFlow<B>, ) -> ControlFlow<B>

Visit the de Bruijn ids contained in self, as seen from the outside of self. This means that any variable bound inside self will be skipped, and all the seen indices will count from the outside of self.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,