Lyricdev
GitHub

enum Expr

pub enum Expr :: [Debug]

Conforms to Debug.

An expression, each form a variant. The spans are of the whole expression. Macro is a site of another macro inside an argument: the outer macro hands it on, the next round expands it.

Variants

Literal(Literal, Span)
Name(Ident)
Implicit(Ident)
This(Span)
At(string, ?Expr[], Span)
Unary(UnaryOp, Box<Expr>, Span)
Postfix(Box<Expr>, PostfixOp, Span)
Binary(Box<Expr>, BinaryOp, Box<Expr>, Span)
Assign(Box<Expr>, ?BinaryOp, Box<Expr>, Span)
Range(Box<Expr>, Box<Expr>, bool, Span)
SliceRange(?Box<Expr>, ?Box<Expr>, bool, Span)
Cast(Box<Expr>, Type, Span)
Is(Box<Expr>, Type, Span)
Call(Box<Expr>, Arg[], Type[], Span)
Index(Box<Expr>, Box<Expr>, Span)
Member(Box<Expr>, Ident, bool, Span)
Array(Expr[], Span)
Tuple(Expr[], Span)
Interpolated(Segment[], Span)
Lambda(LambdaParam[], ?Type, ?Type[], Box<Body>, LambdaForm, Span)
LetCond(Pattern, Box<Expr>, Span)
If(Box<Expr>, Box<Expr>, Box<Expr>, Span)
Match(Box<Expr>, Arm[], Span)
Block(Block, Span)
Loop(Block, ?string, Span)
StructInit(string[], Type[], FieldInit[], bool, Span)
TypePath(string[], Type[], Span)
With(Box<Expr>, WithField[], Span)
Comptime(Box<Expr>, Span)
Throw(Box<Expr>, Span)
Try(Box<Expr>, TryKind, Catch[], Span)
Macro(string, Expr[], ?Block, Span)

Methods

pub fn span(): Span

Returns where this expression stands: its span, or an Ident's.

pub fn toSource(): string

Returns this expression as source, as the formatter writes it.

pub fn children(): Node[]

Returns the nodes directly inside this one, in source order.