[−][src]Struct jsyc_compiler::bytecode::Bytecode
Represents the bytecode produced by the compiler.
Bytecode is a wrapper for a list of bytecode elements. It offers an API to extend it by other bytecode, commands or labels.
use jsyc_compiler::{Bytecode, Operation, Instruction, Operand}; let bytecode = Bytecode::new() .add(Operation::new(Instruction::LoadNum, vec![Operand::Reg(10), Operand::ShortNum(10)])) .add(Operation::new(Instruction::Add, vec![Operand::Reg(10), Operand::Reg(9)]));
Fields
elements: Vec<BytecodeElement>
Methods
impl Bytecode
[src]
pub fn new() -> Self
[src]
pub fn add(self, command: Operation) -> Self
[src]
pub fn add_label(self, label: Label) -> Self
[src]
Appends a label as bytecode element.
pub fn add_bytecode(self, other: Bytecode) -> Self
[src]
Appends another bytecode onto this bytecode.
pub fn encode_base64(&self) -> String
[src]
Returns the base64-encoded bytecode as string.
pub fn last_op_is_return(&self) -> bool
[src]
Checks whether the last element is a return instruction.
pub fn commands_iter_mut(&mut self) -> impl Iterator<Item = &mut Operation>
[src]
Returns an iterator over all commands in the bytecode.
Trait Implementations
impl ToBytes for Bytecode
[src]
impl PartialEq<Bytecode> for Bytecode
[src]
impl Clone for Bytecode
[src]
fn clone(&self) -> Bytecode
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for Bytecode
[src]
impl Display for Bytecode
[src]
impl FromIterator<Bytecode> for Bytecode
[src]
fn from_iter<I: IntoIterator<Item = Bytecode>>(iter: I) -> Self
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,