minilua::details::EvalResult struct

Contents

Internal results of the interpreter.

Will be converted to the public minilua::EvalResult when the interpreter finishes.

NOTE: The fields are public because we only used them internally.

Public functions

void combine(const EvalResult& other)

Public variables

Vallist values
bool do_break
std::optional<SourceChangeTree> source_change

Function documentation

void minilua::details::EvalResult::combine(const EvalResult& other)

Combines two EvalResults (this and other) into this.

This will combine the source changes and override all other fields.

Variable documentation

Vallist minilua::details::EvalResult::values

Holds the return values of an expession.

This is a Vallist and not just a Value because some expressions can return multiple values. For places where we only expect a single value we will only take the first value of the Vallist (or nil if the list is empty).

NOTE: This might hold values that should not be accessible. Take care where in the interpreter you read/forward the values.

bool minilua::details::EvalResult::do_break

Flags to indicate if the interpreter should break/return.

This is set when encountering a orreturn` and unset when the break or return is applied (i.e. in a loop or when returning from a function).

std::optional<SourceChangeTree> minilua::details::EvalResult::source_change

Tracks optional source changes that are generated during execution.

This will contain all changes generated from any executed element the interpreter encounters.

Use EvalResult::combine to easily merge multiple EvalResults and their source changes.