pub enum Statement {
Show 15 variants
FunctionDecl(Function),
StructDecl(Struct),
EnumDecl(Enum),
VariableDecl {
name: String,
ty: Type,
source_type: Option<String>,
value: Expression,
},
Assignment {
target: Expression,
value: Expression,
},
Conditional {
condition: Expression,
then_block: Vec<Self>,
else_block: Vec<Self>,
},
Return(Option<Expression>),
Expr(Expression),
ForIn {
var: String,
iter: Expression,
body: Vec<Self>,
ipairs: bool,
},
ForNumeric {
var: String,
start: Expression,
limit: Expression,
body: Vec<Self>,
},
While {
condition: Expression,
body: Vec<Self>,
},
Continue,
Break,
RawLua {
code: String,
},
SourceOrigin {
origin: Origin,
},
}Variants§
FunctionDecl(Function)
StructDecl(Struct)
EnumDecl(Enum)
VariableDecl
Assignment
Conditional
Return(Option<Expression>)
Expr(Expression)
ForIn
for _, VAR in pairs/ipairs(ITER) do BODY end in Lua.
Fields
iter: ExpressionForNumeric
for VAR = START, LIMIT do BODY end in Lua (inclusive limit, step 1).
While
while CONDITION do BODY end in Lua. Rust loop { } lowers with
condition = true.
Continue
goto __continue_N in Lua (the label ::__continue_N:: is emitted by
the enclosing ForIn / ForNumeric / While).
Break
Lua break (exits the innermost loop).
RawLua
Verbatim Lua source emitted as-is (from lua! { ... } in unsafe context).
Each line of code is emitted with the current generator indent prefix.
The optimizer and pruner treat this variant as fully opaque.
SourceOrigin
Marks the Rust origin of the following executable statement(s).
Consumed by codegen when building sourcemaps; emits no Lua. Opt/prune passes should preserve these markers (or drop them only with the statements they annotate).