feat: Add TypeScript abstract class extraction and fix arrow function naming

Addresses TypeScript abstract classes missing by adding abstract_class_declaration to classTypes. Fixes single-expression arrow functions being silently dropped by preventing extractName from searching identifiers in arrow_function/function_expression bodies, ensuring they return  for proper parent name resolution instead of incorrectly using body identifiers.
This commit is contained in:
Colby McHenry
2026-04-07 09:57:51 -05:00
parent 49e670c223
commit afcb9fa3e5
3 changed files with 12 additions and 5 deletions
+8
View File
@@ -70,6 +70,14 @@ function extractName(node: SyntaxNode, source: string, extractor: LanguageExtrac
}
}
// Arrow/function expressions get their name from the parent variable_declarator,
// not from identifiers in their body. Without this, single-expression arrow
// functions like `const fn = () => someIdentifier` get named "someIdentifier"
// instead of "fn", because the fallback below finds the body identifier.
if (node.type === 'arrow_function' || node.type === 'function_expression') {
return '<anonymous>';
}
// Fall back to first identifier child
for (let i = 0; i < node.namedChildCount; i++) {
const child = node.namedChild(i);