Skip to content

Commit 47404bc

Browse files
committed
Merge branch 'master' of https://github.com/Microsoft/TypeScript into esSymbols
2 parents dd6a129 + 9788acf commit 47404bc

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

Diff for: src/services/services.ts

+7-9
Original file line numberDiff line numberDiff line change
@@ -5540,11 +5540,13 @@ module ts {
55405540
var declarations = symbol.getDeclarations();
55415541
if (declarations && declarations.length > 0) {
55425542
// Disallow rename for elements that are defined in the standard TypeScript library.
5543-
var defaultLibFile = getDefaultLibFileName(host.getCompilationSettings());
5544-
for (var i = 0; i < declarations.length; i++) {
5545-
var sourceFile = declarations[i].getSourceFile();
5546-
if (sourceFile && endsWith(sourceFile.fileName, defaultLibFile)) {
5547-
return getRenameInfoError(getLocaleSpecificMessage(Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library.key));
5543+
var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings());
5544+
if (defaultLibFileName) {
5545+
for (var i = 0; i < declarations.length; i++) {
5546+
var sourceFile = declarations[i].getSourceFile();
5547+
if (sourceFile && getCanonicalFileName(ts.normalizePath(sourceFile.fileName)) === getCanonicalFileName(ts.normalizePath(defaultLibFileName))) {
5548+
return getRenameInfoError(getLocaleSpecificMessage(Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library.key));
5549+
}
55485550
}
55495551
}
55505552

@@ -5566,10 +5568,6 @@ module ts {
55665568

55675569
return getRenameInfoError(getLocaleSpecificMessage(Diagnostics.You_cannot_rename_this_element.key));
55685570

5569-
function endsWith(string: string, value: string): boolean {
5570-
return string.lastIndexOf(value) + value.length === string.length;
5571-
}
5572-
55735571
function getRenameInfoError(localizedErrorMessage: string): RenameInfo {
55745572
return {
55755573
canRename: false,

Diff for: src/services/shims.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,7 @@ module ts {
274274
}
275275

276276
public getDefaultLibFileName(options: CompilerOptions): string {
277-
// Shim the API changes for 1.5 release. This should be removed once
278-
// TypeScript 1.5 has shipped.
279-
return "";
280-
//return this.shimHost.getDefaultLibFileName(JSON.stringify(options));
277+
return this.shimHost.getDefaultLibFileName(JSON.stringify(options));
281278
}
282279
}
283280

0 commit comments

Comments
 (0)