Struct passerine::common::lambda::Lambda[][src]

pub struct Lambda {
    pub decls: usize,
    pub code: Vec<u8>,
    pub spans: Vec<(usize, Span)>,
    pub constants: Vec<Data>,
    pub captures: Vec<Captured>,
    pub ffi: Vec<FFIFunction>,
}
Expand description

Represents a single interpretable chunk of bytecode, think a function.

Fields

decls: usize

Number of variables declared in this scope.

code: Vec<u8>

Each byte is an opcode or a number-stream.

spans: Vec<(usize, Span)>

Each usize indexes the bytecode op that begins each line.

constants: Vec<Data>

Number-stream indexed, used to load constants.

captures: Vec<Captured>

List of positions of locals in the scope where this lambda is defined, indexes must be gauranteed to be data on the heap.

ffi: Vec<FFIFunction>

List of FFI functions (i.e. Rust functions) that can be called from this function.

Implementations

Creates a new empty Lambda to be filled.

Emits an opcode as a byte.

Emits a series of bytes.

Emits a span, should be called before an opcode is emmited. This function ties opcodes to spans in source. See index_span as well.

Removes the last emitted byte.

Given some data, this function adds it to the constants table, and returns the data’s index. The constants table is push only, so constants are identified by their index. The resulting usize can be split up into a number byte stream, and be inserted into the bytecode.

Look up the nearest span at or before the index of a specific bytecode op.

Adds a ffi function to the ffi table, without checking for duplicates. The Compiler ensures that functions are valid and not duplicated during codegen.

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

Dump a human-readable breakdown of a Lambda’s bytecode. Including constants, captures, and variables declared.

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)

recently added

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

Converts the given value to a String. 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.