Skip to main content
The Deno 2 Release Candidate is here
Learn more
class Context
Re-export
import { Context } from "https://deno.land/x/macromania_assets@v0.2.0/deps.ts";

The state that is threaded through an evaluation process.

Constructors

new
Context(loggingBackend?: LoggingTarget)

Create a new Context, logging to the given LoggingTarget.

Properties

private
haveToMakeProgress: boolean
private
loggingBackend: LoggingTarget
private
madeProgressThisRound: boolean
private
round: number
private
state: State

Methods

private
doEvaluate(exp: Expression): Promise<Expression>
private
printNonExp(x: any): Expression

Return whether evaluation has been given up because no progress could be made.

evaluate(expression: Expression): Promise<string | null>

Evaluate an expression to a string, or return null in case of failure.

getRound(): number

Print a stacktrace, then immediately and faultily terminate evaluation.

log(...data: any[]): void

Log a message.

mustMakeProgress(): boolean

When no impure expression makes progress in an evaluation round, another round is started, in which this function returns true. If no impure expression makes progress in that round either, evaluation stops.

Print a stacktrace to the console.