pub struct Function {
pub name: RefString,
pub t: RefType,
pub findex: RefFun,
pub regs: Vec<RefType>,
pub ops: Vec<Opcode>,
pub debug_info: Option<Vec<(usize, usize)>>,
pub assigns: Option<Vec<(RefString, usize)>>,
pub parent: Option<RefType>,
}
Expand description
A function definition with its code.
Fields§
§name: RefString
Functions have no name per se, this is the name of the field or method they are attached to
t: RefType
§findex: RefFun
§regs: Vec<RefType>
The types of the registers used by this function
ops: Vec<Opcode>
Instructions
debug_info: Option<Vec<(usize, usize)>>
Debug File and line information for each instruction
assigns: Option<Vec<(RefString, usize)>>
Debug Information about some variables names for some instructions
parent: Option<RefType>
Parent type (Obj/Struct) this function is a member of. This does not mean it’s a method
Implementations§
Source§impl Function
impl Function
Sourcepub fn is_from_std(&self, code: &Bytecode) -> bool
pub fn is_from_std(&self, code: &Bytecode) -> bool
return true if the function is from the standard library
Source§impl Function
impl Function
pub fn display_fmt<'a, Fmt: BytecodeFmt + 'a>( &'a self, bcfmt: Fmt, ctx: &'a Bytecode, ) -> impl Display + 'a
pub fn display<'a, Fmt: BytecodeFmt + Default + 'a>( &'a self, ctx: &'a Bytecode, ) -> impl Display + 'a
Source§impl Function
impl Function
pub fn display_header_fmt<'a, Fmt: BytecodeFmt + 'a>( &'a self, bcfmt: Fmt, ctx: &'a Bytecode, ) -> impl Display + 'a
pub fn display_header<'a, Fmt: BytecodeFmt + Default + 'a>( &'a self, ctx: &'a Bytecode, ) -> impl Display + 'a
Source§impl Function
impl Function
Sourcepub fn args<'a>(&self, code: &'a Bytecode) -> &'a [RefType]
pub fn args<'a>(&self, code: &'a Bytecode) -> &'a [RefType]
Convenience method to resolve the function args
Sourcepub fn ret<'a>(&self, code: &'a Bytecode) -> &'a Type
pub fn ret<'a>(&self, code: &'a Bytecode) -> &'a Type
Convenience method to resolve the function return type
Sourcepub fn arg_name(&self, code: &Bytecode, pos: usize) -> Option<Str>
pub fn arg_name(&self, code: &Bytecode, pos: usize) -> Option<Str>
Uses the assigns to find the name of an argument
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Function
impl RefUnwindSafe for Function
impl Send for Function
impl Sync for Function
impl Unpin for Function
impl UnwindSafe for Function
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more