Skip to main content

Stat

Enum Stat 

Source
pub enum Stat {
Show 18 variants Do(Block), While { cond: ExprId, body: Block, }, Repeat { body: Block, cond: ExprId, }, If { arms: Vec<(ExprId, u32, Block)>, else_body: Option<Block>, }, NumericFor { var: Name, start: ExprId, limit: ExprId, step: Option<ExprId>, body: Block, }, GenericFor { vars: Vec<Name>, exprs: Vec<ExprId>, body: Block, expr_line: u32, }, Local { collective: Option<Attrib>, names: Vec<AttribName>, exprs: Vec<ExprId>, }, Global { collective: Option<Attrib>, names: Vec<AttribName>, exprs: Vec<ExprId>, }, GlobalAll { attrib: Option<Attrib>, }, Assign { targets: Vec<ExprId>, exprs: Vec<ExprId>, }, Call(ExprId), Function { name: FuncName, body: FuncBody, }, LocalFunction { name: Name, body: FuncBody, }, GlobalFunction { name: Name, body: FuncBody, }, Return { exprs: Vec<ExprId>, line: u32, }, Break { line: u32, }, Goto(Name), Label(Name),
}
Expand description

Top-level statement kinds — every Lua syntactic form except expressions.

Variants§

§

Do(Block)

do ... end block.

Tuple Fields

§0: Block

Inner block.

§

While

while cond do ... end.

Fields

§cond: ExprId

Loop condition evaluated each iteration.

§body: Block

Loop body.

§

Repeat

repeat ... until cond.

Fields

§body: Block

Loop body executed before testing.

§cond: ExprId

Termination condition.

§

If

if ... elseif ... else ... end.

Fields

§arms: Vec<(ExprId, u32, Block)>

(condition, then_line, body) for the if and each elseif. The then_line is the source line of the then keyword for that arm — PUC 5.3 attributes the conditional-skip JMP to that line so a taken if-then-else fires a line hook for the then keyword before the body (for i=1,n do … then … end traces include the then keyword line). 5.4 collapsed that back to the body’s first line; see if_stat in the compiler for the version split.

§else_body: Option<Block>

Optional else body.

§

NumericFor

for var = start, limit [, step] do ... end.

Fields

§var: Name

Induction variable.

§start: ExprId

Starting value expression.

§limit: ExprId

Upper bound expression.

§step: Option<ExprId>

Optional step expression (defaults to 1).

§body: Block

Loop body.

§

GenericFor

for v1, v2, ... in exprs do ... end.

Fields

§vars: Vec<Name>

Loop variables receiving each iterator call’s results.

§exprs: Vec<ExprId>

Expression list yielding iterator, state, control, and (5.4) to-be-closed value.

§body: Block

Loop body.

§expr_line: u32

Line of the first token after in (PUC forlist line); used to attribute the per-iteration TFORCALL so a non-callable iterator (for k,v in 3 do …) raises on the EXPR’s source line, not the for line.

§

Local

local [<attrib>] names = exprs.

Fields

§collective: Option<Attrib>

Single attribute applied to every name (5.4 local <const>).

§names: Vec<AttribName>

Names being introduced, each with its optional per-name attribute.

§exprs: Vec<ExprId>

Initializer expressions; missing names get nil.

§

Global

5.5 global declaration.

Fields

§collective: Option<Attrib>

Attribute applied to every name.

§names: Vec<AttribName>

Declared global names.

§exprs: Vec<ExprId>

Initializer expressions.

§

GlobalAll

5.5 global [attrib] *.

Fields

§attrib: Option<Attrib>

Attribute applied to all subsequently introduced globals.

§

Assign

Multiple assignment targets = exprs.

Fields

§targets: Vec<ExprId>

Assignment targets — each must be an lvalue (Name / Index).

§exprs: Vec<ExprId>

Right-hand side expressions, evaluated before any target is assigned.

§

Call(ExprId)

Expression statement (function or method call).

Tuple Fields

§0: ExprId

The call expression.

§

Function

function a.b.c:m() ... end.

Fields

§name: FuncName

Target path of the assignment.

§body: FuncBody

Function body.

§

LocalFunction

local function name() ... end.

Fields

§name: Name

Local name being bound.

§body: FuncBody

Function body.

§

GlobalFunction

5.5 global function f() ....

Fields

§name: Name

Global name being bound.

§body: FuncBody

Function body.

§

Return

return exprs.

Fields

§exprs: Vec<ExprId>

Returned expressions; empty for a bare return.

§line: u32

Source line of the return keyword.

§

Break

break.

Fields

§line: u32

Source line of the break keyword.

§

Goto(Name)

goto label.

Tuple Fields

§0: Name

Target label.

§

Label(Name)

::label:: declaration.

Tuple Fields

§0: Name

Label name.

Trait Implementations§

Source§

impl Clone for Stat

Source§

fn clone(&self) -> Stat

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Stat

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Stat

§

impl RefUnwindSafe for Stat

§

impl Send for Stat

§

impl Sync for Stat

§

impl Unpin for Stat

§

impl UnsafeUnpin for Stat

§

impl UnwindSafe for Stat

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.