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