README

dowdiness/js_engine/interpreter/runtime does not have a README file

#
ExecutorActivationFrame

pub(open) trait ExecutorActivationFrame {
fn step(Self, Interpreter) -> ExecutorActivationStep raise
fn deliver_activation_completion(Self, ExecutorActivationCompletion) -> Unit raise
}

#
ExecutorCode

pub(open) trait ExecutorCode {
fn start(Self, Interpreter, PreparedExecutorActivation) -> &ExecutorActivationFrame raise
}

#
GeneratorReturnSignal

pub suberror GeneratorReturnSignal {
GeneratorReturnSignal(Value)
}

Generator return signal — used to inject return at yield point This is NOT JS-catchable, but must trigger finally blocks.

#
JsException

pub suberror JsException {
JsException(Value)
}

#
JsonBridgeError

pub(all) suberror JsonBridgeError {
JsonBridgeFailure(String)
} derive(
Debug
)

Internal failure used by the stable Engine JSON boundary.

#
YieldSignal

pub suberror YieldSignal {
YieldSignal(Value)
}

Yield signal — used to suspend generator execution

#
ArrayBufferState

pub(all) struct ArrayBufferState {
id_counter :
Ref
[Int]
store : Map[Int, Array[Int]]
detached : Map[Int, Bool]
}

#
ArrayBufferState::ArrayBufferState

fn ArrayBufferState::ArrayBufferState() -> ArrayBufferState

#
ArrayData

pub(all) struct ArrayData {
elements : Array[Value]
bag : PropertyBag
length_writable : Bool
holes : Map[Int, Unit]
extensible : Bool
}

#
Binding

pub(all) struct Binding {
value : Value
kind : BindingKind
initialized : Bool
annex_b_hoisted : Bool
is_parameter : Bool
}

#
BindingKind

pub(all) enum BindingKind {
LetBinding
ConstBinding
VarBinding
FunctionNameBinding
} derive(Eq,
Debug
)

impl Show for BindingKind

#
BuiltinCtorPrototypeInstall

pub(all) enum BuiltinCtorPrototypeInstall {
FrozenAtInstall
PreBagged
AssignAtInstall
}

How the constructor object's .prototype property is prepared before the cache-for-X install pins proto and registers ctor in env.

#
CallContext

pub(all) enum CallContext {
Call
Construct
ConstructWithTarget(Value)
}

#
CallContext::is_constructing

fn CallContext::is_constructing(self : CallContext) -> Bool

#
CallContext::new_target

fn CallContext::new_target(self : CallContext) -> Value?

#
Callable

pub(all) enum Callable {
UserFunc(FuncData)
ArrowFunc(FuncData)
UserFuncExt(FuncDataExt)
ArrowFuncExt(FuncDataExt)
NativeCallable(String, (Array[Value]) -> Value raise)
NativeCallableWithContext(String, (CallContext, Array[Value]) -> Value raise)
NonConstructableCallable(String, (Array[Value]) -> Value raise)
BoundFunc(Value, Value, Array[Value])
FuncCallMethod(Value)
FuncApplyMethod(Value)
MethodCallable(String, (Value, Array[Value]) -> Value raise)
InterpreterCallable(String, (Interpreter, Value, Array[Value]) -> Value raise)
InterpreterCallableWithContext(String, (Interpreter, CallContext, Value, Array[Value]) -> Value raise)
ExecutorCallable(ExecutorCallableData)
NonConstructableInterpreterCallable(String, (Interpreter, Array[Value]) -> Value raise)
ConstructorOnlyCallable(String, (Interpreter, Array[Value]) -> Value raise)
ClassConstructor(ClassConstructorData)
}

#
ClassConstructorData

pub(all) struct ClassConstructorData {
name : String
proto : Value
super_ctor : Value?
ctor_fn : (Array[
Param
], String?, Array[
Stmt
])?
closure : Environment
super_proto : Value
instance_fields : Array[ClassFieldInit]
private_instance_fields : Array[ClassFieldInit]
source_text : String?
private_brand : Value
private_methods : Map[String, Value]
}

#
ClassFieldInit

pub(all) struct ClassFieldInit {
key : Value
initializer :
Expr
?
closure : Environment
}

A single instance field initializer, captured at class definition time.

#
Environment

pub(all) struct Environment {
bindings : Map[String, Binding]
parent : Environment?
is_var_scope : Bool
with_object : Value?
realm_state : RealmState?
interpreter_context : Interpreter?
error_class_names : Map[String, Unit]
markers : Map[String, Bool]
}

#
Environment::assign

fn Environment::assign(self : Environment, name : String, value : Value) -> Unit raise

#
Environment::assign_var

fn Environment::assign_var(self : Environment, name : String, value : Value) -> Unit raise

Assign to the nearest var-compatible binding with the given name, skipping real let/const bindings in intervening scopes. This is needed for eval'd var declarations that must target the function scope's var or parameter binding, even when a block-scoped let/const shadows the name in between.

#
Environment::def

fn Environment::def(self : Environment, name : String, value : Value, kind : BindingKind) -> Unit raise

#
Environment::def_builtin

fn Environment::def_builtin(self : Environment, name : String, value : Value) -> Unit

#
Environment::def_param_tdz

fn Environment::def_param_tdz(self : Environment, name : String) -> Unit raise

Define an uninitialized parameter TDZ binding. Used by the parameter pre-pass (§10.2.11 step 21) so self/forward-referring defaults throw ReferenceError rather than resolving the outer scope's binding.

#
Environment::def_parameter

fn Environment::def_parameter(self : Environment, name : String, value : Value) -> Unit raise

Define a function parameter binding. Parameters are stored as LetBinding with is_parameter: true so the Annex B block-level function extension can distinguish them from real let declarations.

#
Environment::def_tdz

fn Environment::def_tdz(self : Environment, name : String, kind : BindingKind) -> Unit raise

Define a TDZ binding (let/const before initialization)

#
Environment::find_var_env

fn Environment::find_var_env(self : Environment) -> Environment

Walk up the scope chain to find the nearest variable environment (function or global scope where var declarations are hoisted to).

#
Environment::find_with_object

fn Environment::find_with_object(self : Environment, name : String) -> Value? raise

Find the with-object for a name (walking up env chain to find a with env containing this name)

#
Environment::get

fn Environment::get(self : Environment, name : String) -> Value raise

#
Environment::has

fn Environment::has(self : Environment, name : String) -> Bool raise

#
Environment::has_var

fn Environment::has_var(self : Environment, name : String) -> Bool

Walk up the scope chain to find a var-compatible binding with the given name. Formal parameters are included because sloppy function-body var declarations may redeclare and update mapped parameter bindings.

#
Environment::initialize

fn Environment::initialize(self : Environment, name : String, value : Value) -> Unit raise

Initialize a TDZ binding (when declaration is executed)

#
Environment::initialize_in_chain

fn Environment::initialize_in_chain(self : Environment, name : String, value : Value) -> Unit raise

Walk the scope chain to find an existing binding for name and initialize it with value. Unlike initialize, which only looks at the local env, this climbs parents. Needed for super() to write this back to the derived class's param env when body execution happens in a separate body env (§10.2.11 split). For derived-constructor TDZ this, the write follows BindThisValue and rejects a second initialization.

#
Environment::new

fn Environment::new(parent? : Environment?) -> Environment

#
ExecContext

pub(all) struct ExecContext {
strict : Bool
current_generator : GeneratorObject?
}

Immutable per-call execution context passed through the evaluation pipeline. Replaces the mutable strict and current_generator fields that were previously on the Interpreter struct, eliminating fragile save/restore patterns.

#
ExecutionPolicy

pub(all) struct ExecutionPolicy {
// private fields
}

Public, immutable policy inputs for an explicitly bounded evaluation. The fields remain private so callers can only obtain validated values.

#
ExecutionPolicy::new

fn ExecutionPolicy::new(step_budget : Int64, stack_depth_limit : Int64, interruption : InterruptionHandle) -> Result[ExecutionPolicy, ExecutionPolicyError]

#
ExecutionPolicyError

pub(all) struct ExecutionPolicyError {
// private fields
}

Opaque validation details for an invalid bounded-evaluation policy.

#
ExecutionPolicyError::message

fn ExecutionPolicyError::message(self : ExecutionPolicyError) -> String

#
ExecutionPolicyError::parameter_code

fn ExecutionPolicyError::parameter_code(self : ExecutionPolicyError) -> String

#
ExecutorActivationCompletion

pub enum ExecutorActivationCompletion {
ExecutorActivationCompletionNormal(Value)
ExecutorActivationCompletionAbrupt(Error)
}

#
ExecutorActivationStep

pub enum ExecutorActivationStep {
ExecutorActivationContinue
ExecutorActivationNormal(Value)
ExecutorActivationReturn(Value)
ExecutorActivationCall(ExecutorCallRequest)
ExecutorActivationConstruct(ExecutorConstructRequest)
ExecutorActivationPropertyGet(ExecutorPropertyGetRequest)
}

#
ExecutorCallRequest

pub struct ExecutorCallRequest {
// private fields
}

#
ExecutorCallableData

pub struct ExecutorCallableData {
// private fields
}

#
ExecutorCallableData::is_constructable

fn ExecutorCallableData::is_constructable(self : ExecutorCallableData) -> Bool

#
ExecutorCallableData::length

fn ExecutorCallableData::length(self : ExecutorCallableData) -> Int

#
ExecutorCallableData::name

fn ExecutorCallableData::name(self : ExecutorCallableData) -> String

#
ExecutorCallableData::start_frame

#
ExecutorConstructRequest

pub struct ExecutorConstructRequest {
// private fields
}

#
ExecutorPropertyGetRequest

pub struct ExecutorPropertyGetRequest {
// private fields
}

#
FuncData

pub(all) struct FuncData {
name : String?
params : Array[String]
body : Array[
Stmt
]
closure : Environment
strict : Bool
has_name_binding : Bool
is_method : Bool
source_text : String?
}

#
FuncDataExt

pub(all) struct FuncDataExt {
name : String?
params : Array[
Param
]
rest_param : String?
body : Array[
Stmt
]
closure : Environment
strict : Bool
has_name_binding : Bool
is_method : Bool
source_text : String?
}

#
FunctionRealmProtos

pub(all) struct FunctionRealmProtos {
function_proto : Value?
object_proto : Value?
string_proto : Value?
number_proto : Value?
boolean_proto : Value?
symbol_proto : Value?
array_proto : Value?
map_proto : Value?
set_proto : Value?
promise_proto : Value?
constructor_prototype_registry : Value?
}

#
FunctionRealmProtos::FunctionRealmProtos

fn FunctionRealmProtos::FunctionRealmProtos(function_proto? : Value?, object_proto? : Value?, string_proto? : Value?, number_proto? : Value?, boolean_proto? : Value?, symbol_proto? : Value?, array_proto? : Value?, map_proto? : Value?, set_proto? : Value?, promise_proto? : Value?, constructor_prototype_registry? : Value?) -> FunctionRealmProtos

#
GenState

pub(all) enum GenState {
SuspendedStart
Executing
SuspendedYield
Completed
}

Generator state machine

#
GeneratorObject

pub(all) struct GeneratorObject {
id : Int
state : GenState
body : Array[
Stmt
]
strict : Bool
params : Array[String]
params_ext : Array[
Param
]?
rest_param : String?
closure : Environment
is_async : Bool
name : String?
interpreter : Interpreter
args : Array[Value]
this_val : Value
env : Environment?
pc : Int
yield_value : Value
resuming : Bool
resume_action : ResumeAction
try_resume_phase : Int
try_resume_yield_base : Int
try_resume_error : Value
try_resume_result : Signal
try_resume_pending_error : Error?
loop_env_stack : Array[Environment]
loop_yield_base_stack : Array[Int]
stmt_resume_index_stack : Array[Int]
stmt_resume_env_stack : Array[Environment]
stmt_resume_value_stack : Array[Value]
for_of_iterator : Value
for_of_next : Value
for_of_iterator_stack : Array[Value]
for_of_next_stack : Array[Value]
for_of_resume : Bool
for_of_awaiting_next : Bool
dstr_iterator_stack : Array[Value]
delegate_iterator : Value
delegate_next : Value
delegating : Bool
yield_index : Int
resume_at_yield : Int
yield_resume_values : Map[Int, Value]
}

