Handle export keyword of export assignment

This commit is contained in:
Sheetal Nandi 2019-06-06 09:09:39 -07:00
parent 64de998356
commit e4a2dd510f
3 changed files with 8 additions and 11 deletions

View file

@ -74,15 +74,12 @@ namespace ts.FindAllReferences {
undefined;
}
if (isConstructorDeclaration(node.parent) ||
node.parent.name === node || // node is name of declaration, use parent
if (node.parent.name === node || // node is name of declaration, use parent
isConstructorDeclaration(node.parent) ||
isExportAssignment(node.parent) ||
// Property name of the import export specifier or binding pattern, use parent
((isImportOrExportSpecifier(node.parent) || isBindingElement(node.parent))
&& node.parent.propertyName === node) ||
isExportAssignment(node.parent) && (
node.parent.expression === node ||
(!node.parent.isExportEquals && node.kind === SyntaxKind.DefaultKeyword)
) ||
// Is default export
(node.kind === SyntaxKind.DefaultKeyword && hasModifier(node.parent, ModifierFlags.ExportDefault))) {
return getDeclarationForDeclarationSpan(node.parent);

View file

@ -1,13 +1,13 @@
/// <reference path='fourslash.ts' />
// @Filename: /a.ts
////type [|{| "isWriteAccess": true, "isDefinition": true |}T|] = number;
////[|export|] = [|T|];
////[|type [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}T|] = number;|]
////[|[|{| "declarationRangeIndex": 2 |}export|] = [|{| "declarationRangeIndex": 2 |}T|];|]
// @Filename: /b.ts
////import [|{| "isWriteAccess": true, "isDefinition": true |}T|] = require("[|./a|]");
////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 5 |}T|] = require("[|./a|]");|]
const [r0, r1, r2, r3, r4] = test.ranges();
const [r0Def, r0, r12Def, r1, r2, r3Def, r3, r4] = test.ranges();
const mod = { definition: 'module "/a"', ranges: [r4, r1] };
const a = { definition: "type T = number", ranges: [r0, r2] };
const b = { definition: '(alias) type T = number\nimport T = require("./a")', ranges: [r3] };

View file

@ -5,7 +5,7 @@
////[|namespace [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}T|] {
//// export type U = string;
////}|]
////[|[|export|] = [|{| "declarationRangeIndex": 4 |}T|];|]
////[|[|{| "declarationRangeIndex": 4 |}export|] = [|{| "declarationRangeIndex": 4 |}T|];|]
// @Filename: /b.ts
////const x: import("[|./[|a|]|]") = 0;