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'; /** * C# AST traverser * * C# has a class-based container structure similar to Java, with methods * inside class, interface, struct, record, and enum declarations. Unlike Java, * C# has namespaces that can nest declarations, and uses `declaration_list` * as the unified body node type for all containers. * * Lambda expressions can appear in variable declarations: * Action a = () => { ... }; * * `property_declaration` and `indexer_declaration` are target nodes too * (issue #871): properties are C#'s dominant public-API idiom (auto-props, * expression-bodied props, DTO/POCO surfaces), and without a dedicated chunk * per property, `api-delta`/`get_dependents`/`list_functions` are structurally * blind to a property being removed or changing type. Chunked as * `symbolType: 'method'` (see `extractPropertyInfo`) rather than a new * `'property'` symbolType — no language emits `'property'` today, and adding * one would ripple into `signature-delta.ts`, `complexity-delta.ts`, risk * scoring, and formatters for a single language's gap. Record primary- * constructor properties (`record Person(string Name)`) are NOT covered: * the grammar represents them as plain `parameter` nodes inside the record's * `parameter_list`, not `property_declaration` — a different, out-of-scope * node shape. */ export declare class CSharpTraverser 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; } /** * C# export extractor * * C# uses the `public` modifier for visibility — public declarations are * accessible outside the assembly. Unlike Java's `modifiers` wrapper node, * C# has individual `modifier` nodes as direct children of declarations. * * Exportable items: * - public class User {} * - public struct Point {} * - public interface IRepository {} * - public enum Status {} * - public record Person(string Name) {} * - public void Method() {} (inside a class) * - Interface methods are implicitly public * - public string Name { get; set; } (property) * * Internal (default access) declarations are NOT exported. */ export declare class CSharpExportExtractor implements LanguageExportExtractor { extractExports(rootNode: SyntaxNode): string[]; private walkDeclarations; private extractFromNode; private extractPublicMembers; private extractMemberExport; private extractFieldNames; } /** * C# import extractor * * Handles all C# using patterns: * - using Newtonsoft.Json; (regular using) * - using static MyLib.Utils; (static using) * - using Json = Newtonsoft.Json; (alias using) * - global using Newtonsoft.Json; (global using — see isGlobalUsingDirective) * * Standard library usings (System.*, Microsoft.*) are filtered out. */ export declare class CSharpImportExtractor 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; } /** * C# symbol extractor * * Handles: * - method_declaration (public void Method() {}) * - constructor_declaration (public MyClass() {}) * - class_declaration (class MyClass {}) * - interface_declaration (interface IMyInterface {}) * - struct_declaration (struct MyStruct {}) * - record_declaration (record MyRecord(int X) {}) * - enum_declaration (enum MyEnum {}) * - property_declaration (public string Name { get; set; } / public int Count => …) * - indexer_declaration (public int this[int index] { get; set; }) * * `parentClass` is threaded into every type-declaration handler (not just * methods/properties) so a nested type (`public class Retrofit { public class * Builder { ... } }`) reports its enclosing type — the chunker * (`ast/chunker.ts`'s `processTopLevelNode`) already resolves this via * `CSharpTraverser.findParentContainerName` for every top-level node * regardless of kind; previously only the method/property handlers accepted * the parameter, so a nested class/interface/struct/record/enum silently lost * it (#949 — surfaced as `list_functions` being unable to tell one nested * `Builder` from an unrelated same-named nested `Builder` elsewhere in the * codebase). * * Call sites: invocation_expression (direct calls and obj.Method() calls) */ export declare class CSharpSymbolExtractor 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 extractMethodInfo; private extractConstructorInfo; /** * Extract a property or indexer as a `method`-typed symbol (Route A, * issue #871 — see the rationale on `CSharpTraverser`). An indexer has no * `name` field in the grammar (it's accessed via `this[...]`), so it is * named literally `this`; C# forbids more than one indexer sharing a * parameter signature, so this can't collide the way an overload-set * already doesn't (same positional-pairing behavior as method overloads). * * The signature is built (not reused from `extractSignature`, which * bounds itself on a `body` field that property/indexer nodes don't have) * from the declaration head plus a normalized accessor shape, so a type * change or accessor added/removed is a real signature change, but editing * an expression-bodied getter's expression is not — mirroring how a * method's body is excluded from its own signature. */ private extractPropertyInfo; private extractClassInfo; private extractInterfaceInfo; private extractStructInfo; private extractRecordInfo; private extractEnumInfo; } export declare const csharpDefinition: LanguageDefinition; //# sourceMappingURL=csharp.d.ts.map