1 import { TSESTree } from '../ts-estree';
2 import { Definition } from './Definition';
3 import { Reference, ReferenceFlag } from './Reference';
4 import { ScopeManager } from './ScopeManager';
5 import { Variable } from './Variable';
6 declare type ScopeType = 'block' | 'catch' | 'class' | 'for' | 'function' | 'function-expression-name' | 'global' | 'module' | 'switch' | 'with' | 'TDZ' | 'enum' | 'empty-function';
14 variables: Variable[];
15 set: Map<string, Variable>;
16 references: Reference[];
19 taints: Map<string, boolean>;
20 functionExpressionScope: boolean;
22 __shouldStaticallyClose(scopeManager: ScopeManager): boolean;
23 __shouldStaticallyCloseForGlobal(ref: any): boolean;
24 __staticCloseRef(ref: any): void;
25 __dynamicCloseRef(ref: any): void;
26 __globalCloseRef(ref: any): void;
27 __close(scopeManager: ScopeManager): Scope;
28 __isValidResolution(ref: any, variable: any): variable is Variable;
29 __resolve(ref: Reference): boolean;
30 __delegateToUpperScope(ref: any): void;
31 __addDeclaredVariablesOfNode(variable: any, node: TSESTree.Node): void;
32 __defineGeneric(name: string, set: Map<string, Variable>, variables: Variable[], node: TSESTree.Identifier, def: Definition): void;
33 __define(node: TSESTree.Node, def: Definition): void;
34 __referencing(node: TSESTree.Node, assign?: ReferenceFlag, writeExpr?: TSESTree.Node, maybeImplicitGlobal?: any, partial?: any, init?: any): void;
37 __isClosed(): boolean;
39 * returns resolved {Reference}
40 * @method Scope#resolve
41 * @param {Espree.Identifier} ident - identifier to be resolved.
42 * @returns {Reference} reference
44 resolve(ident: TSESTree.Node): Reference;
46 * returns this scope is static
47 * @method Scope#isStatic
48 * @returns {boolean} static
52 * returns this scope has materialized arguments
53 * @method Scope#isArgumentsMaterialized
54 * @returns {boolean} arguments materialized
56 isArgumentsMaterialized(): boolean;
58 * returns this scope has materialized `this` reference
59 * @method Scope#isThisMaterialized
60 * @returns {boolean} this materialized
62 isThisMaterialized(): boolean;
63 isUsedName(name: any): boolean;
65 interface ScopeConstructor {
66 new (scopeManager: ScopeManager, type: ScopeType, upperScope: Scope | null, block: TSESTree.Node | null, isMethodDefinition: boolean): Scope;
68 declare const Scope: ScopeConstructor;
69 interface ScopeChildConstructorWithUpperScope<T> {
70 new (scopeManager: ScopeManager, upperScope: Scope, block: TSESTree.Node | null): T;
72 interface GlobalScope extends Scope {
74 declare const GlobalScope: ScopeConstructor & (new (scopeManager: ScopeManager, block: TSESTree.Node | null) => GlobalScope);
75 interface ModuleScope extends Scope {
77 declare const ModuleScope: ScopeConstructor & ScopeChildConstructorWithUpperScope<ModuleScope>;
78 interface FunctionExpressionNameScope extends Scope {
80 declare const FunctionExpressionNameScope: ScopeConstructor & ScopeChildConstructorWithUpperScope<FunctionExpressionNameScope>;
81 interface CatchScope extends Scope {
83 declare const CatchScope: ScopeConstructor & ScopeChildConstructorWithUpperScope<CatchScope>;
84 interface WithScope extends Scope {
86 declare const WithScope: ScopeConstructor & ScopeChildConstructorWithUpperScope<WithScope>;
87 interface BlockScope extends Scope {
89 declare const BlockScope: ScopeConstructor & ScopeChildConstructorWithUpperScope<BlockScope>;
90 interface SwitchScope extends Scope {
92 declare const SwitchScope: ScopeConstructor & ScopeChildConstructorWithUpperScope<SwitchScope>;
93 interface FunctionScope extends Scope {
95 declare const FunctionScope: ScopeConstructor & (new (scopeManager: ScopeManager, upperScope: Scope, block: TSESTree.Node | null, isMethodDefinition: boolean) => FunctionScope);
96 interface ForScope extends Scope {
98 declare const ForScope: ScopeConstructor & ScopeChildConstructorWithUpperScope<ForScope>;
99 interface ClassScope extends Scope {
101 declare const ClassScope: ScopeConstructor & ScopeChildConstructorWithUpperScope<ClassScope>;
102 export { ScopeType, Scope, GlobalScope, ModuleScope, FunctionExpressionNameScope, CatchScope, WithScope, BlockScope, SwitchScope, FunctionScope, ForScope, ClassScope, };
103 //# sourceMappingURL=Scope.d.ts.map