mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-17 10:31:20 -06:00
Fix rename for class expression
This commit is contained in:
parent
514d054cac
commit
605ab0b1fc
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user