Export assignment identifier use ExportAssigment as declaration

This commit is contained in:
Sheetal Nandi 2019-05-31 10:36:58 -07:00
parent 2fc1143fe7
commit 15ce996cf5
3 changed files with 14 additions and 12 deletions

View File

@ -41,13 +41,15 @@ namespace ts.FindAllReferences {
// TODO(shkamat)::
// JSXOpeningElement or JSXElement for tagName ?
if (!node.parent || !isDeclaration(node.parent)) {
if (!node.parent || (!isDeclaration(node.parent) && !isExportAssignment(node.parent))) {
return undefined;
}
if (node.parent.name === node || // node is name of declaration, use parent
// Property name of the import export specifier use import/export specifier
isImportOrExportSpecifier(node.parent) && node.parent.propertyName === node) {
isImportOrExportSpecifier(node.parent) && node.parent.propertyName === node ||
// Is assignment of export assignment
isExportAssignment(node.parent) && node.parent.expression === node) {
return getDeclarationForDeclarationSpan(node.parent);
}

View File

@ -2,17 +2,17 @@
// @Filename: /a.ts
////export { default } from "./b";
////export { default as [|b|] } from "./b";
////[|export { default as [|{| "declarationRangeIndex": 0 |}b|] } from "./b";|]
////export { default as bee } from "./b";
////import { default as [|b|] } from "./b";
////[|import { default as [|{| "declarationRangeIndex": 2 |}b|] } from "./b";|]
////import { default as bee } from "./b";
////import [|b|] from "./b";
////[|import [|{| "declarationRangeIndex": 4 |}b|] from "./b";|]
// @Filename: /b.ts
////const [|b|] = 0;
////export default [|b|];
////[|const [|{| "declarationRangeIndex": 6 |}b|] = 0;|]
////[|export default [|{| "declarationRangeIndex": 8 |}b|];|]
const [r0, r1, r2, r3, r4] = test.ranges();
const [r0Def, r0, r1Def, r1, r2Def, r2, r3Def, r3, r4Def, r4] = test.ranges();
verify.renameLocations(r0, [r0]);
verify.renameLocations(r1, [r1]);
verify.renameLocations(r2, [r2]);

View File

@ -3,20 +3,20 @@
// @Filename: a.ts
////[|class [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}A|] {
////}|]
////export = [|A|];
////[|export = [|{| "declarationRangeIndex": 2 |}A|];|]
// @Filename: b.ts
////[|export import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 3 |}b|] = require('./a');|]
////[|export import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}b|] = require('./a');|]
// @Filename: c.ts
////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 5 |}b|] = require('./b');|]
////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 6 |}b|] = require('./b');|]
////var a = new [|b|]./**/[|b|]();
goTo.marker();
verify.quickInfoExists();
verify.noErrors();
const [a0Def, a0, a1, b0Def, b0, c0Def, c0, c1, c2] = test.ranges();
const [a0Def, a0, a1Def, a1, b0Def, b0, c0Def, c0, c1, c2] = test.ranges();
const aRanges = [a0, a1];
const bRanges = [b0, c2];
const cRanges = [c0, c1];