Generator object stored as internal data on an ObjectData

#
HostEnv

pub(all) struct HostEnv {
output : Array[String]
microtask_queue : Array[Microtask]
timer_queue :
PriorityQueue
[TimerTask]
timer_id_counter :
Ref
[Int]
timer_insertion_counter :
Ref
[Int]
cancelled_timer_ids : Map[Int, Bool]
module_loader : ModuleLoader?
}

Host environment state — concerns that belong to the runtime container rather than the JavaScript execution model itself.

Separating these fields makes the engine/host boundary explicit and enables future host-environment variations (different I/O, timer semantics, or module resolution) without touching execution internals.

#
HostSlotKey

pub(all) struct HostSlotKey {
// private fields
} derive(Eq, Hash,
Debug
)

Embedder-owned slot identity. Construct only via HostSlotKey::reserve.

#
HostSlotKey::reserve

fn HostSlotKey::reserve() -> HostSlotKey

Allocate a unique key within this loaded runtime package instance. Aborts if the allocator is exhausted — never wraps.

#
InternalSlotKey

pub(all) enum InternalSlotKey {
StringData
NumberData
BooleanData
SymbolData
PrimitiveValue
ArrayLength
TypedArrayName
ViewedArrayBuffer
ArrayBufferID
ByteOffset
ByteLength
ArrayBufferByteLength
DateValue
ExportName
NamespaceObject
ExportValue
SyncIterator
SyncNextMethod
SourceText
PrivateBrandStore
} derive(Eq, Hash,
Debug
)

#
Interpreter

pub(all) struct Interpreter {
host : HostEnv
global : Environment
global_this : Value
annex_b : Bool
realm_state : RealmState
module_registry : Map[String, Map[String, Value]]
module_exports : Map[String, Value]
module_export_bindings : Array[(String, String)]
generator_objects : Map[Int, GeneratorObject]
gen_id_counter :
Ref
[Int]
symbols : SymbolState
stdlib_hooks : StdlibHooks
in_nonarrow_param_default_eval : Bool
param_default_eval_var_conflicts :
Set
[String]?
}

#
Interpreter::array_define_own_property

fn Interpreter::array_define_own_property(self : Interpreter, arr : ArrayData, key : Value, partial : PartialDescriptor, loc :
Loc
) -> Bool raise

ES §10.4.2.1 Array exotic [[DefineOwnProperty]]. Dispatches on:
  • key == "length" -> array_set_length (§10.4.2.4 with partial truncation).
  • key is array index -> ordinary-style write against bag, plus grow elements to idx+1 (ArraySetLength auto-grow) ONLY when descriptor is the default-data shape. Non-default (configurable:false / writable:false / enumerable:false) descriptors on indexed elements return false pending Stage C's per-index descriptor storage.
  • Other keys -> ordinary-style write against arr.bag.

#
Interpreter::array_set_length

fn Interpreter::array_set_length(self : Interpreter, arr : ArrayData, partial : PartialDescriptor) -> Bool raise

ES §10.4.2.4 ArraySetLength. The partial truncation loop is the crux of this algorithm — see the Learn by Doing contribution point.

#
Interpreter::assign_compiled_name

fn Interpreter::assign_compiled_name(self : Interpreter, ctx : ExecContext, env : Environment, name : String, value : Value) -> Value raise

Assign an identifier for compiled execution without duplicating global object, strict-mode, or implicit-global assignment rules in the compiler.

#
Interpreter::call_direct_eval_or_shadowed

fn Interpreter::call_direct_eval_or_shadowed(self : Interpreter, callee : Value, args : Array[Value], env : Environment, loc :
Loc
, caller_strict~ : Bool) -> Value raise

#
Interpreter::call_value

fn Interpreter::call_value(self : Interpreter, callee : Value, this_val : Value, args : Array[Value], loc :
Loc
) -> Value raise

#
Interpreter::construct_value

fn Interpreter::construct_value(self : Interpreter, ctor : Value, args : Array[Value], loc :
Loc
, proto_override? : Value?, new_target? : Value?) -> Value raise

#
Interpreter::copy_object_spread_properties

fn Interpreter::copy_object_spread_properties(self : Interpreter, target : Value, source : Value, loc :
Loc
) -> Unit raise

#
Interpreter::define_compiled_binding

fn Interpreter::define_compiled_binding(self : Interpreter, env : Environment, kind :
VarKind
, name : String, value : Value, has_initializer : Bool) -> Unit raise

#
Interpreter::define_own_property

fn Interpreter::define_own_property(self : Interpreter, val : Value, key : Value, partial : PartialDescriptor, loc :
Loc
) -> Bool raise

ES [[DefineOwnProperty]] dispatcher — routes Proxy targets through the defineProperty trap (proxy_define_property), others through ordinary_define_own_property. This is the main entry point builtins and internal callers should use.

#
Interpreter::define_simple_arguments_object

fn Interpreter::define_simple_arguments_object(self : Interpreter, env : Environment, args : Array[Value], callee : Value, strict : Bool, params : Array[String]) -> Unit raise

#
Interpreter::define_unmapped_arguments_object

fn Interpreter::define_unmapped_arguments_object(self : Interpreter, env : Environment, args : Array[Value], callee : Value, strict : Bool) -> Unit raise

#
Interpreter::delete_property_key

fn Interpreter::delete_property_key(self : Interpreter, obj : Value, key : Value, strict? : Bool) -> Bool raise

#
Interpreter::enqueue_microtask

fn Interpreter::enqueue_microtask(self : Interpreter, callback : Value, args : Array[Value]) -> Unit

Enqueue a microtask to be executed when the current execution context completes. This implements HostEnqueuePromiseJob from the ECMAScript spec.

#
Interpreter::eval_destructure_assign

fn Interpreter::eval_destructure_assign(self : Interpreter, ctx : ExecContext, pattern :
Pattern
, value : Value, env : Environment) -> Value raise

#
Interpreter::eval_super_computed_call_reference

fn Interpreter::eval_super_computed_call_reference(self : Interpreter, env : Environment, key : Value, loc :
Loc
) -> (Value, Value) raise

#
Interpreter::eval_super_computed_property

fn Interpreter::eval_super_computed_property(self : Interpreter, env : Environment, key : Value, loc :
Loc
) -> Value raise

#
Interpreter::eval_super_property

fn Interpreter::eval_super_property(self : Interpreter, env : Environment, prop : String, loc :
Loc
) -> Value raise

#
Interpreter::eval_super_property_call_reference

fn Interpreter::eval_super_property_call_reference(self : Interpreter, env : Environment, prop : String, loc :
Loc
) -> (Value, Value) raise

#
Interpreter::eval_update_computed_property

fn Interpreter::eval_update_computed_property(self : Interpreter, ctx : ExecContext, obj : Value, key : Value, op :
UpdateOp
, prefix : Bool, member_loc :
Loc
, loc :
Loc
) -> Value raise

#
Interpreter::eval_update_property

fn Interpreter::eval_update_property(self : Interpreter, ctx : ExecContext, obj : Value, prop : String, op :
UpdateOp
, prefix : Bool, member_loc :
Loc
, loc :
Loc
) -> Value raise

#
Interpreter::get_cached_tagged_template_object

fn Interpreter::get_cached_tagged_template_object(self : Interpreter, key : String, quasis : Array[(String, String?)]) -> Value

#
Interpreter::get_compiled_name

fn Interpreter::get_compiled_name(self : Interpreter, env : Environment, name : String) -> Value raise

Resolve an identifier for compiled execution using the same runtime fallback as the tree-walking interpreter.

#
Interpreter::get_computed_property

fn Interpreter::get_computed_property(self : Interpreter, obj : Value, key : Value, loc :
Loc
) -> Value raise

#
Interpreter::get_console_member

fn Interpreter::get_console_member(self : Interpreter, prop : String) -> Value raise

#
Interpreter::get_iterator_next_method

fn Interpreter::get_iterator_next_method(self : Interpreter, iterator : Value, loc :
Loc
) -> Value raise

Return an iterator's next method using the spec §7.4.1 [[Get]] path. Per spec, callability is NOT checked here — GetIterator only gets the property. The TypeError fires later in IteratorNext when Call(nextMethod, ...) is attempted.

#
Interpreter::get_own_property

fn Interpreter::get_own_property(self : Interpreter, val : Value, key : Value) -> (PropDescriptor, Value)? raise

ES [[GetOwnProperty]] dispatcher — Proxy targets route through proxy_get_own_property, TypedArrays synthesize integer-indexed element descriptors per §10.4.5.1, and others route through ordinary_get_own_property. Returns (descriptor, value) pairs so the trap-provided value in the Proxy case flows through (PropDescriptor has no value slot — the value is stored separately on the bag or synthesized by the trap).

#
Interpreter::get_property

fn Interpreter::get_property(self : Interpreter, obj : Value, prop : String, loc :
Loc
) -> Value raise

#
Interpreter::get_property_key_with_receiver

fn Interpreter::get_property_key_with_receiver(self : Interpreter, target : Value, key : Value, receiver : Value, loc :
Loc
) -> Value raise

ES [[Get]] with an explicit Receiver and an already-evaluated property-key input. This is the shared receiver-aware boundary for ordinary objects and every object-like Value variant. The key is canonicalized once at entry; recursive prototype steps keep the resulting String/Symbol unchanged.

#
Interpreter::get_prototype_from_constructor

fn Interpreter::get_prototype_from_constructor(self : Interpreter, ctor : Value, loc :
Loc
) -> Value raise

#
Interpreter::has_property

fn Interpreter::has_property(self : Interpreter, val : Value, name : String) -> Bool raise

Interpreter method: HasProperty with explicit interpreter context.

#
Interpreter::has_property_key

fn Interpreter::has_property_key(self : Interpreter, val : Value, key : Value) -> Bool raise

ES §7.3.11 HasProperty with a pre-computed property key.

#
Interpreter::iterator_close

fn Interpreter::iterator_close(self : Interpreter, iterator : Value, loc :
Loc
) -> Unit raise

IteratorClose(iteratorRecord, completion) for a non-throw completion.

Resolves "return" via [[Get]], calls it if present, and raises on GetMethod/Call/IsObject failures (§7.4.11 steps 6–7). Use iterator_close_throw when completion is a throw completion.

#
Interpreter::iterator_close_throw

fn Interpreter::iterator_close_throw(self : Interpreter, iterator : Value, loc :
Loc
) -> Unit

IteratorClose(iteratorRecord, ThrowCompletion(...)) (§7.4.11 step 5).

Attempts return() for cleanup, then discards GetMethod/Call/IsObject errors so the original ThrowCompletion remains the completion value. Infallible: callers re-raise the original error after this returns.

#
Interpreter::iterator_result_value

fn Interpreter::iterator_result_value(self : Interpreter, iter_result : Value, loc :
Loc
) -> Value raise

Perform IteratorValue(iterResult).

#
Interpreter::iterator_step_result

fn Interpreter::iterator_step_result(self : Interpreter, iterator : Value, next_method : Value, loc :
Loc
) -> Value? raise

Perform IteratorStep(iteratorRecord).

#
Interpreter::iterator_step_value

fn Interpreter::iterator_step_value(self : Interpreter, iterator : Value, next_method : Value, loc :
Loc
) -> Value? raise

Perform IteratorStep followed by IteratorValue.

#
Interpreter::new

fn Interpreter::new(annex_b? : Bool, module_loader? : ModuleLoader?, setup_builtins? : (Environment, Array[String], RealmState, Bool) -> Unit, setup_harness? : (Environment, Array[String], Value) -> Unit, stdlib_hooks? : StdlibHooks) -> Interpreter

#
Interpreter::observe_execution_step

fn Interpreter::observe_execution_step(self : Interpreter) -> Unit raise

#
Interpreter::ordinary_define_own_property

fn Interpreter::ordinary_define_own_property(self : Interpreter, val : Value, key : Value, partial : PartialDescriptor, loc :
Loc
) -> Bool raise

