mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-26 10:43:51 -05:00
More thoroughly test navigateTo (#25239)
* More thoroughly test navigateTo * Fix #25233 and #25237 * Update API (#24966)
This commit is contained in:
@@ -4866,14 +4866,9 @@ namespace ts {
|
||||
return !!(node as NamedDeclaration).name; // A 'name' property should always be a DeclarationName.
|
||||
}
|
||||
|
||||
export function getNameOfDeclaration(declaration: Declaration | Expression): DeclarationName | undefined {
|
||||
/** @internal */
|
||||
export function getNonAssignedNameOfDeclaration(declaration: Declaration | Expression): DeclarationName | undefined {
|
||||
switch (declaration.kind) {
|
||||
case SyntaxKind.ClassExpression:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
if (!(declaration as ClassExpression | FunctionExpression).name) {
|
||||
return getAssignedName(declaration);
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.Identifier:
|
||||
return declaration as Identifier;
|
||||
case SyntaxKind.JSDocPropertyTag:
|
||||
@@ -4906,6 +4901,12 @@ namespace ts {
|
||||
return (declaration as NamedDeclaration).name;
|
||||
}
|
||||
|
||||
export function getNameOfDeclaration(declaration: Declaration | Expression): DeclarationName | undefined {
|
||||
if (declaration === undefined) return undefined;
|
||||
return getNonAssignedNameOfDeclaration(declaration) ||
|
||||
(isFunctionExpression(declaration) || isClassExpression(declaration) ? getAssignedName(declaration) : undefined);
|
||||
}
|
||||
|
||||
function getAssignedName(node: Node): DeclarationName | undefined {
|
||||
if (!node.parent) {
|
||||
return undefined;
|
||||
|
||||
Reference in New Issue
Block a user