charon_lib::transform::simplify_constants

Function transform_constant_expr

source
fn transform_constant_expr<F: FnMut(Ty) -> Place>(
    span: &Span,
    nst: &mut Vec<Statement>,
    val: ConstantExpr,
    make_new_var: &mut F,
) -> Operand
Expand description

If the constant value is a constant ADT, push Assign::Aggregate statements to the vector of statements, that bind new variables to the ADT parts and the variable assigned to the complete ADT.

Goes fom e.g. f(T::A(x, y)) to let a = T::A(x, y); f(a). The function is recursively called on the aggregate fields (e.g. here x and y).