Fix rename for class expression

This commit is contained in:
Yui T 2015-07-01 13:55:02 -07:00
parent 514d054cac
commit 605ab0b1fc
2 changed files with 13 additions and 19 deletions

View File

@ -5117,10 +5117,10 @@ namespace ts {
* a reference to a symbol can occur anywhere.
*/
function getSymbolScope(symbol: Symbol): Node {
// If this is the symbol of a function expression, then named references
// are limited to its own scope.
// If this is the symbol of a named function expression or named class expression,
// then named references are limited to its own scope.
let valueDeclaration = symbol.valueDeclaration;
if (valueDeclaration && valueDeclaration.kind === SyntaxKind.FunctionExpression) {
if (valueDeclaration && (valueDeclaration.kind === SyntaxKind.FunctionExpression || valueDeclaration.kind === SyntaxKind.ClassExpression)) {
return valueDeclaration;
}

View File

@ -3,13 +3,14 @@
////class Foo {
////}
////
////var x = class /**/Foo {
//////The class expression Foo
////var x = class [|Foo|] {
//// doIt() {
//// return Foo;
//// return [|Foo|];
//// }
////
//// static doItStatically() {
//// return Foo;
//// return [|Foo|].y;
//// }
////}
////
@ -18,17 +19,10 @@
//// return Foo
//// }
////}
////var z = class Foo {}
// TODO (yuit): Fix up this test when class expressions are supported.
// Just uncomment the below, remove the marker, and add the
// appropriate ranges in the test itself.
goTo.marker();
verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false);
////let ranges = test.ranges()
////for (let range of ranges) {
//// goTo.position(range.start);
////
//// verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false);
////}
let ranges = test.ranges()
for (let range of ranges) {
goTo.position(range.start);
verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false);
}