ES §10.1.6 OrdinaryDefineOwnProperty(O, P, Desc) + §10.4.2.1 Array exotic dispatch + §10.4.5.3 IntegerIndexed exotic dispatch. Returns true on success, false on rejection (the caller — Object.defineProperty throws, Reflect.defineProperty returns false).

#
Interpreter::own_property_keys

fn Interpreter::own_property_keys(self : Interpreter, val : Value) -> Array[Value] raise

Canonical [[OwnPropertyKeys]] (ES §10.1.11 + Array/String/Module/TypedArray /Proxy exotic variants). Returns the own keys of val as String_/Symbol Values in spec order: integer indices ascending, then insertion-order string keys, then symbol keys. Array holes are omitted; TypedArray integer indices surface; the Proxy variant runs the ownKeys trap. Every own-key consumer in the runtime/stdlib routes through this op.

#
Interpreter::partial_descriptor_from_attrs

fn Interpreter::partial_descriptor_from_attrs(self : Interpreter, attrs : Value, loc :
Loc
) -> PartialDescriptor raise

ES §6.2.5.5 ToPropertyDescriptor. Extract a PartialDescriptor from a JS attrs object, invoking getters and reading inherited properties per spec. Throws TypeError if:
  • attrs is not an object
  • both data (value/writable) and accessor (get/set) fields appear
  • get or set is non-callable non-undefined

#
Interpreter::perform_eval

fn Interpreter::perform_eval(self : Interpreter, code : String, caller_env : Environment, direct : Bool, caller_strict? : Bool) -> Value raise

Execute eval code in a given environment. If direct is true, executes in the caller's environment (direct eval). If direct is false, executes in the global environment (indirect eval). Handles strict mode isolation and var leaking per ES spec.

Per ES spec (18.2.1.1 PerformEval):
  • Strict eval: all declarations (var, let, const, function) are isolated in a new scope
  • Non-strict direct eval: var/function declarations leak to caller's variable environment, but let/const are isolated in a new eval lexical scope
  • Non-strict indirect eval: var/function declarations leak to global scope, but let/const are isolated in a new eval lexical scope

#
Interpreter::prepare_executor_callable_call

fn Interpreter::prepare_executor_callable_call(self : Interpreter, executable : ExecutorCallableData, callee : Value, this_value : Value, args : Array[Value]) -> PreparedExecutorActivation raise

#
Interpreter::register_module

fn Interpreter::register_module(self : Interpreter, specifier : String, exports : Map[String, Value]) -> Unit

Register a module's exports in the module registry

#
Interpreter::run

#
Interpreter::run_bounded

fn Interpreter::run_bounded(self : Interpreter, stmts : Array[
Stmt
], policy : ExecutionPolicy) -> Value raise

Run parsed source under one operation-scoped control carrier. The carrier is installed and restored by the imperative shell around the existing run path, so unbounded compatibility entry points remain unchanged.

#
Interpreter::run_compiled_script

fn Interpreter::run_compiled_script(self : Interpreter, stmts : Array[
Stmt
], eval : (ExecContext, Environment) -> Value raise) -> Value raise

Run an already-compiled script body through the same script setup envelope used by Interpreter::run.

Closure conversion lives outside the runtime package, but script execution setup owns private runtime state: the active interpreter ref, static early errors, declaration hoisting, and conversion of engine errors into JS exceptions. Keeping that envelope here lets compiled execution share the same boundary without exposing those internals.

#
Interpreter::run_executor_activation_coordinator

fn Interpreter::run_executor_activation_coordinator(self : Interpreter, root : &ExecutorActivationFrame) -> ExecutorActivationStep raise

#
Interpreter::run_microtasks

fn Interpreter::run_microtasks(self : Interpreter) -> Unit raise

Run all pending microtasks until the queue is empty. This is called after each task (script execution) completes. Implements the microtask checkpoint from WHATWG Event Loop spec.

#
Interpreter::run_microtasks_observed

fn Interpreter::run_microtasks_observed(self : Interpreter) -> Result[Unit, MicrotaskRunFailure] raise

Run all pending microtasks while retaining callback provenance on failure.

#
Interpreter::run_module

fn Interpreter::run_module(self : Interpreter, stmts : Array[
Stmt
]) -> Map[String, Value] raise

Run a module source and return its exports

#
Interpreter::run_modules

fn Interpreter::run_modules(self : Interpreter, modules : Array[(String, String)]) -> Map[String, Value] raise

Run multiple modules with all specifiers registered before evaluation. The graph pass evaluates provided dependencies before importers while still letting self-imports and simple cyclic fixtures resolve through the registry.

#
Interpreter::run_timers

fn Interpreter::run_timers(self : Interpreter) -> Unit raise

Run the event loop: process all pending timer tasks with microtask checkpoints between each (per WHATWG event loop spec). Timers are sorted by (delay, insertion_order) so they fire in the correct relative order. After each timer callback, microtasks are drained before the next timer fires.

For setInterval, the timer is re-enqueued after each invocation until cancelled. A safety limit prevents infinite loops.

#
Interpreter::run_timers_observed

fn Interpreter::run_timers_observed(self : Interpreter) -> Result[Unit, TimerRunFailure] raise

Run timers while retaining callback-vs-checkpoint context for direct package dependents. Queue-policy defects still raise as internal failures.

#
Interpreter::set_computed_property

fn Interpreter::set_computed_property(self : Interpreter, obj : Value, key : Value, value : Value, loc :
Loc
, strict? : Bool, receiver? : Value) -> Value raise

#
Interpreter::set_property

fn Interpreter::set_property(self : Interpreter, obj : Value, prop : String, value : Value, loc :
Loc
, strict? : Bool, receiver? : Value) -> Value raise

Stage B.1 [[Set]] dispatcher.

receiver threads through the prototype chain and proxy fallbacks per ES §10.1.9 (OrdinarySet) and §10.5.9 (ProxyExoticObject.[[Set]]).

  • Inherited setters are invoked with receiver as this.
  • Trap-less Proxy forwards to target.[[Set]](P, V, Receiver).
  • When no own/inherited blocker exists and receiver !== obj, the write lands on receiver via define_value_on_receiver (approximating CreateDataProperty(Receiver, P, V) — a direct [[DefineOwnProperty]] that bypasses [[Set]], preventing the recursion loop that a naive self-call would produce for nested trap-less proxies).

#
Interpreter::spread_iterable

fn Interpreter::spread_iterable(self : Interpreter, val : Value, loc :
Loc
) -> Array[Value] raise

Spread an iterable value into an array of values using the iterator protocol

#
Interpreter::to_index

fn Interpreter::to_index(self : Interpreter, val : Value) -> Int64 raise

Interpreter method: ToIndex with explicit interpreter context.

#
Interpreter::to_js_string

fn Interpreter::to_js_string(self : Interpreter, val : Value) -> String raise

Interpreter method: ToString with explicit interpreter context.

#
Interpreter::to_number

fn Interpreter::to_number(self : Interpreter, val : Value) -> Double raise

Interpreter method: ToNumber with explicit interpreter context.

#
Interpreter::to_object_literal_property_key

fn Interpreter::to_object_literal_property_key(self : Interpreter, key : Value) -> Value raise

#
Interpreter::to_primitive_default

fn Interpreter::to_primitive_default(self : Interpreter, obj_val : Value, data : ObjectData) -> Value raise

Interpreter method: ToPrimitive (default hint) with explicit interpreter context.

#
Interpreter::to_primitive_value

fn Interpreter::to_primitive_value(self : Interpreter, value : Value, hint : String) -> Value raise

Canonical ToPrimitive entry point for callers that hold an arbitrary ECMAScript value. Primitive inputs pass through; object families that need observable property access use the interpreter dispatchers.

#
Interpreter::typeof_compiled_name

fn Interpreter::typeof_compiled_name(self : Interpreter, ctx : ExecContext, env : Environment, name : String) -> Value raise

Resolve typeof name for compiled execution using the same identifier reference special case as the tree-walking interpreter: unresolved names produce "undefined", while TDZ bindings still raise.

#
Interpreter::update_compiled_name

fn Interpreter::update_compiled_name(self : Interpreter, ctx : ExecContext, env : Environment, name : String, op :
UpdateOp
, prefix : Bool, _loc :
Loc
) -> Value raise

Update an identifier for compiled execution while keeping strict-mode and immutable-global behavior owned by the runtime.

#
Interpreter::validate_block_early_errors

fn Interpreter::validate_block_early_errors(_self : Interpreter, stmts : Array[
Stmt
], strict_context : Bool) -> Unit raise

#
Interpreter::with_active_value

fn Interpreter::with_active_value(self : Interpreter, eval : () -> Value raise) -> Value raise

Run a public runtime entry point with this interpreter installed as the active realm for compatibility factory lookups.

#
Interpreter::with_execution_policy

fn[T] Interpreter::with_execution_policy(self : Interpreter, policy : ExecutionPolicy, action : () -> T raise) -> T raise

Run one internal operation under a fresh execution-control carrier. Stable root-facade operations use this shell to keep one policy active across multiple runtime phases without exposing the private control type.

#
InterruptionHandle

pub(all) struct InterruptionHandle {
// private fields
}

A monotonic, shared host interruption request.

#
InterruptionHandle::InterruptionHandle

fn InterruptionHandle::InterruptionHandle() -> InterruptionHandle

#
InterruptionHandle::is_requested

fn InterruptionHandle::is_requested(self : InterruptionHandle) -> Bool

#
InterruptionHandle::request

fn InterruptionHandle::request(self : InterruptionHandle) -> Unit

#
MapData

pub(all) struct MapData {
entries : Array[(Value, Value)]
entry_ids : Array[Int]
next_entry_id : Int
prototype : Value?
bag : PropertyBag
extensible : Bool
}

Map data structure - stores key-value pairs with insertion order preservation Uses SameValueZero for key comparison (NaN === NaN, +0 === -0)

#
MapData::MapData

fn MapData::MapData(entries : Array[(Value, Value)], prototype? : Value?) -> MapData

Construct MapData with entries and an empty property bag (no expando properties).

#
Microtask

pub(all) struct Microtask {
callback : Value
args : Array[Value]
}

Microtask record for the event loop microtask queue Stores a callback function and argument list to pass to it

#
MicrotaskRunFailure

pub struct MicrotaskRunFailure {
cause_ : Error
source_identity_ : String?
}

A microtask-run failure paired with trustworthy callback provenance.

#
MicrotaskRunFailure::cause

fn MicrotaskRunFailure::cause(self : MicrotaskRunFailure) -> Error

#
MicrotaskRunFailure::source_identity

fn MicrotaskRunFailure::source_identity(self : MicrotaskRunFailure) -> String?

#
ModuleLoader

pub(all) struct ModuleLoader((String) -> Map[String, Value] raise)

Host-provided callback that resolves a module specifier to its exports. Called by exec_import when a specifier is not already in module_registry. Return a Map[String, Value] of exported names → values, or raise an error.

#
ObjectData

pub(all) struct ObjectData {
bag : PropertyBag
prototype : Value
callable : Callable?
class_name : String
extensible : Bool
arraybuffer_state : ArrayBufferState?
}

#
PartialDescriptor

pub(all) struct PartialDescriptor {
value : Value?
writable : Bool?
enumerable : Bool?
configurable : Bool?
getter : Value?
setter : Value?
has_getter : Bool
has_setter : Bool
}

Partial property descriptor for VAP (§10.1.6.3 ValidateAndApplyPropertyDescriptor) inputs. Each field is independently absent (None) or present (Some(_)), distinct from the stored PropDescriptor where every attribute has a concrete value. has_getter / has_setter disambiguate "field absent" from "getter: undefined" since a user can write { get: undefined }.

#
PartialDescriptor::data_default

fn PartialDescriptor::data_default(v : Value) -> PartialDescriptor

Build a PartialDescriptor representing ES §7.3.5 CreateDataPropertyOrThrow — every data attribute explicit with defaults writable/enumerable/configurable = true. Used by the [[Set]] landing rule §10.1.9.2 step 3.f.

#
PartialDescriptor::empty

