Removed unused declarations from 'services.ts'.

This commit is contained in:
Daniel Rosenwasser
2015-12-17 19:47:01 -08:00
parent 19b44e0c72
commit 75678de6d9

View File

@@ -2987,7 +2987,6 @@ namespace ts {
function getCompletionData(fileName: string, position: number) {
const typeChecker = program.getTypeChecker();
const syntacticStart = new Date().getTime();
const sourceFile = getValidSourceFile(fileName);
const isJavaScriptFile = isSourceFileJavaScript(sourceFile);
@@ -6166,10 +6165,6 @@ namespace ts {
return ts.NavigateTo.getNavigateToItems(program, cancellationToken, searchValue, maxResultCount);
}
function containErrors(diagnostics: Diagnostic[]): boolean {
return forEach(diagnostics, diagnostic => diagnostic.category === DiagnosticCategory.Error);
}
function getEmitOutput(fileName: string): EmitOutput {
synchronizeHostData();
@@ -7045,7 +7040,6 @@ namespace ts {
* be performed.
*/
function getDocCommentTemplateAtPosition(fileName: string, position: number): TextInsertion {
const start = new Date().getTime();
const sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
// Check if in a context where we don't want to perform any insertion
@@ -7339,11 +7333,17 @@ namespace ts {
if (declarations && declarations.length > 0) {
// Disallow rename for elements that are defined in the standard TypeScript library.
const defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings());
const canonicalDefaultLibName = getCanonicalFileName(ts.normalizePath(defaultLibFileName));
if (defaultLibFileName) {
for (const current of declarations) {
const sourceFile = current.getSourceFile();
// TODO (drosen): When is there no source file?
if (!sourceFile) {
continue;
}
const canonicalName = getCanonicalFileName(ts.normalizePath(sourceFile.fileName));
if (sourceFile && getCanonicalFileName(ts.normalizePath(sourceFile.fileName)) === getCanonicalFileName(ts.normalizePath(defaultLibFileName))) {
if (canonicalName === canonicalDefaultLibName) {
return getRenameInfoError(getLocaleSpecificMessage(Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library));
}
}