server/src/parser/extractors/SymbolExtractor.tsSymbol Extraction
The first AST traversal pass that walks every source file, extracts named code declarations, preserves nesting hierarchy via the symbol stack, and registers file exports.
server/src/parser/extractors/SymbolExtractor.tsSupported Symbol Kinds
SymbolExtractor maps Babel AST declaration nodes to SymbolKind union members:
| Babel AST Node Type | SymbolKind | Example Syntax | Container Node? |
|---|---|---|---|
| FunctionDeclaration | function | function calculateTotal() {} | Yes |
| ArrowFunctionExpression | function | const handleAuth = () => {} | Yes |
| FunctionExpression | function | const init = function() {} | Yes |
| ClassDeclaration / Expression | class | class AuthService {} | Yes |
| ClassMethod / PrivateMethod | method | login() {} / #privateLog() {} | Yes |
| ObjectMethod | method | const service = { run() {} } | Yes |
| VariableDeclarator | variable | const PORT = 3000 | Yes (if Object) |
| TSInterfaceDeclaration | interface | interface UserRecord {} | No |
| TSTypeAliasDeclaration | typeAlias | type Token = string | No |
| TSEnumDeclaration | enum | enum Status { Active } | No |
| ObjectProperty | objectProperty | const obj = { key: 'val' } | Yes (if Object) |
The `ParsedSymbol` Model
12345678export interface ParsedSymbol { id: string; // Deterministic ID: filePath:startLine:startColumn:name name: string; // Identifier name symbolKind: SymbolKind; // "function" | "method" | "class" | "interface" | ... methodKind?: MethodKind; // "get" | "set" | "method" | "private" location: SymbolLocation; // { startLine, startColumn, endLine, endColumn } parentSymbolId?: string; // ID of enclosing class, function, or object }
Detailed Subtopics
Explore the in-depth mechanics of how each declaration pattern is extracted:
How symbolStack maintains parent-child pointers during recursive traversal.
2.5.2 Functions & Arrow FunctionsFunction declarations, expressions, arrow functions, and double-extraction guards.
2.5.3 Classes & MethodsClass declarations, private class methods (#field), and getters/setters.
2.5.4 Variables & DestructuringIdentifier variables, ObjectPattern aliases, and ArrayPattern unpacking.
2.5.5 TypeScript Type DeclarationsExtraction of interfaces, type aliases, and enums without runtime bindings.
2.5.6 Object Properties & MethodsObject literals, method properties, and nested object hierarchies.