Build a PartialDescriptor representing the "no attributes specified" case.

#
PartialDescriptor::is_accessor

fn PartialDescriptor::is_accessor(self : PartialDescriptor) -> Bool

ES §6.2.5.4 IsAccessorDescriptor: true iff either getter or setter is explicitly present on the partial.

#
PartialDescriptor::is_data

fn PartialDescriptor::is_data(self : PartialDescriptor) -> Bool

ES §6.2.5.4 IsDataDescriptor: true iff either value or writable is explicitly present on the partial.

#
PartialDescriptor::is_generic

fn PartialDescriptor::is_generic(self : PartialDescriptor) -> Bool

ES §6.2.5.4 IsGenericDescriptor: neither data nor accessor — only enumerable/configurable populated, or nothing at all.

#
PartialDescriptor::value_only

Build a PartialDescriptor with only value set. Used by the [[Set]] landing rule §10.1.9.2 step 3.e (existing writable-data descriptor: call [[DefineOwnProperty]] with just { [[Value]]: V }).

#
PreparedExecutorActivation

pub struct PreparedExecutorActivation {
ctx : ExecContext
env : Environment
args : Array[Value]
}

#
PreparedExecutorActivation::arguments

#
PreparedExecutorActivation::context

#
PreparedExecutorActivation::environment

#
PromiseData

pub(all) struct PromiseData {
state : PromiseState
result : Value
fulfill_reactions : Array[PromiseReaction]
reject_reactions : Array[PromiseReaction]
is_handled : Bool
bag : PropertyBag
extensible : Bool
prototype : Value?
}

Promise data structure per ECMAScript spec Promises have a state, result value, and queues of pending reactions

#
PromiseReaction

pub(all) struct PromiseReaction {
handler : Value?
resolve : Value
reject : Value
reaction_type : PromiseReactionType
}

Promise reaction record - stores callbacks for promise resolution Each reaction contains the handler (onFulfilled or onRejected) and the dependent promise's resolve/reject capabilities

#
PromiseReactionType

pub(all) enum PromiseReactionType {
Fulfill
Reject
}

#
PromiseState

pub(all) enum PromiseState {
Pending
Fulfilled
Rejected
}

Promise state per ECMAScript spec

#
PropDescriptor

pub(all) struct PropDescriptor {
writable : Bool
enumerable : Bool
configurable : Bool
getter : Value?
setter : Value?
is_accessor : Bool
}

#
PropertyBag

pub(all) struct PropertyBag {
properties : Map[String, Value]
symbol_properties : Map[Int, Value]
descriptors : Map[String, PropDescriptor]
symbol_descriptors : Map[Int, PropDescriptor]
internal_slots : Map[InternalSlotKey, Value]
host_slots : Map[Int, Value]
}

Unified named/symbol property + descriptor storage embedded in every exotic Value variant. Consolidates what used to be four parallel fields so descriptor invariants are enforced in one place.

#
PropertyBag::PropertyBag

fn PropertyBag::PropertyBag() -> PropertyBag

Construct an empty PropertyBag.

#
PropertyBag::delete_host_slot

fn PropertyBag::delete_host_slot(self : PropertyBag, key : HostSlotKey) -> Unit

#
PropertyBag::get_host_slot

fn PropertyBag::get_host_slot(self : PropertyBag, key : HostSlotKey) -> Value?

#
PropertyBag::has_host_slot

fn PropertyBag::has_host_slot(self : PropertyBag, key : HostSlotKey) -> Bool

#
PropertyBag::set_host_slot

fn PropertyBag::set_host_slot(self : PropertyBag, key : HostSlotKey, value : Value) -> Unit

#
ProxyData

pub(all) struct ProxyData {
target : Value?
handler : Value?
is_callable : Bool
is_constructor : Bool
}

Proxy data structure - wraps a target and handler for meta-programming

#
RealmState

pub(all) struct RealmState {
symbols : SymbolState
well_known_symbols : WellKnownSymbols
runtime_iterator_prototypes : RuntimeIteratorPrototypeCaches
active_overrides :
Ref
[FunctionRealmProtos?]
active_source_identity :
Ref
[String?]
constructor_prototype_registry : Value
observing_source_failure :
Ref
[Bool]
observed_source_failure :
Ref
[Error?]
observed_source_identity :
Ref
[String?]
object_prototype :
Ref
[Value?]
function_prototype :
Ref
[Value?]
string_prototype :
Ref
[Value?]
number_prototype :
Ref
[Value?]
boolean_prototype :
Ref
[Value?]
symbol_prototype :
Ref
[Value?]
array_prototype :
Ref
[Value?]
map_prototype :
Ref
[Value?]
set_prototype :
Ref
[Value?]
regexp_prototype :
Ref
[Value?]
promise_prototype :
Ref
[Value?]
weakmap_prototype :
Ref
[Value?]
weakset_prototype :
Ref
[Value?]
arraybuffer_state : ArrayBufferState
arraybuffer_id_counter :
Ref
[Int]
arraybuffer_store : Map[Int, Array[Int]]
detached_buffers : Map[Int, Bool]
weakmap_id_counter :
Ref
[Int]
weakmap_storage : Map[Int, Array[(Value, Value)]]
weakmap_id_table : Array[(ObjectData, Int)]
weakset_id_counter :
Ref
[Int]
weakset_storage : Map[Int, Array[Value]]
weakset_id_table : Array[(ObjectData, Int)]
// private fields
}

Per-realm engine state owned by an Interpreter.

Realm-scoped mutable engine state belongs here or in an explicit nested owner record, not in module-level caches. This includes intrinsic/prototype caches, symbol registries, backing stores, and side tables whose lifetime is the lifetime of a realm.

#
RealmState::RealmState

#alias(new)
fn RealmState::RealmState() -> RealmState

#
RealmState::from_symbols

fn RealmState::from_symbols(symbols : SymbolState) -> RealmState

#
RealmState::get_array_iterator_proto

fn RealmState::get_array_iterator_proto(self : RealmState) -> Value

Get or create the realm-owned %ArrayIteratorPrototype%.

#
RealmState::get_array_proto

fn RealmState::get_array_proto(self : RealmState) -> Value

#
RealmState::get_array_proto_values_intrinsic

fn RealmState::get_array_proto_values_intrinsic(self : RealmState) -> Value?

#
RealmState::get_async_from_sync_iterator_proto

fn RealmState::get_async_from_sync_iterator_proto(self : RealmState) -> Value

#
RealmState::get_async_iterator_proto

fn RealmState::get_async_iterator_proto(self : RealmState) -> Value

#
RealmState::get_boolean_proto

fn RealmState::get_boolean_proto(self : RealmState) -> Value

#
RealmState::get_func_proto

fn RealmState::get_func_proto(self : RealmState) -> Value

#
RealmState::get_iterator_proto

fn RealmState::get_iterator_proto(self : RealmState) -> Value

Get or create the realm-owned %IteratorPrototype%.

#
RealmState::get_map_proto

fn RealmState::get_map_proto(self : RealmState) -> Value

#
RealmState::get_number_proto

fn RealmState::get_number_proto(self : RealmState) -> Value

#
RealmState::get_obj_proto

fn RealmState::get_obj_proto(self : RealmState) -> Value

#
RealmState::get_promise_proto

fn RealmState::get_promise_proto(self : RealmState) -> Value

#
RealmState::get_set_proto

fn RealmState::get_set_proto(self : RealmState) -> Value

#
RealmState::get_string_iterator_proto

fn RealmState::get_string_iterator_proto(self : RealmState) -> Value

Get or create the realm-owned %StringIteratorPrototype%.

#
RealmState::get_string_proto

fn RealmState::get_string_proto(self : RealmState) -> Value

#
RealmState::get_symbol_proto

fn RealmState::get_symbol_proto(self : RealmState) -> Value

#
RealmState::get_weakmap_proto

fn RealmState::get_weakmap_proto(self : RealmState) -> Value

#
RealmState::get_weakset_proto

fn RealmState::get_weakset_proto(self : RealmState) -> Value

#
RealmState::make_array_entries_iterator_value

fn RealmState::make_array_entries_iterator_value(self : RealmState, val : Value) -> Value raise

#
RealmState::make_array_iterator_value

fn RealmState::make_array_iterator_value(self : RealmState, arr : ArrayData) -> Value

#
RealmState::make_array_keys_iterator_value

fn RealmState::make_array_keys_iterator_value(self : RealmState, val : Value) -> Value raise

#
RealmState::make_array_like_iterator_value

fn RealmState::make_array_like_iterator_value(self : RealmState, val : Value) -> Value raise

Create an array-like values iterator for objects with a length property.

#
RealmState::make_array_values_iterator_value

fn RealmState::make_array_values_iterator_value(self : RealmState, val : Value) -> Value raise

#
RealmState::make_string_iterator_value

fn RealmState::make_string_iterator_value(self : RealmState, s : String) -> Value

#
RealmState::register_constructor_prototype

fn RealmState::register_constructor_prototype(self : RealmState, name : String, constructor_value : Value) -> Unit

Record a builtin constructor's intrinsic prototype in this realm's private table. The table is shared by functions created before and after setup.

#
RealmState::set_array_proto_values_intrinsic

fn RealmState::set_array_proto_values_intrinsic(self : RealmState, values_fn : Value) -> Unit

#
ResumeAction

pub(all) enum ResumeAction {
NextAction
ThrowAction(Value)
ReturnAction(Value)
}

Resume action for eval_yield to inspect when replaying

#
ResumeKind

pub(all) enum ResumeKind {
Next(Value)
Throw(Value)
Return(Value)
}

How the generator was resumed

#
RuntimeIteratorPrototypeCaches

pub(all) struct RuntimeIteratorPrototypeCaches {
iterator_proto :
Ref
[Value?]
array_iterator_proto :
Ref
[Value?]
string_iterator_proto :
Ref
[Value?]
map_iterator_proto :
Ref
[Value?]
set_iterator_proto :
Ref
[Value?]
regexp_string_iterator_proto :
Ref
[Value?]
async_iterator_proto :
Ref
[Value?]
async_from_sync_iterator_proto :
Ref
[Value?]
}

Lazy iterator prototype caches owned by a RealmState.

#
SetData

pub(all) struct SetData {
values : Array[Value]
tombstones :
Set
[Int]?
iteration_depth : Int
prototype : Value?
bag : PropertyBag
extensible : Bool
}

Set data structure - stores unique values with insertion order preservation Uses SameValueZero for value comparison (NaN === NaN, +0 === -0)

#
SetData::SetData

fn SetData::SetData(values : Array[Value], prototype? : Value?) -> SetData

Construct SetData with values and an empty property bag (no expando properties).

#
SetData::effective_size

fn SetData::effective_size(self : SetData) -> Int

Live element count — values.length() minus tombstoned slots.

#
Signal

pub(all) enum Signal {
Normal(Value)
ReturnSignal(Value)
BreakSignal(Value?, String?)
ContinueSignal(Value?, String?)
}

#
SourceObservedFailure

pub struct SourceObservedFailure {
cause_ : Error
source_identity_ : String?
}

A runtime failure paired with the deepest source identity that propagated unchanged to the observation boundary.

#
SourceObservedFailure::cause

fn SourceObservedFailure::cause(self : SourceObservedFailure) -> Error

#
SourceObservedFailure::source_identity

fn SourceObservedFailure::source_identity(self : SourceObservedFailure) -> String?

#
StdlibHooks

pub(all) struct StdlibHooks {
get_string_method : (String, String, RealmState, Bool) -> Value
get_number_method : (Value, String, RealmState) -> Value
get_array_method_with_interp : (ArrayData, String, RealmState) -> Value
get_map_method : (MapData, String, RealmState) -> Value
get_set_method : (SetData, String, RealmState) -> Value
get_promise_method : (PromiseData, String, RealmState) -> Value
make_regexp_object : (RealmState, String, String) -> Value raise
typedarray_get_index : (ObjectData, Int, RealmState) -> Value
typedarray_set_index : (ObjectData, Int, Double, RealmState) -> Unit
typedarray_is_valid_index : (ObjectData, Int, RealmState) -> Bool
create_realm : () -> Interpreter
}

