mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-16 13:05:14 +03:00
docs(codemode): describe built-in frames instead of native host generators
This commit is contained in:
@@ -13,7 +13,7 @@ import {
|
||||
} from "./objects.js"
|
||||
import { describeValue } from "./references.js"
|
||||
|
||||
/** A native function body: a value, a thrown `PendingThrow`, or interpreter work producing a value. */
|
||||
/** A native function body: a value, a thrown `PendingThrow`, or what the machine carries out as the call. */
|
||||
export type Impl = NativeCall
|
||||
|
||||
export const native = (builtins: Builtins, options: NativeOptions): Native => new Native(builtins.Function, options)
|
||||
|
||||
@@ -264,8 +264,8 @@ export class Machine {
|
||||
// --- Jobs ---
|
||||
|
||||
// Starts a job on the root stack: parked frames resume with how their promise settled, an async-from-sync iterator
|
||||
// closing its iterator runs as a frame, and a reaction or thenable that calls program code runs its work in a native
|
||||
// frame. One that finishes at once leaves the stack empty.
|
||||
// closing its iterator runs as a frame, and a reaction or thenable that calls program code runs as the frame its job
|
||||
// kind makes. One that finishes at once leaves the stack empty.
|
||||
private begin(job: Job): void {
|
||||
if (job.kind === "thenable") return this.work(adoptThenable(this.ctx, job.promise, job.thenable, job.then))
|
||||
const reaction = job.reaction
|
||||
|
||||
@@ -25,7 +25,7 @@ export type Combination = {
|
||||
|
||||
/**
|
||||
* A settled promise's reaction, as data. It runs as a job (see `react` in promises.ts) and either finishes at once or
|
||||
* starts interpreter work. The kinds:
|
||||
* starts a frame that calls program code. The kinds:
|
||||
* - `await`: resume the frames parked on the promise, cut off the stack at an `await`.
|
||||
* - `settle`: pass the outcome on to `target`.
|
||||
* - `handler`: `then`/`catch` handlers; the handler's result settles `derived`.
|
||||
|
||||
@@ -92,7 +92,7 @@ export class MachineTask {
|
||||
return result
|
||||
}
|
||||
|
||||
/** Calls `callable`: a program function pushes a frame; a built-in answers at once or runs as a native frame. */
|
||||
/** Calls `callable`: a program function pushes a frame; a built-in answers at once or runs as frames. */
|
||||
call(
|
||||
callable: Value,
|
||||
thisValue: Value,
|
||||
|
||||
Reference in New Issue
Block a user