You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
One table-driven enclosing-scope and in-file test-scope walker instead of per-language copies #356
Part of the language-architecture cleanup tracked in #354 ("common stays common").
Problem. The same idea is written once per language in src/ingest_names.h:
enclosing scope: rustEnclosingScopeOf and kotlinEnclosingScopeOf are near-copies of the generic enclosingScopeOf (0.82 similar by ripwire --clones);
in-file test scope: four parallel *InFileTestScope functions (C#, JS, Python, Rust).
Change. One table-driven walker for each: a small constexpr per-language table (node kinds that open a scope, how the scope name is read, which nodes mark a test scope) and one function that reads it. The style rule is CONTRIBUTING §3, "Declarative constexpr tables over scattered switch/if".
Acceptance. Output byte-identical on every language (existing gates + a before/after map); ripwire --clones no longer reports the group; no new per-language functions.
Size: about a day. A good way to learn the ingest pipeline. Comment here to claim it.
I'd like to take the enclosing-scope half of this (9a). The in-file test-scope half stays open for someone else.
I have it working locally. Kotlin's walker becomes one row in a small constexpr table ({Lang, owner kinds, name kind}), read by one positional walk. The definition pass looks its language up in the table instead of testing le.lang == Lang::Kotlin, so kotlinEnclosingScopeOf goes away and the ratchet in test/langidentity/ratchet.tsv drops from 352 to 351.
What I ran:
langidentitycheck.sh, main 1bcb6540 against the branch, on the Kotlin fixtures plus square/okio, with ripwire's own src/ as a C++ control: 114 argv, all SAME
kotlincheck.sh: passes
--clones on src/: both 0.82 pairs with kotlinEnclosingScopeOf are gone, and the new walk is in no other group
I left rustEnclosingScopeOf and the generic enclosingScopeOf as they are. Rust reads type:/name: fields, has the includeModules mode for Self:: and cleans up the path text, so I don't think a positional row fits it. And once the Kotlin copy is gone, --clones doesn't pair it with the generic walker anymore. Is that fine with you, or do you want both in the same table anyway? I can try it if you prefer, I'm just not sure it would make the code smaller.
The reason I started here: the OCaml definitions PR for #377 needs the same walk for module scopes, and with this in, OCaml is a second row instead of a new branch.
Activity
gounthar commentedon Oct 16, 2026
I'd like to take the enclosing-scope half of this (9a). The in-file test-scope half stays open for someone else.
I have it working locally. Kotlin's walker becomes one row in a small
constexprtable ({Lang, owner kinds, name kind}), read by one positional walk. The definition pass looks its language up in the table instead of testingle.lang == Lang::Kotlin, sokotlinEnclosingScopeOfgoes away and the ratchet intest/langidentity/ratchet.tsvdrops from 352 to 351.What I ran:
langidentitycheck.sh, main1bcb6540against the branch, on the Kotlin fixtures plus square/okio, with ripwire's ownsrc/as a C++ control: 114 argv, all SAMEkotlincheck.sh: passes--clonesonsrc/: both 0.82 pairs withkotlinEnclosingScopeOfare gone, and the new walk is in no other groupI left
rustEnclosingScopeOfand the genericenclosingScopeOfas they are. Rust readstype:/name:fields, has theincludeModulesmode forSelf::and cleans up the path text, so I don't think a positional row fits it. And once the Kotlin copy is gone,--clonesdoesn't pair it with the generic walker anymore. Is that fine with you, or do you want both in the same table anyway? I can try it if you prefer, I'm just not sure it would make the code smaller.The reason I started here: the OCaml definitions PR for #377 needs the same walk for
modulescopes, and with this in, OCaml is a second row instead of a new branch.