Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/services/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7999,7 +7999,7 @@ namespace ts {

// Can only rename an identifier.
if (node) {
if (node.kind === SyntaxKind.Identifier ||
if ((node.kind === SyntaxKind.Identifier && (node as Identifier).originalKeywordKind !== SyntaxKind.ThisKeyword) ||
Copy link
Contributor

@mhegazy mhegazy Jun 15, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't this block renaming this:

var x = {
    this: 0
};
x.this;

node.kind === SyntaxKind.StringLiteral ||
isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) {
const symbol = typeChecker.getSymbolAtLocation(node);
Expand Down
6 changes: 6 additions & 0 deletions tests/cases/fourslash/noRenameOfThisParameter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/// <reference path="fourslash.ts" />
////function f(this/**/: string, x: number) {
//// return this.length + x;
////}
goTo.marker();
verify.renameInfoFailed();