Struct koto_parser::Function
source · pub struct Function {
pub args: Vec<AstIndex>,
pub local_count: usize,
pub accessed_non_locals: Vec<ConstantIndex>,
pub body: AstIndex,
pub is_variadic: bool,
pub is_generator: bool,
}
Expand description
A function definition
Fields§
§args: Vec<AstIndex>
The function’s arguments
local_count: usize
The number of locally assigned values
Used by the compiler when reserving registers for local values at the start of the frame.
accessed_non_locals: Vec<ConstantIndex>
Any non-local values that are accessed in the function
Any ID (or lookup root) that’s accessed in a function and which wasn’t previously assigned locally, is either an export or the value needs to be captured. The compiler takes care of determining if an access is a capture or not at the moment the function is created.
body: AstIndex
The function’s body
is_variadic: bool
A flag that indicates if the function arguments end with a variadic ...
argument
is_generator: bool
A flag that indicates if the function is a generator or not
The presence of a yield
expression in the function body will set this to true.
Trait Implementations§
source§impl PartialEq for Function
impl PartialEq for Function
impl Eq for Function
impl StructuralPartialEq for Function
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