pub struct ExprPayload {
pub ival: i64,
pub nval: f64,
pub strval: Option<GcRef<LuaString>>,
pub info: i32,
pub ind_idx: i16,
pub ind_t: u8,
pub var_ridx: u8,
pub var_vidx: u16,
pub global_const_name: Option<GcRef<LuaString>>,
}Expand description
The payload of an ExprDesc, discriminated by its sibling ExprKind
(ExprDesc::k). Only the field(s) named for the active kind are meaningful;
the rest are unused for that kind.
This is intentionally a flat struct rather than a tagged enum carrying
per-variant data. Folding it into one is a deliberate recorded
honest-negative (see the Sprint-1 recipe ledger): the kind and the payload
are set in separate statements throughout codegen (e.g. init_exp writes a
dummy info for every kind, then the caller overwrites the real field), and
several helpers take the kind and the payload as separate arguments — shapes
an enum’s “the variant is the data” model cannot express without an invalid
intermediate. The behavioral invariant (which field each kind uses) is held
by the bytecode-parity oracle, not by the type system here.
Fields§
§ival: i64§nval: f64§strval: Option<GcRef<LuaString>>§info: i32§ind_idx: i16§ind_t: u8§var_ridx: u8§var_vidx: u16§global_const_name: Option<GcRef<LuaString>>Lua 5.5: when this expression resolves a global that was declared
global x <const>, the declared name is recorded here so that an
assignment to it is rejected by [check_readonly]. None for every
other expression (and on all pre-5.5 versions).
Trait Implementations§
Source§impl Clone for ExprPayload
impl Clone for ExprPayload
Source§fn clone(&self) -> ExprPayload
fn clone(&self) -> ExprPayload
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more