Proto

Struct Proto 

Source
pub struct Proto {
    pub stack_size: u32,
    pub param_count: u32,
    pub code: Vec<Instruction>,
    pub consts: Vec<Const>,
    pub const_map: HashMap<Const, u32>,
    pub local_vars: Vec<LocalVal>,
    pub up_vars: Vec<UpVal>,
    pub protos: Vec<Proto>,
}

Fields§

§stack_size: u32§param_count: u32§code: Vec<Instruction>§consts: Vec<Const>§const_map: HashMap<Const, u32>§local_vars: Vec<LocalVal>§up_vars: Vec<UpVal>§protos: Vec<Proto>

Implementations§

Source§

impl Proto

Source

pub fn new() -> Proto

Source

pub fn open(&mut self)

Source

pub fn close(&mut self)

Source

pub fn code_return(&mut self, first: u32, nret: u32) -> usize

Source

pub fn code_nil(&mut self, start_reg: u32, n: u32) -> usize

Source

pub fn code_bool(&mut self, reg: u32, v: bool, pc: u32) -> usize

Source

pub fn code_const(&mut self, reg_index: u32, const_index: u32) -> usize

Source

pub fn code_move(&mut self, reg: u32, src: u32) -> usize

Source

pub fn code_bin_op( &mut self, op: BinOp, target: u32, left: u32, right: u32, ) -> usize

Source

pub fn code_comp(&mut self, op: BinOp, left: u32, right: u32) -> usize

Source

pub fn code_un_op(&mut self, op: UnOp, target: u32, src: u32) -> usize

Source

pub fn code_jmp(&mut self, offset: i32, upvars: u32) -> usize

Source

pub fn fix_cond_jump_pos( &mut self, true_pos: usize, false_pos: usize, pc: usize, )

Source

pub fn fix_jump_pos(&mut self, pos: usize, pc: usize)

Source

pub fn code_test_set(&mut self, set: u32, test: u32, to_test: u32)

Source

pub fn add_local_var(&mut self, name: &str)

Source

pub fn get_local_var(&self, name: &str) -> Option<u32>

Source

pub fn add_const(&mut self, k: Const) -> u32

Source

pub fn save(&mut self, target: u32) -> usize

Source

pub fn get_instruction(&mut self, index: usize) -> &mut Instruction

Trait Implementations§

Source§

impl Debug for Proto

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Proto

§

impl RefUnwindSafe for Proto

§

impl Send for Proto

§

impl Sync for Proto

§

impl Unpin for Proto

§

impl UnwindSafe for Proto

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.