Skip to content

GenExpr

1 min read

Import: import system.codegen;

GenExpr

An expression that a source generator can inspect.

public class GenExpr

id

Identity of this model node; pass it to GenContext.error_at to report a diagnostic here.

public id: string

kind

Syntactic shape of the expression (call, literal, binary operation, ...).

public kind: ExprKind

statement_kind

Category of the containing statement.

public statement_kind: StmtKind

span

Source range occupied by this node.

public span: GenSpan

constant

Constant value of the expression, when known.

public constant: Option<GenConstant>

text

Source text of the expression as written.

public text: string

op

Operator spelling used by the expression.

public op: string

literal

Source spelling of the literal.

public literal: string

literal_kind

Category of the literal, such as a number or string.

public literal_kind: GenValueKind

ty

Type of this declaration or expression.

public ty: GenTypeRef

symbol

Identifier of the referenced symbol.

public symbol: string

symbol_kind

Category of the referenced symbol.

public symbol_kind: GenSymbolKind

overload

Identifier distinguishing this function's overload.

public overload: string

type_args

Concrete type arguments, in parameter order.

public type_args: List<GenTypeRef>

types

Type references associated with this expression.

public types: List<GenTypeRef>

constructor

Decodes a GenExpr from its object in the generation snapshot.

public constructor(borrow v: JsonValue)

children

Returns child nodes in source order.

public fun children(): List<GenExpr>

is_kind

Tests the node kind.

public fun is_kind(kind: ExprKind): bool