Skip to content

Commit 232b322

Browse files
committed
Merge pull request #6904 from Microsoft/port6632
Port6632
2 parents 6975e44 + 85bb1e8 commit 232b322

9 files changed

+110
-0
lines changed

src/compiler/checker.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15366,6 +15366,20 @@ namespace ts {
1536615366
return getSymbolOfNode(entityName.parent);
1536715367
}
1536815368

15369+
if (isInJavaScriptFile(entityName) && entityName.parent.kind === SyntaxKind.PropertyAccessExpression) {
15370+
const specialPropertyAssignmentKind = getSpecialPropertyAssignmentKind(entityName.parent.parent);
15371+
switch (specialPropertyAssignmentKind) {
15372+
case SpecialPropertyAssignmentKind.ExportsProperty:
15373+
case SpecialPropertyAssignmentKind.PrototypeProperty:
15374+
return getSymbolOfNode(entityName.parent);
15375+
case SpecialPropertyAssignmentKind.ThisProperty:
15376+
case SpecialPropertyAssignmentKind.ModuleExports:
15377+
return getSymbolOfNode(entityName.parent.parent);
15378+
default:
15379+
// Fall through if it is not a special property assignment
15380+
}
15381+
}
15382+
1536915383
if (entityName.parent.kind === SyntaxKind.ExportAssignment) {
1537015384
return resolveEntityName(<Identifier>entityName,
1537115385
/*all meanings*/ SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Alias);
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/// <reference path='fourslash.ts'/>
2+
3+
// @allowJs: true
4+
// @Filename: a.js
5+
////exports.[|area|] = function (r) { return r * r; }
6+
7+
// @Filename: b.ts
8+
////import { [|area|] } from './a';
9+
////var t = /**/[|area|](10);
10+
11+
goTo.marker();
12+
verify.renameLocations( /*findInStrings*/ false, /*findInComments*/ false);
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/// <reference path='fourslash.ts'/>
2+
3+
// @allowJs: true
4+
// @Filename: a.js
5+
////exports./**/[|area|] = function (r) { return r * r; }
6+
7+
// @Filename: b.ts
8+
////import { [|area|] } from './a';
9+
////var t = [|area|](10);
10+
11+
goTo.marker();
12+
verify.renameLocations( /*findInStrings*/ false, /*findInComments*/ false);
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/// <reference path='fourslash.ts'/>
2+
3+
// @allowJs: true
4+
// @Filename: a.js
5+
////exports.[|area|] = function (r) { return r * r; }
6+
7+
// @Filename: b.js
8+
////var mod = require('./a');
9+
////var t = mod./**/[|area|](10);
10+
11+
goTo.marker();
12+
verify.renameLocations( /*findInStrings*/ false, /*findInComments*/ false);
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/// <reference path='fourslash.ts'/>
2+
3+
// @allowJs: true
4+
// @Filename: a.js
5+
////exports./**/[|area|] = function (r) { return r * r; }
6+
7+
// @Filename: b.js
8+
////var mod = require('./a');
9+
////var t = mod.[|area|](10);
10+
11+
goTo.marker();
12+
verify.renameLocations( /*findInStrings*/ false, /*findInComments*/ false);
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/// <reference path='fourslash.ts'/>
2+
3+
// @allowJs: true
4+
// @Filename: a.js
5+
////function bar() {
6+
////}
7+
////bar.prototype.[|x|] = 10;
8+
////var t = new bar();
9+
////t./**/[|x|] = 11;
10+
11+
goTo.marker();
12+
verify.renameLocations( /*findInStrings*/ false, /*findInComments*/ false);
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/// <reference path='fourslash.ts'/>
2+
3+
// @allowJs: true
4+
// @Filename: a.js
5+
////function bar() {
6+
////}
7+
////bar.prototype./**/[|x|] = 10;
8+
////var t = new bar();
9+
////t.[|x|] = 11;
10+
11+
goTo.marker();
12+
verify.renameLocations( /*findInStrings*/ false, /*findInComments*/ false);
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/// <reference path='fourslash.ts'/>
2+
3+
// @allowJs: true
4+
// @Filename: a.js
5+
////function bar() {
6+
//// this.[|x|] = 10;
7+
////}
8+
////var t = new bar();
9+
////t./**/[|x|] = 11;
10+
11+
goTo.marker();
12+
verify.renameLocations( /*findInStrings*/ false, /*findInComments*/ false);
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/// <reference path='fourslash.ts'/>
2+
3+
// @allowJs: true
4+
// @Filename: a.js
5+
////function bar() {
6+
//// this./**/[|x|] = 10;
7+
////}
8+
////var t = new bar();
9+
////t.[|x|] = 11;
10+
11+
goTo.marker();
12+
verify.renameLocations( /*findInStrings*/ false, /*findInComments*/ false);

0 commit comments

Comments
 (0)