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

    Class Task

    Represents a running Backolon evaluation task.

    Index

    Constructors

    Properties

    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.

    stack: readonly StackEntry[] = []
    result: Thing<string | ThingType> | null = null

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

    priority: number
    scheduler: Scheduler

    Methods

    • 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

    • 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>

    • 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. If not provided, the data value from the current stack entry is used.

      Returns StackEntry

    • Updates the current stack entry with new flags, returning the new stack entry.

      Parameters

      • toSet: number

        Bitmask of flags to set (takes precedence over toClear)

      • toClear: number

        Bitmask of flags to clear

      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

    • 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