aztec-nr - std

Primitive type TypedExpr

A compile-time type which represents a resolved and type-checked expression.

A TypedExpr can be obtained using Expr::resolve:

fn main() {
    comptime {
        let expr = quote { [1, 2, 3].len() }.as_expr().unwrap();
        let typ = expr.resolve(Option::none());
        println(typ.get_type().unwrap()); // outputs "u32"
    }
}

Implementations

impl TypedExpr

pub comptime fn as_function_definition(self) -> Option<FunctionDefinition>

If this expression refers to a function definitions, returns it. Otherwise returns Option::none().

pub comptime fn get_type(self) -> Option<Type>

Returns the type of the expression, if the expression could be resolved without errors.