Function pointer table for calling from runtime into stdlib. This breaks the circular dependency: runtime defines the interface, stdlib provides the implementation, root interpreter wires them together.

#
SymbolData

pub(all) struct SymbolData {
id : Int
description : String?
}

Symbol data structure - each symbol has a unique ID and optional description

#
SymbolState

pub(all) struct SymbolState {
symbol_id_counter :
Ref
[Int]
all_symbols : Map[Int, SymbolData]
global_symbol_registry : Map[String, SymbolData]
symbol_registry_reverse : Map[Int, String]
well_known_symbols_cache :
Ref
[WellKnownSymbols?]
}

Per-interpreter symbol state: ID counter, all-symbols table, and the Symbol.for() / Symbol.keyFor() registry. Passed through setup functions so that closures can capture it without needing an Interpreter reference.

#
SymbolState::get_symbol_by_id

fn SymbolState::get_symbol_by_id(self : SymbolState, id : Int) -> SymbolData?

Get a symbol by its ID from this SymbolState.

#
SymbolState::new

#
SymbolState::new_symbol

fn SymbolState::new_symbol(self : SymbolState, description : String?) -> SymbolData

Create a new symbol with a unique ID, registering it in this SymbolState.

#
SymbolState::well_known_symbols

fn SymbolState::well_known_symbols(self : SymbolState) -> WellKnownSymbols

#
TimerRunFailure

pub struct TimerRunFailure {
cause_ : Error
phase_ : TimerRunFailurePhase
source_identity_ : String?
}

A timer-run failure paired atomically with the phase that observed it.

#
TimerRunFailure::cause

fn TimerRunFailure::cause(self : TimerRunFailure) -> Error

#
TimerRunFailure::phase

#
TimerRunFailure::source_identity

fn TimerRunFailure::source_identity(self : TimerRunFailure) -> String?

#
TimerRunFailurePhase

pub enum TimerRunFailurePhase {
TimerQueueDispatch
TimerCallback
IntervalCallback
MicrotaskCheckpoint
}

Failure phase retained for the stable root facade's diagnostic adapter.

#
TimerTask

pub(all) struct TimerTask {
id : Int
callback : Value
args : Array[Value]
delay : Int
period : Int
is_interval : Bool
insertion_order : Int
}

Timer task for setTimeout/setInterval (task queue per WHATWG spec) Timers are processed one at a time with microtask checkpoints between each
impl Eq for TimerTask

#
Value

pub(all) enum Value {
Number(Double)
String_(String)
Bool(Bool)
Null
Undefined
Object(ObjectData)
Array(ArrayData)
Symbol(SymbolData)
Map(MapData)
Set(SetData)
Promise(PromiseData)
Proxy(ProxyData)
}

impl Show for Value

#
WellKnownSymbols

pub(all) struct WellKnownSymbols {
iterator : SymbolData
async_iterator : SymbolData
has_instance : SymbolData
is_concat_spreadable : SymbolData
to_primitive : SymbolData
to_string_tag : SymbolData
match_sym : SymbolData
match_all : SymbolData
replace : SymbolData
search : SymbolData
species : SymbolData
split : SymbolData
unscopables : SymbolData
}

Realm-owned well-known symbol identities.

These values are allocated from the realm's SymbolState before user code can create symbols, preserving the existing well-known symbol IDs while moving ownership out of per-symbol module globals.

#
apply_active_realm_protos

fn apply_active_realm_protos(realm_state : RealmState, protos : FunctionRealmProtos) -> Unit

#
apply_array_literal_element

fn apply_array_literal_element(target : Value, value : Value) -> Unit raise

Append one evaluated element to an array literal accumulator.

#
apply_array_literal_hole

fn apply_array_literal_hole(target : Value) -> Unit raise

Append a single elision (hole) to an array literal accumulator: the index is recorded as a hole and the slot is filled with undefined so that length advances while in/iteration treat the index as absent.

#
apply_array_literal_spread

fn apply_array_literal_spread(target : Value, values : Array[Value]) -> Unit raise

Append already-spread iterable values to an array literal accumulator. The caller is responsible for running the iterator protocol (interpreter semantics); this operation only lands the resulting values into storage.

#
apply_object_literal_accessor_property

fn apply_object_literal_accessor_property(target : Value, key : Value, accessor : Value, is_getter : Bool) -> Unit raise

#
apply_object_literal_data_property

fn apply_object_literal_data_property(target : Value, key : Value, value : Value) -> Unit raise

#
apply_object_literal_proto_property

fn apply_object_literal_proto_property(target : Value, value : Value) -> Unit raise

#
apply_object_literal_static_data_property

fn apply_object_literal_static_data_property(target : Value, key : String, value : Value) -> Unit raise

Set a static (compile-time string keyed) data property on an object literal accumulator. Unlike apply_object_literal_data_property, this performs no function-name inference: the bytecode lowering emits a separate SetFunctionName instruction for static keys, so naming is already handled upstream and must not be re-applied here.

#
array_species_create

fn array_species_create(interp : Interpreter, original : Value, len : Int64) -> Value raise

ArraySpeciesCreate(originalArray, length) per ES spec 9.4.2.3 Looks up Symbol.species on the original array's constructor to determine what constructor to use for the result. Returns a plain Array if no custom species is found.

#
builtin_method_desc

fn builtin_method_desc() -> PropDescriptor

Standard descriptor metadata for built-in prototype methods installed as ordinary data properties.

#
call_callable_direct

fn call_callable_direct(callable_val : Value, this_val : Value, args : Array[Value], interp? : Interpreter?) -> Value raise

Call a callable value, dispatching to the interpreter for UserFunc types. Supports all callable types including user-defined functions. Pass interp explicitly when user-code dispatch may be required.

#
check_proxy_set_trap_invariants

fn check_proxy_set_trap_invariants(target : Value, key : Value, value : Value) -> Unit raise

#
cleanup_holes_above_length

fn cleanup_holes_above_length(holes : Map[Int, Unit], new_len : Int64) -> Unit

Drop hole entries at indices >= new_len after a length shrink. Used by both Interpreter::set_property and Interpreter::set_computed_property length-set paths to avoid the near-identical 12-line block being kept in sync by hand.

Hole keys are Int (≤ 2^31-1); if new_len exceeds Int range, no in-range hole can be out-of-range, so the cleanup is a no-op — we skip it to avoid an overflowing Int64→Int cast.

#
clear_array_length_override

fn clear_array_length_override(arr : ArrayData) -> Unit

#
collect_for_in_keys

fn collect_for_in_keys(obj : Value, interp : Interpreter) -> Array[String] raise

#
compound_assign_binary_op

#
constructor_realm_intrinsic_prototype

fn constructor_realm_intrinsic_prototype(new_target : Value, intrinsic_name : String, default_prototype : Value) -> Value raise

Resolve the intrinsic prototype selected by GetPrototypeFromConstructor's primitive-prototype fallback. Proxy and bound-function traversal mirrors GetFunctionRealm; revoked proxies therefore raise before any fallback.

#
create_data_property_or_throw

fn create_data_property_or_throw(interp : Interpreter, target : Value, index : Int64, value : Value) -> Unit raise

CreateDataPropertyOrThrow(O, P, V) per ES spec 7.3.5. Sets an indexed property on a species result value and throws if [[DefineOwnProperty]] rejects the creation.

#
create_iter_result

fn create_iter_result(value : Value, done : Bool) -> Value

Create an iterator result object { value, done }

#
create_resolving_functions

fn create_resolving_functions(interp : Interpreter, promise_data : PromiseData) -> (Value, Value)

Create resolve and reject capability functions for a promise. Returns (resolve_func, reject_func).

#
default_stdlib_hooks

fn default_stdlib_hooks() -> StdlibHooks

Default no-op hooks used before stdlib is wired in.

#
delete_array_like_element

fn delete_array_like_element(val : Value, index : Int) -> Unit

Delete indexed element from array-like value

#
delete_host_slot

fn delete_host_slot(data : ObjectData, key : HostSlotKey) -> Unit

#
descriptor_to_value

fn descriptor_to_value(desc : PropDescriptor, value : Value, realm_state? : RealmState?) -> Value

Convert a stored PropDescriptor into a plain JS descriptor object for Object.getOwnPropertyDescriptor / Reflect.getOwnPropertyDescriptor callers. Emits value + writable for data descriptors; get + set for accessor descriptors.

#
detach_keyed_collection_iterator_target

fn detach_keyed_collection_iterator_target(data : ObjectData, sym_id : Int) -> Unit

#
enqueue_promise_reaction_job

fn enqueue_promise_reaction_job(interp : Interpreter, reaction : PromiseReaction, argument : Value) -> Unit

Enqueue a promise reaction job (microtask). This implements NewPromiseReactionJob from ECMAScript spec.

#
eval_binary_op

fn eval_binary_op(op :
BinOp
, left : Value, right : Value, _loc :
Loc
, interp? : Interpreter?) -> Value raise

#
eval_delete_computed_property

fn eval_delete_computed_property(interp : Interpreter, obj : Value, key : Value, strict : Bool) -> Value raise

#
eval_delete_identifier

fn eval_delete_identifier(interp : Interpreter, ctx : ExecContext, env : Environment, name : String) -> Value raise

#
eval_delete_property

fn eval_delete_property(interp : Interpreter, obj : Value, prop : String, strict : Bool) -> Value raise

#
eval_new_target_value

fn eval_new_target_value(env : Environment) -> Value

Resolve new.target from the current function environment. Scripts and ordinary calls without a constructor binding match the tree-walker fallback to undefined.

#
eval_this_value

fn eval_this_value(env : Environment) -> Value raise

Resolve this with the same TDZ-to-derived-constructor error mapping used by expression evaluation. Compiled execution uses this helper instead of treating this as an ordinary identifier.

#
eval_unary_value_op

fn eval_unary_value_op(op :
UnaryOp
, value : Value, loc :
Loc
, interp? : Interpreter?) -> Value raise

#
execution_control_failure_code

fn execution_control_failure_code(error : Error) -> String?

Translate private guardrail failures at the stable Engine boundary without exposing the runtime error constructors through the root facade.

#
executor_activation_call

fn executor_activation_call(callee : Value, this_value : Value, args : Array[Value], loc :
Loc
) -> ExecutorActivationStep

#
executor_activation_completion_abrupt

fn executor_activation_completion_abrupt(error : Error) -> ExecutorActivationCompletion

#
executor_activation_completion_normal

fn executor_activation_completion_normal(value : Value) -> ExecutorActivationCompletion

#
executor_activation_construct

fn executor_activation_construct(ctor : Value, args : Array[Value], loc :
Loc
) -> ExecutorActivationStep

#
executor_activation_continue

fn executor_activation_continue() -> ExecutorActivationStep

#
executor_activation_normal

fn executor_activation_normal(value : Value) -> ExecutorActivationStep

#
executor_activation_property_get

fn executor_activation_property_get(target : Value, property_name : String, loc :
Loc
) -> ExecutorActivationStep

#
executor_activation_return

fn executor_activation_return(value : Value) -> ExecutorActivationStep

#
flatten_array_val

fn flatten_array_val(elements : Array[Value], depth : Int, result : Array[Value]) -> Unit

#
fulfill_promise

fn fulfill_promise(interp : Interpreter, promise_data : PromiseData, value : Value) -> Unit

Fulfill a promise with the given value. Triggers all fulfill reactions as microtasks.

#
function_source_identity

fn function_source_identity(value : Value) -> String?

#
get_array_iterator_override

fn get_array_iterator_override(arr : ArrayData, well_known_symbols~ : WellKnownSymbols) -> (Value?, Value?)

#
get_array_length_override

fn get_array_length_override(arr : ArrayData) -> Int64?

#
get_array_like_element

fn get_array_like_element(val : Value, index : Int64) -> Value

Get indexed element from array-like value

#
get_array_like_element_interp

fn get_array_like_element_interp(interp : Interpreter, val : Value, index : Int64) -> Value raise

Get indexed element from array-like value using interpreter (handles user-defined getters)

#
get_array_named_prop

fn get_array_named_prop(arr : ArrayData, key : String) -> Value?

