CodeGraph/docs
Section 2.5

Symbol 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.

Source: server/src/parser/extractors/SymbolExtractor.ts

Supported Symbol Kinds

SymbolExtractor maps Babel AST declaration nodes to SymbolKind union members:

Babel AST Node TypeSymbolKindExample SyntaxContainer Node?
FunctionDeclarationfunctionfunction calculateTotal() {}Yes
ArrowFunctionExpressionfunctionconst handleAuth = () => {}Yes
FunctionExpressionfunctionconst init = function() {}Yes
ClassDeclaration / Expressionclassclass AuthService {}Yes
ClassMethod / PrivateMethodmethodlogin() {} / #privateLog() {}Yes
ObjectMethodmethodconst service = { run() {} }Yes
VariableDeclaratorvariableconst PORT = 3000Yes (if Object)
TSInterfaceDeclarationinterfaceinterface UserRecord {}No
TSTypeAliasDeclarationtypeAliastype Token = stringNo
TSEnumDeclarationenumenum Status { Active }No
ObjectPropertyobjectPropertyconst obj = { key: 'val' }Yes (if Object)

The `ParsedSymbol` Model

server/src/parser/models/ParsedSymbol.ts
1
2
3
4
5
6
7
8
export 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: