heyq02/moonjs/src/builtins does not have a README file

    Builtins

    The M1 builtin registry. Owns the prototype objects and constructor values that get exposed on the global object.

    This struct is intentionally not pub(all): the vm package only needs to construct one, read the prototype references, and install into a globals object. Field access outside builtins goes through accessors.

    Builtins::array_proto

    Accessor: Array.prototype. The VM's OP_NEW_ARRAY links a fresh array's proto here.

    Builtins::error_proto

    Accessor: Error.prototype.

    Builtins::function_proto

    Accessor: Function.prototype. Not used by VM opcodes yet in M1 (function values don't have proto links to Function.prototype until we grow real callable objects — Step 9 lays the pieces, later milestones connect them). Exposed for symmetry.

    Builtins::install_into

    fn Builtins::install_into(self : Builtins, globals :
    Object
    ) -> Unit

    Attach every M1 builtin to a global object. Called from Engine::new after the empty globals object is constructed. The identity of globals is what globalThis points at, so we register it last.

    Builtins::new

    fn Builtins::new() -> Builtins

    Create a fresh set of M1 builtin objects. The order of operations is tightly coupled to prototype-chain rules — read the inline comments to see why each set_proto / set_prototype call happens where it does.

    Builtins::object_proto

    Accessor: Object.prototype. Used by the VM when it materialises a fresh object literal ({} or new Object) — the new object's [[Prototype]] must be Object.prototype so hasOwnProperty etc. work in later milestones.

    Builtins::range_error_proto

    Accessor: RangeError.prototype.

    Builtins::reference_error_proto

    fn Builtins::reference_error_proto(self : Builtins) ->
    Object

    Accessor: ReferenceError.prototype.

    Builtins::string_proto

    Accessor: String.prototype. Used for String instance links (M3 grows this to include real string methods).

    Builtins::syntax_error_proto

    fn Builtins::syntax_error_proto(self : Builtins) ->
    Object

    Accessor: SyntaxError.prototype.

    Builtins::type_error_proto

    Accessor: TypeError.prototype.

    Source Files