mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
fix(51222): Go-to-definition on return statements should jump to the containing function declaration (#51227)
* fix(51222): add go-to-definition return statement to containing function * add additional tests
This commit is contained in:
@@ -26,6 +26,12 @@ namespace ts.GoToDefinition {
|
||||
return label ? [createDefinitionInfoFromName(typeChecker, label, ScriptElementKind.label, node.text, /*containerName*/ undefined!)] : undefined; // TODO: GH#18217
|
||||
}
|
||||
|
||||
if (node.kind === SyntaxKind.ReturnKeyword) {
|
||||
const functionDeclaration = findAncestor(node.parent, n =>
|
||||
isClassStaticBlockDeclaration(n) ? "quit" : isFunctionLikeDeclaration(n)) as FunctionLikeDeclaration;
|
||||
return functionDeclaration ? [createDefinitionFromSignatureDeclaration(typeChecker, functionDeclaration)] : undefined;
|
||||
}
|
||||
|
||||
if (isStaticModifier(node) && isClassStaticBlockDeclaration(node.parent)) {
|
||||
const classDecl = node.parent.parent;
|
||||
const { symbol, failedAliasResolution } = getSymbol(classDecl, typeChecker, stopAtAlias);
|
||||
|
||||
Reference in New Issue
Block a user