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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.