#
get_array_proto

fn get_array_proto(realm_state? : RealmState?) -> Value

#
get_array_prototype

fn get_array_prototype(realm_state : RealmState, arr : ArrayData) -> Value

#
get_array_prototype_override

fn get_array_prototype_override(arr : ArrayData) -> Value?

#
get_array_symbol_prop

fn get_array_symbol_prop(arr : ArrayData, sym_id : Int) -> Value?

#
get_arraybuffer_byte_length

fn get_arraybuffer_byte_length(data : ObjectData) -> Value?

#
get_arraybuffer_id

fn get_arraybuffer_id(data : ObjectData) -> Value?

#
get_assignment_name_value

fn get_assignment_name_value(ctx : ExecContext, env : Environment, name : String) -> Value raise

#
get_boolean_data

fn get_boolean_data(data : ObjectData) -> Value?

#
get_boolean_proto

fn get_boolean_proto(realm_state? : RealmState?) -> Value

#
get_bound_func_name

fn get_bound_func_name(target : Value) -> String

#
get_func_length

fn get_func_length(callable : Callable) -> Int

#
get_func_proto

fn get_func_proto(realm_state? : RealmState?) -> Value

#
get_function_length

fn get_function_length(target : Value) -> Int

Return the observable function length used by Function.prototype.bind. Prefer an own numeric length property, falling back to callable metadata for older function objects that synthesize length from their Callable tag.

#
get_host_slot

fn get_host_slot(data : ObjectData, key : HostSlotKey) -> Value?

#
get_keyed_collection_iterator_kind

fn get_keyed_collection_iterator_kind(data : ObjectData, sym_id : Int) -> Value?

#
get_keyed_collection_iterator_next_index

fn get_keyed_collection_iterator_next_index(data : ObjectData, sym_id : Int) -> Value?

#
get_keyed_collection_iterator_target

fn get_keyed_collection_iterator_target(data : ObjectData, sym_id : Int) -> Value?

#
get_map_proto

fn get_map_proto(realm_state? : RealmState?) -> Value

#
get_number_proto

fn get_number_proto(realm_state? : RealmState?) -> Value

#
get_obj_proto

fn get_obj_proto(realm_state? : RealmState?) -> Value

#
get_private_field

fn get_private_field(obj : Value, brand : Value, name : String) -> Value raise

Read a private field value from an object. Returns the field value on success, raises TypeError if brand check fails.

#
get_promise_proto

fn get_promise_proto(realm_state? : RealmState?) -> Value

#
get_proxy_handler

fn get_proxy_handler(proxy_data : ProxyData) -> Value raise

Get the handler of a proxy, throwing TypeError if revoked.

#
get_proxy_target

fn get_proxy_target(proxy_data : ProxyData) -> Value raise

Get the target of a proxy, throwing TypeError if revoked.

#
get_proxy_trap

fn get_proxy_trap(proxy_data : ProxyData, trap_name : String, interp : Interpreter) -> Value? raise

Get a trap function from the proxy handler, or None if the trap is not defined. Throws TypeError if the proxy has been revoked. Uses the engine's ordinary Get path (interp.get_property) so accessor traps and proxy-handler proxies are resolved with full language semantics.

#
get_set_proto

fn get_set_proto(realm_state? : RealmState?) -> Value

#
get_source_text

fn get_source_text(data : ObjectData) -> Value?

#
get_string_proto

fn get_string_proto(realm_state? : RealmState?) -> Value

#
get_symbol_data

fn get_symbol_data(data : ObjectData) -> Value?

#
get_symbol_proto

fn get_symbol_proto(realm_state? : RealmState?) -> Value

#
get_sync_iterator

fn get_sync_iterator(data : ObjectData) -> Value?

#
get_sync_next_method

fn get_sync_next_method(data : ObjectData) -> Value?

#
get_tostringtag_value

fn get_tostringtag_value(data : ObjectData, well_known_symbols : WellKnownSymbols) -> String? raise

Get the Symbol.toStringTag value by walking the prototype chain. Checks symbol properties and evaluates getter descriptors if present. Per spec, errors thrown by @@toStringTag getters propagate to the caller.

#
get_typedarray_array_length

fn get_typedarray_array_length(data : ObjectData) -> Value?

#
get_typedarray_buffer_id

fn get_typedarray_buffer_id(data : ObjectData) -> Value?

#
get_typedarray_byte_length

fn get_typedarray_byte_length(data : ObjectData) -> Value?

#
get_typedarray_byte_offset

fn get_typedarray_byte_offset(data : ObjectData) -> Value?

#
get_typedarray_viewed_buffer

fn get_typedarray_viewed_buffer(data : ObjectData) -> Value?

#
has_array_like_element

fn has_array_like_element(interp : Interpreter, val : Value, index : Int64) -> Bool

Check if array-like value has indexed property. interp is required so the Array branch can resolve %Array.prototype% via get_array_prototype(interp.realm_state,data).

#
has_brand

fn has_brand(obj : Value, brand : Value) -> Bool

Check if an object has been branded with the given private brand. Returns false for non-object values (no TypeError).

#
has_host_slot

fn has_host_slot(data : ObjectData, key : HostSlotKey) -> Bool

#
has_parameter_expressions

fn has_parameter_expressions(params : Array[
Param
]) -> Bool

§10.2.11 ContainsExpression / HasParameterExpressions for Ext function parameter lists. True iff any param carries a default initializer or a pattern that itself contains an expression (nested default, computed key, or assignment target). A plain destructuring pattern like {a} or [a, b] with no nested initializers has NO expression per spec and must not trigger the split; otherwise function f({a}) { var a; return a } would hoist var a into body_env and shadow the destructured parameter. Plain rest without a pattern is also not a parameter expression.

#
has_property

fn has_property(val : Value, name : String, interp? : Interpreter?) -> Bool

Look up a string-keyed property on an object, walking the prototype chain. HasProperty: check if a named property exists on the object or its prototype chain

#
install_builtin_accessor

fn install_builtin_accessor(data : ObjectData, name : String, getter : Value?, setter : Value?) -> Unit

Install a built-in string-keyed accessor property. At least one of getter / setter must be Some; (None, None) aborts. Use None for an absent side (not Some(Undefined)), unless intentionally mimicking a JS { get: undefined } / { set: undefined } descriptor.

#
install_builtin_frozen_data

fn install_builtin_frozen_data(data : ObjectData, name : String, value : Value) -> Unit

Install a built-in string-keyed non-writable non-configurable data property.

#
install_builtin_method

fn install_builtin_method(data : ObjectData, name : String, func : Value) -> Unit

Install a built-in string-keyed method and its standard method descriptor.

#
install_builtin_non_writable

fn install_builtin_non_writable(data : ObjectData, name : String, value : Value) -> Unit

Install a built-in string-keyed non-writable configurable data property.

#
install_builtin_symbol_accessor

fn install_builtin_symbol_accessor(data : ObjectData, sym_id : Int, getter : Value) -> Unit

Install a built-in symbol-keyed accessor property with no setter.

#
install_builtin_symbol_frozen_data

fn install_builtin_symbol_frozen_data(data : ObjectData, sym_id : Int, value : Value) -> Unit

Install a built-in symbol-keyed non-writable non-configurable data property.

#
install_builtin_symbol_method

fn install_builtin_symbol_method(data : ObjectData, sym_id : Int, func : Value) -> Unit

Install a built-in symbol-keyed method and its standard method descriptor.

#
install_builtin_symbol_string

fn install_builtin_symbol_string(data : ObjectData, sym_id : Int, tag : String) -> Unit

Install a built-in symbol-keyed non-writable configurable string data property.

#
install_realm_pinned_builtin_constructor

fn install_realm_pinned_builtin_constructor(env : Environment, realm_proto_cache :
Ref
[Value?], ctor_name : String, ctor : Value, proto : Value, prototype_install? : BuiltinCtorPrototypeInstall, wire_proto_constructor? : Bool) -> Unit

