mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-24 11:43:18 -05:00
fix(35043): TS Server: references does not mark isDefinition o… (#36051)
This commit is contained in:
committed by
Daniel Rosenwasser
parent
ce4c4b6183
commit
94e8db7e07
@@ -337,9 +337,7 @@ namespace ts.FindAllReferences {
|
||||
return {
|
||||
...documentSpan,
|
||||
isWriteAccess: isWriteAccessForReference(node),
|
||||
isDefinition: node.kind === SyntaxKind.DefaultKeyword
|
||||
|| !!getDeclarationFromName(node)
|
||||
|| isLiteralComputedPropertyDeclarationName(node),
|
||||
isDefinition: isDefinitionForReference(node),
|
||||
isInString: kind === EntryKind.StringLiteral ? true : undefined,
|
||||
};
|
||||
}
|
||||
@@ -470,6 +468,13 @@ namespace ts.FindAllReferences {
|
||||
return !!decl && declarationIsWriteAccess(decl) || node.kind === SyntaxKind.DefaultKeyword || isWriteAccess(node);
|
||||
}
|
||||
|
||||
function isDefinitionForReference(node: Node): boolean {
|
||||
return node.kind === SyntaxKind.DefaultKeyword
|
||||
|| !!getDeclarationFromName(node)
|
||||
|| isLiteralComputedPropertyDeclarationName(node)
|
||||
|| (node.kind === SyntaxKind.ConstructorKeyword && isConstructorDeclaration(node.parent));
|
||||
}
|
||||
|
||||
/**
|
||||
* True if 'decl' provides a value, as in `function f() {}`;
|
||||
* false if 'decl' is just a location for a future write, as in 'let x;'
|
||||
|
||||
Reference in New Issue
Block a user