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:
@@ -86,6 +86,19 @@ export const javaExtractor: LanguageExtractor = {
|
||||
}
|
||||
return false;
|
||||
},
|
||||
// A `static final` field is a Java constant (`MAX_ITEMS`, lookup tables,
|
||||
// shared config). Drives `constant` kind so value-reference edges target it;
|
||||
// instance / `final`-only / `static`-only fields stay mutable `field`s.
|
||||
isConst: (node) => {
|
||||
for (let i = 0; i < node.childCount; i++) {
|
||||
const child = node.child(i);
|
||||
if (child?.type === 'modifiers') {
|
||||
const text = child.text;
|
||||
return /\bstatic\b/.test(text) && /\bfinal\b/.test(text);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
extractImport: (node, source) => {
|
||||
const importText = source.substring(node.startIndex, node.endIndex).trim();
|
||||
const scopedId = node.namedChildren.find((c: SyntaxNode) => c.type === 'scoped_identifier');
|
||||
|
||||
Reference in New Issue
Block a user