pub struct Function {
pub args: AstVec<AstIndex>,
pub local_count: usize,
pub accessed_non_locals: AstVec<ConstantIndex>,
pub body: AstIndex,
pub is_variadic: bool,
pub is_generator: bool,
pub output_type: Option<AstIndex>,
}
Expand description
A function definition
Fields§
§args: AstVec<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: AstVec<ConstantIndex>
Any non-local values that are accessed in the function
Any ID (or chain 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.
output_type: Option<AstIndex>
The optional output type of the function