refactor: remove unused functions and classes in diagnostics (#28923)

PR Close #28923
This commit is contained in:
Alan 2019-02-22 11:55:10 +01:00 committed by Andrew Kushnir
parent 1efad3772e
commit b446095c4d
1 changed files with 2 additions and 58 deletions

View File

@ -6,12 +6,11 @@
* found in the LICENSE file at https://angular.io/license
*/
import {AotSummaryResolver, CompileMetadataResolver, CompilePipeSummary, CompilerConfig, DEFAULT_INTERPOLATION_CONFIG, DirectiveNormalizer, DirectiveResolver, DomElementSchemaRegistry, HtmlParser, InterpolationConfig, NgAnalyzedModules, NgModuleResolver, ParseTreeResult, PipeResolver, ResourceLoader, StaticReflector, StaticSymbol, StaticSymbolCache, StaticSymbolResolver, SummaryResolver} from '@angular/compiler';
import * as fs from 'fs';
import {CompilePipeSummary, StaticSymbol} from '@angular/compiler';
import * as path from 'path';
import * as ts from 'typescript';
import {BuiltinType, DeclarationKind, Definition, PipeInfo, Pipes, Signature, Span, Symbol, SymbolDeclaration, SymbolQuery, SymbolTable} from './symbols';
import {BuiltinType, DeclarationKind, Definition, Signature, Span, Symbol, SymbolDeclaration, SymbolQuery, SymbolTable} from './symbols';
import {isVersionBetween} from './typescript_version';
// In TypeScript 2.1 these flags moved
@ -647,50 +646,6 @@ class EmptyTable implements SymbolTable {
static instance = new EmptyTable();
}
function findTsConfig(fileName: string): string|undefined {
let dir = path.dirname(fileName);
while (fs.existsSync(dir)) {
const candidate = path.join(dir, 'tsconfig.json');
if (fs.existsSync(candidate)) return candidate;
const parentDir = path.dirname(dir);
if (parentDir === dir) break;
dir = parentDir;
}
}
function isBindingPattern(node: ts.Node): node is ts.BindingPattern {
return !!node && (node.kind === ts.SyntaxKind.ArrayBindingPattern ||
node.kind === ts.SyntaxKind.ObjectBindingPattern);
}
function walkUpBindingElementsAndPatterns(node: ts.Node): ts.Node {
while (node && (node.kind === ts.SyntaxKind.BindingElement || isBindingPattern(node))) {
node = node.parent !;
}
return node;
}
function getCombinedNodeFlags(node: ts.Node): ts.NodeFlags {
node = walkUpBindingElementsAndPatterns(node);
let flags = node.flags;
if (node.kind === ts.SyntaxKind.VariableDeclaration) {
node = node.parent !;
}
if (node && node.kind === ts.SyntaxKind.VariableDeclarationList) {
flags |= node.flags;
node = node.parent !;
}
if (node && node.kind === ts.SyntaxKind.VariableStatement) {
flags |= node.flags;
}
return flags;
}
function isSymbolPrivate(s: ts.Symbol): boolean {
return !!s.valueDeclaration && isPrivate(s.valueDeclaration);
}
@ -753,15 +708,6 @@ function setParents<T extends ts.Node>(node: T, parent: ts.Node): T {
return node;
}
function spanOf(node: ts.Node): Span {
return {start: node.getStart(), end: node.getEnd()};
}
function shrink(span: Span, offset?: number) {
if (offset == null) offset = 1;
return {start: span.start + offset, end: span.end - offset};
}
function spanAt(sourceFile: ts.SourceFile, line: number, column: number): Span|undefined {
if (line != null && column != null) {
const position = ts.getPositionOfLineAndCharacter(sourceFile, line, column);
@ -863,8 +809,6 @@ function typeKindOf(type: ts.Type | undefined): BuiltinType {
return BuiltinType.Other;
}
function getFromSymbolTable(symbolTable: ts.SymbolTable, key: string): ts.Symbol|undefined {
const table = symbolTable as any;
let symbol: ts.Symbol|undefined;