Environment that defines variable scope.

interface Env {
    async: boolean;
    fn: boolean;
    global: Env;
    parent: null | Env;
    get(name): undefined | AsyncValue<Value>;
    getOwn(name): undefined | AsyncValue<Value>;
    push(): Env;
    set<V>(name, value): V;
    setOwn<V>(name, value, readOnly?): V;
}

Implemented by

Properties

async: boolean

Indicates if the env is async.

fn: boolean

Indicates if current scope is within a function.

global: Env

Returns the global env scope.

parent: null | Env

Returns the parent env scope, or null if the env is the global scope.

Methods

  • Push a new scope to the stack and returns the new env.

    Returns Env

  • Sets a variable.

    Type Parameters

    Parameters

    • name: string
    • value: V

    Returns V

  • Sets a variable on current scope.

    Type Parameters

    Parameters

    • name: string
    • value: V
    • Optional readOnly: boolean

    Returns V

Generated using TypeDoc