[][src]Enum jsyc_compiler::bytecode::Operand

pub enum Operand {
    String(String),
    FloatNum(f64),
    LongNum(i32),
    ShortNum(u8),
    Reg(u8),
    RegistersArray(Vec<u8>),
    FunctionAddr(BytecodeAddrToken),
    BranchAddr(LabelAddrToken),
    FunctionArguments(FunctionArguments),
}

Represents variants of bytecode operand

There are two types of operands. Regular operands(numbers, strings or registers) and token operands. Token operands are only used by the compiler to express a dependency that cannot be calculated at the point of declaration. For example, the target of a jump is an address. However, an address can only be calculated when the entire bytecode is known. Thus, all jump instructions contain a token operand BranchAddr which holds the target label of the jump. After the compilation of this, these tokens are then replaced. Thus, token operands cannot be part of a final bytecode.

Variants

String(String)FloatNum(f64)LongNum(i32)ShortNum(u8)Reg(u8)RegistersArray(Vec<u8>)FunctionAddr(BytecodeAddrToken)BranchAddr(LabelAddrToken)FunctionArguments(FunctionArguments)

Methods

impl Operand[src]

pub fn from_literal(literal: BytecodeLiteral) -> CompilerResult<Self>[src]

pub fn str(string: String) -> Self[src]

pub fn function_addr(ident: String) -> Self[src]

pub fn branch_addr(label: Label) -> Self[src]

pub fn bc_func_args(arg_regs: Vec<Register>) -> Self[src]

pub fn is_worth_caching(&self) -> bool[src]

Trait Implementations

impl ToBytes for Operand[src]

impl PartialEq<Operand> for Operand[src]

impl Clone for Operand[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Operand[src]

impl Display for Operand[src]

Auto Trait Implementations

impl Send for Operand

impl Sync for Operand

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]