import { Identifier } from "../lexer";
import { Location } from "../lexer/Token";
import { BrsType, RoAssociativeArray } from "../brsTypes";
import type { ISGNode } from "../extensions";
/** The logical region from a particular variable or function that defines where it may be accessed from. */
export declare enum Scope {
    /** The set of native functions that are always accessible, e.g. `RebootSystem`. */
    Global = 0,
    /** The set of named functions accessible from a set of files compiled together. */
    Module = 1,
    /** The set of variables (including anonymous functions) accessible *only* from within a function body. */
    Function = 2
}
/** An error thrown when attempting to access an uninitialized variable. */
export declare class NotFound extends Error {
    constructor(reason: string);
}
/** Holds a set of values in multiple scopes and provides access operations to them. */
export declare class Environment {
    constructor(mPointer: RoAssociativeArray, rootM?: RoAssociativeArray);
    /**
     * Functions that are always accessible.
     * @see Scope.Global
     */
    private global;
    /**
     * Named functions that are compiled together into a single module.
     * @see Scope.Module
     */
    private module;
    private locations;
    /**
     * Variables and anonymous functions accessible only within a function's body.
     * @see Scope.Function
     */
    private function;
    /** The BrightScript `m` pointer, analogous to JavaScript's `this` pointer. */
    private mPointer;
    private rootM;
    /** The node in which field-change observers are registered. */
    hostNode: ISGNode | undefined;
    /** Properties to support GOTO statement */
    gotoLabel: string;
    continueFor: boolean;
    continueForEach: number;
    /**
     * Stores a `value` for the `name`d variable in the provided `scope`.
     * @param scope The logical region from a particular variable or function that defines where it may be accessed from
     * @param name the name of the variable to define (in the form of an `Identifier`)
     * @param value the value of the variable to define
     * @param location the location in the source file where this variable was defined (optional)
     */
    define(scope: Scope, name: string, value: BrsType, location?: Location): void;
    /**
     * Returns the module function location
     * @param name module function name
     * @returns if exists returns the location
     */
    getDefinedLocation(name: string): Location | undefined;
    /**
     * Sets the value of the special `m` variable, which is analogous to JavaScript's `this`.
     * @param newMPointer the new value to be used for the `m` pointer
     */
    setM(newMPointer: RoAssociativeArray, updateFunction?: boolean): void;
    /**
     * Retrieves the the special `m` variable from the root Environment.
     * @returns the current value used for the root `m` pointer.
     */
    getRootM(): RoAssociativeArray;
    /**
     * Sets the the special `m` variable from the root Environment.
     * @param newMPointer the new value to be used for the `m` pointer
     */
    setRootM(newMPointer: RoAssociativeArray): void;
    /**
     * Removes a variable from this environment's function scope.
     * @param name the name of the variable to remove (in the form of an `Identifier`)
     * @param scope the scope to remove this variable from (defaults to "function")
     */
    remove(name: string, scope?: Scope): void;
    /**
     * Removes all BrsComponent references from function scope.
     * Typically used when a function execution is complete.
     */
    removeReferences(): void;
    /**
     * Retrieves a variable from this environment, checking each internal scope in order of precedence.
     * @param name the name of the variable to retrieve (in the form of an `Identifier`)
     * @returns the value stored for `name` if any exist
     * @throws a `NotFound` error if no value is stored for `name`
     */
    get(name: Identifier): BrsType;
    /**
     * Determines whether or not a variable exists in this environment.
     * @param name the name of the variable to search for (in the form of an `Identifier`)
     * @param scopeFilter the set of scopes with which to limit searches for `name`
     * @returns `true` if this environment contains `name`, otherwise `false`
     */
    has(name: Identifier, scopeFilter?: Scope[]): boolean;
    /**
     * Returns list of variables of a specific in this environment.
     * @param scope the scope to return variables map
     * @returns the map of variables for the requested scope
     */
    getList(scope: Scope): Map<string, BrsType>;
    /**
     * Creates a clone of the current environment, but without its function-scoped
     * values. Useful for creating sub-environments.
     *
     * The Reference BrightScript Implementation (RBI) doesn't currently create closures when
     * functions are created.  When a function is called, it has access only to:
     *
     * 1. Globally-defined functions (e.g. `RebootSystem`, `UCase`, et. al.)
     * 2. Named functions compiled together into a single "module"
     * 3. Parameters passed into the function
     * 4. The `m` pointer, defined by the way in which a function was called
     *
     * @returns a copy of this environment but with no function-scoped values.
     */
    createSubEnvironment(includeModuleScope?: boolean): Environment;
}
