Merge branch 'master' of https://github.com/Microsoft/TypeScript into esSymbols

This commit is contained in:
Jason Freeman 2015-02-17 17:02:22 -08:00
commit 47404bccf0
2 changed files with 8 additions and 13 deletions

View File

@ -5540,11 +5540,13 @@ module ts {
var declarations = symbol.getDeclarations();
if (declarations && declarations.length > 0) {
// Disallow rename for elements that are defined in the standard TypeScript library.
var defaultLibFile = getDefaultLibFileName(host.getCompilationSettings());
for (var i = 0; i < declarations.length; i++) {
var sourceFile = declarations[i].getSourceFile();
if (sourceFile && endsWith(sourceFile.fileName, defaultLibFile)) {
return getRenameInfoError(getLocaleSpecificMessage(Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library.key));
var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings());
if (defaultLibFileName) {
for (var i = 0; i < declarations.length; i++) {
var sourceFile = declarations[i].getSourceFile();
if (sourceFile && getCanonicalFileName(ts.normalizePath(sourceFile.fileName)) === getCanonicalFileName(ts.normalizePath(defaultLibFileName))) {
return getRenameInfoError(getLocaleSpecificMessage(Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library.key));
}
}
}
@ -5566,10 +5568,6 @@ module ts {
return getRenameInfoError(getLocaleSpecificMessage(Diagnostics.You_cannot_rename_this_element.key));
function endsWith(string: string, value: string): boolean {
return string.lastIndexOf(value) + value.length === string.length;
}
function getRenameInfoError(localizedErrorMessage: string): RenameInfo {
return {
canRename: false,

View File

@ -274,10 +274,7 @@ module ts {
}
public getDefaultLibFileName(options: CompilerOptions): string {
// Shim the API changes for 1.5 release. This should be removed once
// TypeScript 1.5 has shipped.
return "";
//return this.shimHost.getDefaultLibFileName(JSON.stringify(options));
return this.shimHost.getDefaultLibFileName(JSON.stringify(options));
}
}