UNPKG

1.57 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright 2013 Palantir Technologies, Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17import * as ts from "typescript";
18import { IOptions } from "../rule/rule";
19import { ScopeAwareRuleWalker } from "./scopeAwareRuleWalker";
20/**
21 * @deprecated See comment on ScopeAwareRuleWalker.
22 *
23 * An AST walker that is aware of block scopes in addition to regular scopes. Block scopes
24 * are a superset of regular scopes (new block scopes are created more frequently in a program).
25 */
26export declare abstract class BlockScopeAwareRuleWalker<T, U> extends ScopeAwareRuleWalker<T> {
27 private readonly blockScopeStack;
28 constructor(sourceFile: ts.SourceFile, options: IOptions);
29 abstract createBlockScope(node: ts.Node): U;
30 getAllBlockScopes(): U[];
31 getCurrentBlockScope(): U;
32 getCurrentBlockDepth(): number;
33 onBlockScopeStart(): void;
34 onBlockScopeEnd(): void;
35 findBlockScope(predicate: (scope: U) => boolean): U | undefined;
36 protected visitNode(node: ts.Node): void;
37 private isBlockScopeBoundary;
38}