Struct koto_parser::Function [−][src]
pub struct Function {
pub args: Vec<AstIndex>,
pub local_count: usize,
pub accessed_non_locals: Vec<ConstantIndex>,
pub body: AstIndex,
pub is_instance_function: bool,
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_instance_function: bool
A flag that indicates if the function has used self
as its first argument
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
Auto Trait Implementations
impl RefUnwindSafe for Function
impl UnwindSafe for Function
Blanket Implementations
Mutably borrows from an owned value. Read more