Skip to content

GenStmt

1 min read

Import: import system.codegen;

GenStmt

A statement that a source generator can inspect.

public class GenStmt

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 statement (let, return, if, ...).

public 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 statement as written.

public text: string

ty

Type of the value the statement produces, or Unknown when it has none.

public ty: GenTypeRef

symbol

Identifier of the referenced symbol.

public symbol: string

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 GenStmt 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: StmtKind): bool