mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-10 06:41:59 -06:00
commit
232b322e14
@ -15366,6 +15366,20 @@ namespace ts {
|
||||
return getSymbolOfNode(entityName.parent);
|
||||
}
|
||||
|
||||
if (isInJavaScriptFile(entityName) && entityName.parent.kind === SyntaxKind.PropertyAccessExpression) {
|
||||
const specialPropertyAssignmentKind = getSpecialPropertyAssignmentKind(entityName.parent.parent);
|
||||
switch (specialPropertyAssignmentKind) {
|
||||
case SpecialPropertyAssignmentKind.ExportsProperty:
|
||||
case SpecialPropertyAssignmentKind.PrototypeProperty:
|
||||
return getSymbolOfNode(entityName.parent);
|
||||
case SpecialPropertyAssignmentKind.ThisProperty:
|
||||
case SpecialPropertyAssignmentKind.ModuleExports:
|
||||
return getSymbolOfNode(entityName.parent.parent);
|
||||
default:
|
||||
// Fall through if it is not a special property assignment
|
||||
}
|
||||
}
|
||||
|
||||
if (entityName.parent.kind === SyntaxKind.ExportAssignment) {
|
||||
return resolveEntityName(<Identifier>entityName,
|
||||
/*all meanings*/ SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Alias);
|
||||
|
||||
12
tests/cases/fourslash/renameCrossJsTs01.ts
Normal file
12
tests/cases/fourslash/renameCrossJsTs01.ts
Normal file
@ -0,0 +1,12 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @allowJs: true
|
||||
// @Filename: a.js
|
||||
////exports.[|area|] = function (r) { return r * r; }
|
||||
|
||||
// @Filename: b.ts
|
||||
////import { [|area|] } from './a';
|
||||
////var t = /**/[|area|](10);
|
||||
|
||||
goTo.marker();
|
||||
verify.renameLocations( /*findInStrings*/ false, /*findInComments*/ false);
|
||||
12
tests/cases/fourslash/renameCrossJsTs02.ts
Normal file
12
tests/cases/fourslash/renameCrossJsTs02.ts
Normal file
@ -0,0 +1,12 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @allowJs: true
|
||||
// @Filename: a.js
|
||||
////exports./**/[|area|] = function (r) { return r * r; }
|
||||
|
||||
// @Filename: b.ts
|
||||
////import { [|area|] } from './a';
|
||||
////var t = [|area|](10);
|
||||
|
||||
goTo.marker();
|
||||
verify.renameLocations( /*findInStrings*/ false, /*findInComments*/ false);
|
||||
12
tests/cases/fourslash/renameJsExports01.ts
Normal file
12
tests/cases/fourslash/renameJsExports01.ts
Normal file
@ -0,0 +1,12 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @allowJs: true
|
||||
// @Filename: a.js
|
||||
////exports.[|area|] = function (r) { return r * r; }
|
||||
|
||||
// @Filename: b.js
|
||||
////var mod = require('./a');
|
||||
////var t = mod./**/[|area|](10);
|
||||
|
||||
goTo.marker();
|
||||
verify.renameLocations( /*findInStrings*/ false, /*findInComments*/ false);
|
||||
12
tests/cases/fourslash/renameJsExports02.ts
Normal file
12
tests/cases/fourslash/renameJsExports02.ts
Normal file
@ -0,0 +1,12 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @allowJs: true
|
||||
// @Filename: a.js
|
||||
////exports./**/[|area|] = function (r) { return r * r; }
|
||||
|
||||
// @Filename: b.js
|
||||
////var mod = require('./a');
|
||||
////var t = mod.[|area|](10);
|
||||
|
||||
goTo.marker();
|
||||
verify.renameLocations( /*findInStrings*/ false, /*findInComments*/ false);
|
||||
12
tests/cases/fourslash/renameJsPrototypeProperty01.ts
Normal file
12
tests/cases/fourslash/renameJsPrototypeProperty01.ts
Normal file
@ -0,0 +1,12 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @allowJs: true
|
||||
// @Filename: a.js
|
||||
////function bar() {
|
||||
////}
|
||||
////bar.prototype.[|x|] = 10;
|
||||
////var t = new bar();
|
||||
////t./**/[|x|] = 11;
|
||||
|
||||
goTo.marker();
|
||||
verify.renameLocations( /*findInStrings*/ false, /*findInComments*/ false);
|
||||
12
tests/cases/fourslash/renameJsPrototypeProperty02.ts
Normal file
12
tests/cases/fourslash/renameJsPrototypeProperty02.ts
Normal file
@ -0,0 +1,12 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @allowJs: true
|
||||
// @Filename: a.js
|
||||
////function bar() {
|
||||
////}
|
||||
////bar.prototype./**/[|x|] = 10;
|
||||
////var t = new bar();
|
||||
////t.[|x|] = 11;
|
||||
|
||||
goTo.marker();
|
||||
verify.renameLocations( /*findInStrings*/ false, /*findInComments*/ false);
|
||||
12
tests/cases/fourslash/renameJsThisProperty01.ts
Normal file
12
tests/cases/fourslash/renameJsThisProperty01.ts
Normal file
@ -0,0 +1,12 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @allowJs: true
|
||||
// @Filename: a.js
|
||||
////function bar() {
|
||||
//// this.[|x|] = 10;
|
||||
////}
|
||||
////var t = new bar();
|
||||
////t./**/[|x|] = 11;
|
||||
|
||||
goTo.marker();
|
||||
verify.renameLocations( /*findInStrings*/ false, /*findInComments*/ false);
|
||||
12
tests/cases/fourslash/renameJsThisProperty02.ts
Normal file
12
tests/cases/fourslash/renameJsThisProperty02.ts
Normal file
@ -0,0 +1,12 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @allowJs: true
|
||||
// @Filename: a.js
|
||||
////function bar() {
|
||||
//// this./**/[|x|] = 10;
|
||||
////}
|
||||
////var t = new bar();
|
||||
////t.[|x|] = 11;
|
||||
|
||||
goTo.marker();
|
||||
verify.renameLocations( /*findInStrings*/ false, /*findInComments*/ false);
|
||||
Loading…
x
Reference in New Issue
Block a user