Skip to main content

FuncState

Struct FuncState 

Source
pub struct FuncState {
Show 18 fields pub f: Box<LuaProto>, pub prev: Option<Box<FuncState>>, pub bl: Option<Box<BlockCnt>>, pub pc: i32, pub lasttarget: i32, pub previousline: i32, pub nk: i32, pub np: i32, pub nabslineinfo: i32, pub firstlocal: i32, pub firstlabel: i32, pub ndebugvars: i16, pub nactvar: u8, pub nups: u8, pub freereg: u8, pub iwthabs: u8, pub needclose: bool, pub last_token_line: i32,
}
Expand description

C: FuncState — per-function compile-time state. In C: stack-allocated in body(), chained via raw *prev pointer. In Rust: heap-allocated via Option<Box<FuncState>> in LexState.

Fields§

§f: Box<LuaProto>

C: f — the Proto being built. PORT NOTE: types.tsv maps this to GcRef; we use Box during compilation to avoid RefCell overhead. close_func hands it to the GC/parent at close time.

§prev: Option<Box<FuncState>>

C: prev — enclosing FuncState (raw pointer in C; owned Box here).

§bl: Option<Box<BlockCnt>>

C: bl — innermost active block

§pc: i32

C: pc — next bytecode position to emit

§lasttarget: i32

C: lasttarget — pc of last ‘jump label’

§previousline: i32

C: previousline — last line saved in lineinfo

§nk: i32

C: nk — number of constants emitted

§np: i32

C: np — number of nested prototypes emitted

§nabslineinfo: i32

C: nabslineinfo — number of absolute line-info records

§firstlocal: i32

C: firstlocal — index of first local var in dyd.actvar

§firstlabel: i32

C: firstlabel — index of first label in dyd.label

§ndebugvars: i16

C: ndebugvars — entries in f.locvars

§nactvar: u8

C: nactvar — number of active locals

§nups: u8

C: nups — number of upvalues

§freereg: u8

C: freereg — next free register

§iwthabs: u8

C: iwthabs — instructions since last absolute line info

§needclose: bool

C: needclose — function must close upvalues on return

§last_token_line: i32

Current ls.lastline value, mirrored on every sync_from_lex. Used by emit_inst to attribute the line to the just-consumed token (matching lua-c’s savelineinfo(fs, f, fs->ls->lastline)), instead of whatever line the caller threaded down. The threaded line param is preserved only for explicit overrides (luaK_fixline-style).

Trait Implementations§

Source§

impl Debug for FuncState

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> 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, 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.