feat(kernel): R7b C# walker — csharp module, tree-sitter-c-sharp 0.23.5 pin, csharp default-routed (#1378)

Second R7b port, checklist-first recipe (docs/design/csharp-kernel-port-checklist.md;
parity passed FIRST RUN again). No grammar bump — the #717 vendored wasm verified
table-identical to crate 0.23.5 (ABI 15, STATE_COUNT 8053, node-kind + field tables);
first port with no grammar-prep step. The #237 #if-blanking preParse stays TS-side
via the existing route-point hoist.

Walker preserves bug-for-bug: the single-namespace-node quirks (second namespace
nests under the first, nested namespaces leave no trace, import refs hang off the
namespace node), raw member-access callee texts (this./base./literal receivers,
multi-line fluent chains) with unconditional chain re-encode, deliberate emission
holes (property accessor/expression bodies, ctor initializers, delegates/events/
operators/indexers/local functions, top-level locals), garbage extends refs
((repo) primary-ctor args, BaseDto(Name) record bases, enum : byte), the alias-
import moduleName quirks, nameof-as-call, CSHARP fn-ref spec (+= subscription,
this.X bare-name form, argument layer, initializer lists), C# type-ref engine
(nested-generic returnType failure included), and value-ref shadow pruning.

Gates: sweeps 0-diff serilog 211/216 / Newtonsoft.Json 914/945 / jellyfin
2104/2105 (deferrals match the survey's per-repo predictions — both-arm #if
damage; default --max-deferral 0.1 holds, no c/cpp exemption); full-init dumps
byte-identical ×3 (14.0k/109.1k/210.8k lines); kernel-csharp-parity suite
(torture ×3 + CRLF variants + 8 micro-pins + defer) + csharp grammar-parity row;
full suite 2,608 ×2 under CODEGRAPH_KERNEL_EXPECT=1. DEFAULT_ROUTED += csharp
(11 langs).

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Colby Mchenry
2026-07-20 13:46:12 -05:00
committed by GitHub
co-authored by Claude Fable 5
parent f1ca991943
commit 286e9ccc2d
15 changed files with 2890 additions and 6 deletions
File diff suppressed because it is too large Load Diff
+5 -2
View File
@@ -15,8 +15,8 @@ use tree_sitter::Language;
/// Languages this kernel binary can extract (reported by contractInfo;
/// TS-side routing policy decides what actually routes).
pub const LANGUAGES: [&str; 10] =
["typescript", "tsx", "javascript", "jsx", "java", "python", "go", "c", "cpp", "rust"];
pub const LANGUAGES: [&str; 11] =
["typescript", "tsx", "javascript", "jsx", "java", "python", "go", "c", "cpp", "rust", "csharp"];
pub fn grammar_for(language: &str) -> Option<Language> {
match language {
@@ -33,6 +33,9 @@ pub fn grammar_for(language: &str) -> Option<Language> {
"cpp" => Some(tree_sitter_cpp::LANGUAGE.into()),
// R7b: v0.24.2, sha-matched with the vendored wasm (grammars.ts).
"rust" => Some(tree_sitter_rust::LANGUAGE.into()),
// R7b: 0.23.5, table-identical to the vendored ABI-15 wasm (#717;
// verified against the crates.io tarball — csharp checklist header).
"csharp" => Some(tree_sitter_c_sharp::LANGUAGE.into()),
_ => None,
}
}
+2
View File
@@ -19,6 +19,7 @@
mod buffers;
mod ccpp;
mod cfnptr;
mod csharp;
mod docstring;
mod ids;
mod go;
@@ -213,6 +214,7 @@ pub fn extract_file(file_path: String, content: String, language: String) -> Res
"go" => go::extract(&file_path, &content).map_err(Error::from_reason)?,
"c" | "cpp" => ccpp::extract(&file_path, &content, &language).map_err(Error::from_reason)?,
"rust" => rustlang::extract(&file_path, &content).map_err(Error::from_reason)?,
"csharp" => csharp::extract(&file_path, &content).map_err(Error::from_reason)?,
_ => tsjs::extract(&file_path, &content, &language).map_err(Error::from_reason)?,
};
Ok(ExtractBuffers {