UNPKG

@sudoo/marked

Version:

JavaScript & TypeScript code runner in JavaScript, safe with marked territory, asynchronous

54 lines (53 loc) 2.07 kB
/** * @author WMXPY * @namespace Variable * @description Scope */ import { IExposed, IScope, ITrace, VARIABLE_TYPE } from "../declare/variable"; import { Variable } from "../variable/variable"; import { SCOPE_LABEL_LISTENER_TYPE, ScopeLabelListener } from "./declare"; import { SandMap } from "./sand-map"; export declare const BRIDGE_SCOPE_SYMBOL: unique symbol; export declare const EXECUTE_SCOPE_SYMBOL: unique symbol; type ScopeSymbol = typeof BRIDGE_SCOPE_SYMBOL | typeof EXECUTE_SCOPE_SYMBOL; export declare class Scope implements IScope { static bridgeScope(): Scope; static executeScope(parent: IScope): Scope; private readonly _symbol?; private readonly _parent; private _defaultExposed; private readonly _exposed; private readonly _labelListeners; private _constantMap; private _scopeMap; private _configs; private _throwValue; private _this; constructor(scope?: IScope, symbol?: ScopeSymbol); get constantMap(): Map<string, Variable<any>>; get scopeMap(): Map<string, Variable<any>>; get exposed(): IExposed; isBridgeScope(): boolean; isExecuteScope(): boolean; config(name: string, value?: any): Scope; child(): Scope; findThis(): SandMap<any>; initThis(): Scope; replaceThis(thisValue: SandMap<any>): this; exist(name: string): boolean; hasParent(): boolean; ensureParent(): IScope; register(type: VARIABLE_TYPE): (name: string, value: any) => Scope; rummage(name: string): Variable<any> | null; registerLabelListener(label: string, listener: ScopeLabelListener): this; executeLabelListener(label: string, type: SCOPE_LABEL_LISTENER_TYPE): boolean; validateEditable(name: string): IScope; expose(key: string, value: any, trace: ITrace): Scope; exposeDefault(value: any, trace: ITrace): Scope; setThrow(value: any): Scope; hasThrow(): boolean; getThrow(): Variable<any> | null; protected _declareConst(name: string, value: any): Scope; protected _declareLet(name: string, value: any): Scope; } export {};