Cache-for-X install contract (#504 / #512): atomically pin proto in the realm dispatch cache (realm_proto_cache), prepare the constructor's .prototype property per prototype_install, and register ctor in env.

Invariant: realm_proto_cache.val must equal the constructor object's .prototype property in every realm. Splitting these updates causes silent dual-source dispatch bugs (PR #138).

Set wire_proto_constructor when the family also needs proto.constructor = ctor (Map/Set, Array, boxed primitives, Promise, …).

Migrated families: Map/Set, WeakMap/WeakSet, Array, Promise, boxed primitives (String/Number/Boolean/Symbol). #512 rollout complete.

#
instanceof_prototype_chain

fn instanceof_prototype_chain(l : Value, target_proto : Value, interp : Interpreter) -> Value raise

Helper for instanceof: walk prototype chain to check if l's prototype chain includes target_proto

#
is_array

fn is_array(val : Value) -> Bool raise

§7.2.2 IsArray — returns true for Array exotic objects and Object values whose class_name is "Array", recursively unwrapping Proxy chains. Throws TypeError when a revoked Proxy is encountered (spec step 3.a).

#
is_callable

fn is_callable(val : Value) -> Bool

Check if a value is callable

#
is_constructor_value

fn is_constructor_value(v : Value) -> Bool

Check if a Value is a constructor (has [[Construct]] internal method)

#
is_engine_stack_depth_error

fn is_engine_stack_depth_error(value : Value) -> Bool

#
is_es_whitespace_cp

fn is_es_whitespace_cp(cp : Int) -> Bool

#
is_function_value

fn is_function_value(v : Value) -> Bool

Check if a Value is a function (has a callable)

#
is_js_catchable_error

fn is_js_catchable_error(err : Error) -> Bool

Check if an error is a JavaScript catchable error

#
is_object_value

fn is_object_value(v : Value) -> Bool

Check if a Value is an object per ES Type(v) is Object (§6.1.7). Returns true for any Value variant that represents a JavaScript object reference; false for language primitives (Number, String_, Bool, Null, Undefined, Symbol, BigInt).

#
is_thenable_object_candidate

fn is_thenable_object_candidate(value : Value) -> Bool

ES object-like values that participate in thenable assimilation.

#
is_truthy

fn is_truthy(val : Value) -> Bool

#
is_typedarray_class

fn is_typedarray_class(name : String) -> Bool

Check if a class name corresponds to a TypedArray type.

#
js_error_to_throw_value

fn js_error_to_throw_value(err : Error) -> Value

Convert a catchable error to the JS throw value used by this interpreter. Runtime engine errors are surfaced as strings like "TypeError: ...".

#
js_error_to_value

fn js_error_to_value(err : Error) -> Value

Convert any catchable error to a JavaScript Error object Value

#
js_error_to_value_with_env

fn js_error_to_value_with_env(err : Error, env : Environment?) -> Value

Convert any catchable error to a JavaScript Error object Value with proper prototype

#
json_to_realm_value

fn json_to_realm_value(realm_state : RealmState, json : Json) -> Value raise JsonBridgeError

Copy MoonBit JSON into a realm without consulting the realm's global JSON object or invoking JavaScript code.

#
load_direct_eval_callee

fn load_direct_eval_callee(env : Environment) -> Value raise

#
lookup_symbol_property_chain

fn lookup_symbol_property_chain(obj_val : Value, data : ObjectData, sym_id : Int, interp? : Interpreter?) -> Value? raise

Look up a symbol-keyed property on an object, walking the prototype chain. Also handles getter descriptors - invokes them and returns the result.

#
make_array

fn make_array(elements : Array[Value]) -> Value

Wrap an Array[Value] in an Array Value with an empty property bag. Dense-only arrays (no named props, no sparse length overrides) build via this.

#
make_array_with_holes

fn make_array_with_holes(elements : Array[Value], hole_indices : Array[Int]) -> Value

Wrap an Array[Value] and mark selected indices as array holes.

#
make_array_with_prototype

fn make_array_with_prototype(elements : Array[Value], prototype : Value) -> Value

Wrap an Array[Value] with an explicit instance prototype. Constructor adapters use this after resolving newTarget.prototype and before exposing the newly allocated Array value.

#
make_bound_func

fn make_bound_func(target : Value, bound_this : Value, bound_args : Array[Value], prototype~ : Value, name~ : String, length~ : Double, realm_state? : RealmState?) -> Value

Create the shared object representation for an ECMAScript bound function.

prototype is the exact result of the target's [[GetPrototypeOf]] operation (§10.4.1.3 BoundFunctionCreate), so Null must not be replaced with the realm's Function.prototype.

#
make_canonical_proxy_constructor

fn make_canonical_proxy_constructor(realm_state : RealmState) -> Value

#
make_classified_executor_arrow_function

fn[T : ExecutorCode] make_classified_executor_arrow_function(params : Array[String], closure : Environment, strict : Bool, code : T, source_body : Array[
Stmt
], rest_param? : String?) -> Value

ExecutorCode providers are trusted to supply code corresponding to source_body; runtime admission cannot prove otherwise.

#
make_classified_executor_function

fn[T : ExecutorCode] make_classified_executor_function(name : String?, params : Array[String], closure : Environment, strict : Bool, code : T, source_body : Array[
Stmt
], rest_param? : String?, constructable? : Bool, call_self_name? : Bool, define_arguments_object? : Bool) -> Value

ExecutorCode providers are trusted to supply code corresponding to source_body; runtime admission cannot prove otherwise.

#
make_executor_arrow_function

fn[T : ExecutorCode] make_executor_arrow_function(params : Array[String], closure : Environment, strict : Bool, code : T, rest_param? : String?) -> Value

#
make_executor_function

fn[T : ExecutorCode] make_executor_function(name : String?, params : Array[String], closure : Environment, strict : Bool, code : T, rest_param? : String?, constructable? : Bool, call_self_name? : Bool, define_arguments_object? : Bool) -> Value

#
make_func

fn make_func(data : FuncData) -> Value

#
make_func_ext

fn make_func_ext(data : FuncDataExt) -> Value

#
make_host_object

fn make_host_object(name~ : String, proto? : Value, methods? : Map[String, Value], accessors? : Map[String, (Value?, Value?)], non_writable? : Map[String, Value], frozen? : Map[String, Value], host_slots? : Map[HostSlotKey, Value], extensible? : Bool) -> Value

Create a host object with methods, accessors, intent-shaped data properties, and embedder host slots (#517). Returns Value so callers need not match on ObjectData. Composes install_builtin_* and set_host_slot.

Parameters
  • name[[Class]] / class_name string (e.g. "Element").
  • proto[[Prototype]]. Defaults to Null (not %Object.prototype%); pass a realm object prototype when the host object should inherit from it.
  • methods — string-keyed callables with builtin method descriptors.
  • accessors — map of name → (getter?, setter?). At least one side must be Some; use None for an absent side.
  • non_writable / frozen — rare constant data props (builtin descriptors).
  • host_slots — embedder-private state keyed by pre-reserved HostSlotKey values (HostSlotKey::reserve() once per slot kind, then build the map).
  • extensible[[Extensible]] (default true).

Install order: non_writablefrozenmethodsaccessors host_slots. Same string key across the JS maps: later step wins (factory stomping, not [[DefineOwnProperty]] — avoid dual-defining the same name, including overwriting a frozen key).

#
make_interp_method_func

fn make_interp_method_func(name~ : String, length? : Int, realm_state? : RealmState?, func : (Interpreter, Value, Array[Value]) -> Value raise) -> Value

Interpreter-aware method function: callback receives interpreter and this. Signature (Interpreter, Value, Array[Value]) -> Value raise Error.

#
make_interp_method_func_with_context

fn make_interp_method_func_with_context(name~ : String, length? : Int, func : (Interpreter, CallContext, Value, Array[Value]) -> Value raise) -> Value

Interpreter-aware method function with explicit call/construct context.

#
make_interp_static_func

fn make_interp_static_func(name~ : String, length? : Int, func : (Interpreter, Array[Value]) -> Value raise) -> Value

Interpreter-aware static function: callback receives interpreter but not this. Signature (Interpreter, Array[Value]) -> Value raise Error.

#
make_method_func

fn make_method_func(name~ : String, length? : Int, realm_state? : RealmState?, func : (Value, Array[Value]) -> Value raise) -> Value

Method function: callback receives this. Signature (Value, Array[Value]) -> Value raise Error.

#
make_native_func

fn make_native_func(name~ : String, length? : Int, realm_state? : RealmState?, func : (Array[Value]) -> Value raise) -> Value

Non-constructable native function: callback is (Array[Value]) -> Value raise Error. Use for built-in free functions and static methods.

#
make_object

fn make_object(properties : Map[String, Value], prototype : Value, callable : Callable?, class_name : String, descriptors : Map[String, PropDescriptor], extensible : Bool) -> Value

Helper to create a basic object with default empty symbol maps

#
make_plain_object

fn make_plain_object() -> Value

Helper to create a plain object

#
make_tagged_template_object

fn make_tagged_template_object(quasis : Array[(String, String?)]) -> Value

#
mark_as_method

fn mark_as_method(v : Value) -> Value

Mark a function value as a method-shorthand definition ({ m() {} }). Per ES §15.4.5 MethodDefinitionEvaluation, such functions have no [[Construct]] internal method and must throw TypeError when called via new. Sets is_method: true on the FuncData/FuncDataExt. Non-UserFunc/UserFuncExt values (generators, async functions, etc.) pass through unchanged — they have their own non-constructor semantics.

#
module_namespace_set_prototype_result

fn module_namespace_set_prototype_result(data : ObjectData, proto : Value) -> Bool?

Module-namespace exotic object [[SetPrototypeOf]] shortcut (§28.3 / §10.4.6.2). Relocated from interpreter/stdlib/module_namespace_helpers.mbt; the stdlib_ name prefix is dropped because runtime is now the defining package (necessary move fixup, not a redesign). Shared by Reflect.setPrototypeOf and Object.setPrototypeOf.

#
new_promise_data

fn new_promise_data() -> PromiseData

Create a new pending promise data structure

#
object_entries

fn object_entries(interp : Interpreter, obj : Value) -> Value raise

#
object_get_prototype_of

fn object_get_prototype_of(interp : Interpreter, target : Value) -> Value raise

#
object_is_extensible

fn object_is_extensible(interp : Interpreter, obj : Value) -> Value raise

O.[[IsExtensible]]() backing for Object.isExtensible (§20.1.2.12).

#
object_keys

fn object_keys(interp : Interpreter, obj : Value) -> Value raise

#
object_prevent_extensions

fn object_prevent_extensions(interp : Interpreter, obj : Value) -> Value raise

O.[[PreventExtensions]]() backing for Object.preventExtensions (§20.1.2.17). A falsy Proxy trap result is an exceptional completion here.

#
object_set_prototype_of

fn object_set_prototype_of(interp : Interpreter, target : Value, proto : Value) -> Value raise

target.[[SetPrototypeOf]](proto) backing for Reflect.setPrototypeOf (§28.1.13). Argument-count validation stays at the stdlib boundary; this op performs the proto-type validation and the match target dispatch verbatim, including the non-object TypeError arm and the Reflect-specific "return false" (rather than throw) on a non-extensible target.

#
object_values

fn object_values(interp : Interpreter, obj : Value) -> Value raise

#
observe_source_failure

fn[T] observe_source_failure(realm_state : RealmState, eval : () -> T raise) -> Result[T, SourceObservedFailure]

Observe source provenance atomically without changing the raised error. Nested call wrappers record an error only while this scope is active.

#
ordinary_get_own_property

fn ordinary_get_own_property(val : Value, key : Value) -> PropDescriptor? raise

ES §10.1.5 OrdinaryGetOwnProperty(O, P). Returns the stored descriptor for an own property on val. For Array, synthesizes descriptors for length and in-range indexed elements per §10.4.2. Returns None if the property is not own.

#
ordinary_get_own_value_for_descriptor

fn ordinary_get_own_value_for_descriptor(val : Value, key : Value) -> Value raise

Extract the stored own value for key on val. Mirrors the key-aware reader used in proxy helpers but surfaced here for VAP's value-change check (step 4.b.iii).

#
ordinary_set_prototype

fn ordinary_set_prototype(interp : Interpreter, data : ObjectData, proto : Value) -> Bool

[[SetPrototypeOf]] cycle detection and extensibility guard for ordinary objects (§10.1.2.1). Returns true if the prototype was set, false if it would create a cycle or the target is non-extensible. Does NOT handle immutable-prototype exotic objects (Object.prototype) — callers check before reaching this.

#
own_string_property_names

fn own_string_property_names(interp : Interpreter, source : Value) -> Value raise

Object.getOwnPropertyNames (§20.1.2.11): the String-typed own keys from the canonical [[OwnPropertyKeys]] enumeration. Array holes and TypedArray validity are handled by the canonical op.

#
own_symbol_properties

fn own_symbol_properties(interp : Interpreter, source : Value) -> Value raise

Object.getOwnPropertySymbols (§20.1.2.12): the Symbol-typed own keys from the canonical [[OwnPropertyKeys]] enumeration.

#
proxy_define_property

fn proxy_define_property(interp : Interpreter, proxy_data : ProxyData, key : Value, partial : PartialDescriptor) -> Bool raise

ES §10.5.6 [[DefineOwnProperty]] (Proxy). Invokes the defineProperty trap and validates:
  • trap returns falsy -> return false
  • trap returns true + target has no own desc + target non-extensible -> TypeError
  • trap returns true + incoming descriptor is non-configurable + target descriptor doesn't exist / is configurable -> TypeError
  • trap returns true + existing target desc non-configurable incompatible with incoming -> TypeError

#
proxy_delete_property

fn proxy_delete_property(interp : Interpreter, proxy_data : ProxyData, key : String) -> Bool raise

Implement the Proxy [[Delete]] invariant checks per ES §10.5.10.

#
proxy_get

fn proxy_get(interp : Interpreter, proxy_data : ProxyData, key : String, receiver : Value) -> Value raise

String-key compatibility wrapper for existing [[Get]] call sites.

#
proxy_get_own_property

fn proxy_get_own_property(interp : Interpreter, proxy_data : ProxyData, key : Value) -> (PropDescriptor, Value)? raise

ES §10.5.5 [[GetOwnProperty]] (Proxy). Invokes the getOwnPropertyDescriptor trap with the canonical invariant set:
  • trap returns non-object non-undefined -> TypeError
  • target's own desc is non-configurable AND trap returns undefined -> TypeError
  • target is non-extensible + no own desc + trap returns object -> TypeError
  • trap reports non-configurable + non-writable; target is NOT both -> TypeError
  • target non-configurable accessor: getter/setter identity must match (SameValue) Returns the completed descriptor or None.

#
proxy_get_prototype_of

fn proxy_get_prototype_of(interp : Interpreter, proxy_data : ProxyData) -> Value raise

Implement the Proxy [[GetPrototypeOf]] internal method per ES §10.5.1.

#
proxy_has_property

fn proxy_has_property(interp : Interpreter, proxy_data : ProxyData, key : String) -> Bool raise

Implement the Proxy [[HasProperty]] invariant checks per ES §10.5.7. Called after the has trap returns a result.

#
proxy_has_property_key

fn proxy_has_property_key(interp : Interpreter, proxy_data : ProxyData, key : Value) -> Bool raise

#
proxy_is_extensible

fn proxy_is_extensible(interp : Interpreter, proxy_data : ProxyData) -> Bool raise

Implement the Proxy [[IsExtensible]] internal method per ES §10.5.3.

#
proxy_own_property_keys

fn proxy_own_property_keys(interp : Interpreter, proxy_data : ProxyData) -> Value raise

Implement the Proxy [[OwnPropertyKeys]] internal method per ES §10.5.11. Calls the ownKeys trap, validates the result against the target's invariants, and returns the validated list of keys as an Array value.

#
proxy_prevent_extensions

fn proxy_prevent_extensions(interp : Interpreter, proxy_data : ProxyData) -> Bool raise

Implement the Proxy [[PreventExtensions]] internal method per ES §10.5.4.

#
proxy_set

fn proxy_set(interp : Interpreter, proxy_data : ProxyData, key : String, value : Value, receiver : Value, strict : Bool) -> Value raise

Implement the Proxy [[Set]] invariant checks per ES §10.5.9.

#
proxy_set_prototype_of

fn proxy_set_prototype_of(interp : Interpreter, proxy_data : ProxyData, proto : Value) -> Bool raise

Implement the Proxy [[SetPrototypeOf]] internal method per ES §10.5.2.

#
raise_js_exception

fn raise_js_exception(value : Value) -> Unit raise

Raise a JavaScript exception with the given value. This is the only way for external packages to raise JsException since suberror constructors from other packages are read-only in MoonBit.

#
realm_value_to_json

fn realm_value_to_json(realm_state : RealmState, value : Value) -> Json raise JsonBridgeError

Copy a runtime value into strict JSON data without performing property lookup, calling getters or toJSON, or consulting a mutable global.

#
reflect_get_with_receiver

fn reflect_get_with_receiver(interp : Interpreter, target : Value, key : Value, receiver : Value, loc :
Loc
) -> Value raise

target receiver-aware [[Get]] backing for Reflect.get (§28.1.7). Argument validation and the non-object TypeError check stay at the stdlib boundary; this op performs the receiver-aware descriptor walk verbatim. The former try_get_with_receiver closure's captures are threaded as parameters; its body is unchanged.

#
reject_promise

fn reject_promise(interp : Interpreter, promise_data : PromiseData, reason : Value) -> Unit

Reject a promise with the given reason. Triggers all reject reactions as microtasks.

#
revoke_proxy

fn revoke_proxy(proxy_data : ProxyData) -> Unit

Revoke a proxy by nullifying its target and handler slots. The cached The cached call/construct classifications are intentionally left untouched: revocation clears the target and handler slots, not the Proxy's internal [[Call]] and [[Construct]] methods.

#
set_array_iterator_override

fn set_array_iterator_override(arr : ArrayData, well_known_symbols~ : WellKnownSymbols, getter : Value?, value : Value?) -> Unit

#
set_array_length_override

fn set_array_length_override(arr : ArrayData, len : Int64) -> Unit

Store sparse Array length state in the ArrayData PropertyBag. This keeps Array exotic state attached to the array object instead of a module-level identity side table, using a non-forgeable internal symbol id so ordinary string-keyed property lookup cannot observe it.

#
set_array_like_element

fn set_array_like_element(val : Value, index : Int64, value : Value) -> Unit

Set indexed element on array-like value

#
set_array_like_length

fn set_array_like_length(val : Value, len : Int64) -> Unit

Set the length property on an array-like value

#
set_array_named_prop

fn set_array_named_prop(arr : ArrayData, key : String, value : Value) -> Unit

#
set_array_prototype_override

fn set_array_prototype_override(arr : ArrayData, proto : Value) -> Unit

#
set_array_symbol_prop

fn set_array_symbol_prop(arr : ArrayData, sym_id : Int, value : Value) -> Unit

#
set_function_name

fn set_function_name(val : Value, name : String) -> Unit

SetFunctionName: set name property on anonymous functions per ES2015+. Only sets name if the current name is empty (anonymous).

#
set_host_slot

fn set_host_slot(data : ObjectData, key : HostSlotKey, value : Value) -> Unit

#
set_integrity_frozen

fn set_integrity_frozen(interp : Interpreter, obj : Value) -> Value raise

SetIntegrityLevel(O, frozen) backing for Object.freeze (§20.1.2.6).

#
set_integrity_sealed

fn set_integrity_sealed(interp : Interpreter, obj : Value) -> Value raise

SetIntegrityLevel(O, sealed) backing for Object.seal (§20.1.2.20).

#
set_keyed_collection_iterator_next_index

fn set_keyed_collection_iterator_next_index(data : ObjectData, sym_id : Int, value : Value) -> Unit

#
set_private_field

fn set_private_field(obj : Value, brand : Value, name : String, value : Value) -> Unit raise

Write a private field value on an object. Raises TypeError if brand check fails.

#
setup_async_function_constructor

fn setup_async_function_constructor(env : Environment, well_known_symbols~ : WellKnownSymbols) -> Unit

Set up the AsyncFunction constructor and prototype chain. Mirrors setup_generator_function_constructor in generator.mbt.

Prototype chain (per ES spec): AsyncFunction.proto === Function AsyncFunction.prototype.proto === Function.prototype AsyncFunction.prototype[@@toStringTag] === "AsyncFunction" AsyncFunction.prototype.constructor === AsyncFunction

#
setup_async_generator_function_constructor

fn setup_async_generator_function_constructor(env : Environment, well_known_symbols~ : WellKnownSymbols) -> Unit

Set up the AsyncGeneratorFunction constructor and prototype chain. Mirrors setup_generator_function_constructor in generator.mbt.

Prototype chain (per ES spec §27.4): %AsyncGeneratorFunction%.proto === Function %AsyncGeneratorFunction%.prototype.proto === Function.prototype %AsyncGeneratorFunction%.prototype[@@toStringTag] === "AsyncGeneratorFunction" %AsyncGeneratorFunction%.prototype.constructor === %AsyncGeneratorFunction% %AsyncGeneratorFunction%.prototype.prototype === %AsyncGeneratorPrototype% %AsyncIteratorPrototype%.proto === Object.prototype %AsyncIteratorPrototype%[@@asyncIterator] returns this %AsyncGeneratorPrototype%.proto === %AsyncIteratorPrototype% %AsyncGeneratorPrototype%.constructor === %AsyncGeneratorFunction%.prototype %AsyncGeneratorPrototype%[@@toStringTag] === "AsyncGenerator"

#
setup_generator_function_constructor

fn setup_generator_function_constructor(env : Environment, global_this : Value, well_known_symbols~ : WellKnownSymbols) -> Unit

Set up the GeneratorFunction constructor on the given interpreter. GeneratorFunction("a", "yield a") creates a generator function, analogous to Function("a", "return a") for regular functions.

#
sort_property_keys

fn sort_property_keys(props : Map[String, Value]) -> Array[String]

Sort property keys per OrdinaryOwnPropertyKeys spec order:
  1. Integer indices in ascending numeric order
  2. Other string keys in insertion order

#
stack_depth_limit_message

fn stack_depth_limit_message() -> String

#
stamp_function_realm

fn stamp_function_realm(value : Value, realm_state? : RealmState?) -> Value

#
stamp_function_realm_with

fn stamp_function_realm_with(value : Value, function_proto : Value, object_proto : Value, string_proto? : Value, number_proto? : Value, boolean_proto? : Value, symbol_proto? : Value, array_proto? : Value, map_proto? : Value, set_proto? : Value, promise_proto? : Value) -> Value

#
strict_equal

fn strict_equal(a : Value, b : Value) -> Bool

#
string_to_utf16

fn string_to_utf16(s : String) -> Array[Int]

Convert a MoonBit string (sequence of Unicode code points) to an array of UTF-16 code units. Supplementary characters (code point > 0xFFFF) are split into a surrogate pair (high surrogate + low surrogate).

#
strip_self_name_binding

fn strip_self_name_binding(v : Value) -> Value

Rebuild a function value with has_name_binding: false on its FuncData/FuncDataExt. Used for method-shorthand definitions (in object literals) where the parser emits FuncExpr/FuncExprExt with name = Some(key) for fn.name purposes, but §15.2.5's self-name binding does NOT apply. Non-UserFunc/UserFuncExt values pass through unchanged (nothing to strip).

#
test_integrity_frozen

fn test_integrity_frozen(interp : Interpreter, obj : Value) -> Value raise

TestIntegrityLevel(O, frozen) backing for Object.isFrozen (§20.1.2.13).

#
test_integrity_sealed

fn test_integrity_sealed(interp : Interpreter, obj : Value) -> Value raise

TestIntegrityLevel(O, sealed) backing for Object.isSealed (§20.1.2.15).

#
to_array_like_elements

fn to_array_like_elements(val : Value) -> Array[Value] raise

Convert array-like value to an Array of Values

#
to_array_like_length

fn to_array_like_length(val : Value) -> Int64 raise

ToLength: Get length from any value as per ECMAScript spec (array-like objects)

#
to_array_like_length_interp

fn to_array_like_length_interp(val : Value, interp : Interpreter) -> Int64 raise

ToLength with full interpreter support for user-defined getter-based length

#
to_index

fn to_index(val : Value, interp? : Interpreter?) -> Int64 raise

ECMAScript ToIndex: converts a value to a non-negative integer index. Throws RangeError for negative values or values >= 2^53. Returns 0 for undefined.

#
to_int32

fn to_int32(n : Double) -> Int

#
to_js_string

fn to_js_string(val : Value, interp? : Interpreter?) -> String raise

ECMAScript ToString - converts a value to a string following the spec. For objects, calls ToPrimitive(hint: "string") then converts result to string.

#
to_number

fn to_number(val : Value, interp? : Interpreter?) -> Double raise

#
to_primitive_default

fn to_primitive_default(obj_val : Value, data : ObjectData, interp? : Interpreter?) -> Value raise

ToPrimitive(input, hint "default") - for + operator. Same as "number" except passes "default" to @@toPrimitive.

#
to_primitive_number

fn to_primitive_number(obj_val : Value, data : ObjectData, interp? : Interpreter?) -> Value raise

ToPrimitive(input, hint "number") - converts an object to a primitive value. Follows the ECMAScript spec: check @@toPrimitive, then valueOf, then toString.

#
to_property_key

fn to_property_key(val : Value, interp? : Interpreter?) -> Value raise

ECMAScript ToPropertyKey §7.1.19 — canonicalize a Value into a property key. Symbols pass through; anything else is ToPrimitive(hint:"string") + ToString via to_js_string, which invokes user-land Symbol.toPrimitive / toString hooks (so the caller observes side-effects in spec order).

#
type_of

fn type_of(val : Value) -> String

#
unwrap_grouping

Strip consecutive Grouping nodes from an expression. Per ES spec, grouping parentheses do not change the Reference type, so ((eval))("code") is still a direct eval call.

#
utf16_length

fn utf16_length(s : String) -> Int

Get the UTF-16 length of a string (counting code units, not code points).

#
validate_function_constructor_params

fn validate_function_constructor_params(is_simple : Bool, param_names : Array[String], rest_name : String?, body : Array[
Stmt
]) -> Unit raise

Apply parameter-list early errors for functions built via the Function / GeneratorFunction / AsyncFunction / AsyncGeneratorFunction constructors. Per spec these fire at construction time, not at call.

Three checks:
  1. Non-simple parameter list with "use strict" directive in body is a SyntaxError (§15.1.1 / §14.1.2).
  2. Strict-mode (or non-simple) parameter list must not contain duplicate names.
  3. Strict-mode parameter names must not be eval, arguments, or a strict-reserved word (§15.1.5).

#
validate_function_constructor_params_ext

fn validate_function_constructor_params_ext(params : Array[
Param
], rest_param : String?, body : Array[
Stmt
]) -> Unit raise

#
validate_function_signature

fn validate_function_signature(enclosing_strict : Bool, name : String?, params : Array[String], body : Array[
Stmt
]) -> Unit raise

#
validate_function_signature_ext

fn validate_function_signature_ext(enclosing_strict : Bool, name : String?, params : Array[
Param
], rest_param : String?, body : Array[
Stmt
]) -> Unit raise

#
validate_non_configurable

fn validate_non_configurable(existing : PropDescriptor, prop_display : String, is_accessor : Bool, is_data : Bool, has_value : Bool, new_writable : Bool?, new_enumerable : Bool?, new_configurable : Bool?, new_getter : Value?, new_setter : Value?, get_old_value : () -> Value, get_new_value : () -> Value?) -> Unit raise

Validate non-configurable property constraints per ES spec [[DefineOwnProperty]]. Throws TypeError if the proposed descriptor change violates invariants. This is the sole authority for descriptor mutation constraints in the runtime.

#
with_active_realm_state_unit

fn with_active_realm_state_unit(realm_state : RealmState, eval : () -> Unit) -> Unit

#
with_source_identity

fn[T] with_source_identity(realm_state : RealmState, source_identity : String?, eval : () -> T raise) -> T raise

Source Files