feat(extraction): same-file value-reference edges for impact analysis — 15 languages (#897)
Adds same-file value-reference edges (reader symbol → const/var it reads) so impact analysis catches a constant's same-file consumers, closing the 'change this table, break its readers' hole. 15 languages validated S/M/L on public OSS: TS/JS/tsx, Go, Python, Rust, Ruby, C, Java, C#, PHP, Scala, Kotlin, Swift, Dart, Pascal/Delphi (+ Svelte/Vue/Astro inherited). Edges-only — node count identical on/off; default ON, CODEGRAPH_VALUE_REFS=0 opts out.
This commit is contained in:
@@ -121,6 +121,22 @@ export const csharpExtractor: LanguageExtractor = {
|
||||
}
|
||||
return false;
|
||||
},
|
||||
// `const` and `static readonly` fields are C# constants (`MaxItems`, lookup
|
||||
// tables, shared config). Drives `constant` kind so value-reference edges
|
||||
// target them; instance `readonly` / plain `static` fields stay `field`s.
|
||||
isConst: (node) => {
|
||||
let hasStatic = false;
|
||||
let hasReadonly = false;
|
||||
for (let i = 0; i < node.childCount; i++) {
|
||||
const child = node.child(i);
|
||||
if (child?.type !== 'modifier') continue;
|
||||
const t = child.text;
|
||||
if (t === 'const') return true;
|
||||
if (t === 'static') hasStatic = true;
|
||||
else if (t === 'readonly') hasReadonly = true;
|
||||
}
|
||||
return hasStatic && hasReadonly;
|
||||
},
|
||||
isAsync: (node) => {
|
||||
for (let i = 0; i < node.childCount; i++) {
|
||||
const child = node.child(i);
|
||||
|
||||
Reference in New Issue
Block a user