@r47onfire/backolon - v0.0.0
    Preparing search index...

    Class Task

    Represents a running Backolon evaluation task.

    Index

    Constructors

    Properties

    priority: number
    result: Thing<string | ThingType> | null = null

    Represents the result of the last evaluated expression, used for returning values to whatever started this task.

    scheduler: Scheduler
    stack: readonly StackEntry[] = []
    suspended: boolean = false

    Whether this task is currently suspended (e.g. waiting for a promise to resolve). If true, the scheduler will not run this task until it is resumed by setting suspended to false.

    Methods

    • Return a new thing representing the current continuation at this point in evaluation, which when called will return to this point with the given value as the result of the current expression.

      The continuation will capture the entire stack, so it has infinite extent.

      Parameters

      Returns Thing<continuation>

    • Temporarily pop the given number of stack frames, call the callback with the new top of the stack, and then restore the popped stack frames. This is used for things like variable declaration and assignment where we need to access the correct environment to put the variable in.

      If depth is greater than or equal to the current stack size, the callback will be called with the bottom of the stack (which is usually the global scope).

      Parameters

      Returns void

    • Enters a new stack frame with the given code, location, environment, and arguments.

      Parameters

      • code: Thing
      • loc: LocationTrace

        The location trace to use in error messages.

      • env: Thing<env> | Thing<nil>
      • args: readonly Thing<string | ThingType>[] = []
      • Optionalname: string | null

        The name of the stack frame, if it is significant and should appear in a stack trace.

      Returns void

    • Exit the current stack frame, optionally with a result to return to the caller. The result will be passed back to whatever got us here (e.g. the parent stack frame or the creator of the task).

      Parameters

      Returns StackEntry

    • Try to take a single evaluation step in this task. Returns true if the task made progress (e.g. evaluated something or updated its state), or false if the task is currently suspended or has finished execution. If the task throws an error during evaluation, the task may end up in an undefined state.

      Returns boolean

    • Update the current stack entry with a new cookie value(s), returning the new stack entry. The cookie is used to track internal evaluation state for constructs that call back into Backolon code, so the Javascript implementation knows where it was and can resume evaluation from the correct point when the Backolon code returns.

      The exact meaning of the cookie value(s) depends on the construct being evaluated.

      Parameters

      • index: number
      • state: number
      • Optionaldata: any

        An optional additional data to store in the stack entry, which won't be updated if not provided.

      Returns StackEntry

    • Updates the current stack entry with a new environment, returning the new stack entry. This is used when entering a new scope (e.g. injecting context-sensitive information).

      Parameters

      Returns StackEntry

    • Updates the current stack entry with new flags, returning the new stack entry. toSet and toClear are bitmasks of StackFlag values to set and clear respectively.

      Parameters

      • toSet: number
      • toClear: number

      Returns StackEntry