import type { SymbolInfo, SyntaxNode } from '../types.js'; import type { LanguageDefinition } from './types.js'; import type { LanguageTraverser, DeclarationFunctionInfo } from '../traversers/types.js'; import type { LanguageExportExtractor, LanguageImportExtractor, LanguageSymbolExtractor } from '../extractors/types.js'; /** * Kotlin AST traverser. * * Methods live inside `class_declaration` / `object_declaration` bodies * (`class_body` / `enum_class_body`). `companion_object` is transparent — its * members are traversed so their methods are captured (attributed to the * enclosing class). Lambdas can appear in property initializers * (`val f = { … }`). */ export declare class KotlinTraverser implements LanguageTraverser { targetNodeTypes: string[]; containerTypes: string[]; declarationTypes: string[]; functionTypes: string[]; shouldExtractChildren(node: SyntaxNode): boolean; isDeclarationWithFunction(node: SyntaxNode): boolean; getContainerBody(node: SyntaxNode): SyntaxNode | null; shouldTraverseChildren(node: SyntaxNode): boolean; findParentContainerName(node: SyntaxNode): string | undefined; findFunctionInDeclaration(node: SyntaxNode): DeclarationFunctionInfo; } /** * Kotlin export extractor. * * Kotlin has no `export` keyword and is `public` by default — top-level * declarations and (non-private/internal) members are importable. Interface * members are implicitly public. */ export declare class KotlinExportExtractor implements LanguageExportExtractor { extractExports(rootNode: SyntaxNode): string[]; private extractFromNode; private extractMembers; private propertyName; } /** * Kotlin import extractor. * * Handles `import a.b.C`, wildcard `import a.b.*`, and aliased * `import a.b.C as D`. The grammar nests `import_header` nodes inside an * `import_list`; the engine's import scan descends one level to reach them * (see `collectImportNodes` in ast/symbols.ts). Standard-library imports * (kotlin.*, kotlinx.*, java.*, javax.*) are filtered out. * * `extractImportPaths` has no analogue of Java's `staticMemberClassPath` * fallback (#864): a top-level function/property import (`import * a.b.myFunction`, defined in an arbitrarily-named file within package * `a.b`) and a class/object-member import (`import a.b.MyObject.method`) * parse to the identical shape — a flat `identifier` of `simple_identifier` * segments with no distinguishing marker (verified empirically: no * `static`-equivalent keyword, no different node type). Java's fix works * because the `static` keyword's presence is itself the syntactic proof that * the trailing segment is a class member/nested type, not a package * component. Without an equivalent marker here, dropping the trailing * segment can't be told apart from truncating a genuine top-level * declaration down to a bare package directory (a many-files fan-out, the * same false-positive shape #868 warned against) — so this stays an honest, * undetermined gap rather than a guess. */ export declare class KotlinImportExtractor implements LanguageImportExtractor { readonly importNodeTypes: string[]; extractImportPath(node: SyntaxNode): string | null; extractImportPaths(node: SyntaxNode): string[]; processImportSymbols(node: SyntaxNode): { importPath: string; symbols: string[]; } | null; processImportSymbolsList(node: SyntaxNode): Array<{ importPath: string; symbols: string[]; }>; private getImportPath; } /** * Kotlin symbol extractor. * * Handles `function_declaration`, `class_declaration` (class / interface / enum * variants — distinguished by the keyword token), and `object_declaration`. * `SymbolInfo.type` only has `function|method|class|interface`, so objects and * enums map to `class` (keeping the keyword in the signature). * * Call sites: `call_expression` — `foo()` (simple_identifier) and `a.b.c()` * (the member is the `simple_identifier` inside the trailing `navigation_suffix`). */ export declare class KotlinSymbolExtractor implements LanguageSymbolExtractor { readonly symbolNodeTypes: string[]; extractSymbol(node: SyntaxNode, content: string, parentClass?: string): SymbolInfo | null; extractCallSite(node: SyntaxNode): { symbol: string; line: number; key: string; } | null; private extractFunctionInfo; /** * `parentClass` is threaded through so a nested/inner class or object — * idiomatic in Kotlin (`class Outer { class Nested { ... } }`, * `class Outer { inner class Inner { ... } }`) — reports its enclosing * type. `KotlinTraverser.findParentContainerName` already resolves this for * every top-level node, not just functions (#949). */ private extractClassInfo; private extractObjectInfo; private makeSymbol; } export declare const kotlinDefinition: LanguageDefinition; //# sourceMappingURL=kotlin.d.ts.map