Skip to content

Commit 0436791

Browse files
committed
fix(native): align edge builder kind filters with JS parity
The Rust edge builder only matched `kind == "class"` when looking up source nodes and targets for extends/implements edges. This caused all `impl Trait for Struct` relationships (and any non-class hierarchy) to be silently dropped — producing 0 implements edges for Rust sources while WASM correctly found 9. Align the three kind filter sets with the JS-side constants: - Source: class, struct, record, enum (was: class only) - Extends targets: class, struct, trait, record (was: class only) - Implements targets: interface, class, trait (was: interface, class) Fixes #530 (partial — implements parity gap) Impact: 1 functions changed, 0 affected
1 parent f8016c6 commit 0436791

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

crates/codegraph-core/src/edge_builder.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,13 +339,17 @@ pub fn build_call_edges(
339339
for cls in &file_input.classes {
340340
let source_row = nodes_by_name_and_file
341341
.get(&(cls.name.as_str(), rel_path.as_str()))
342-
.and_then(|v| v.iter().find(|n| n.kind == "class"));
342+
.and_then(|v| v.iter().find(|n| {
343+
n.kind == "class" || n.kind == "struct" || n.kind == "record" || n.kind == "enum"
344+
}));
343345

344346
if let Some(source) = source_row {
345347
if let Some(ref extends_name) = cls.extends {
346348
let targets = nodes_by_name
347349
.get(extends_name.as_str())
348-
.map(|v| v.iter().filter(|n| n.kind == "class").collect::<Vec<_>>())
350+
.map(|v| v.iter().filter(|n| {
351+
n.kind == "class" || n.kind == "struct" || n.kind == "trait" || n.kind == "record"
352+
}).collect::<Vec<_>>())
349353
.unwrap_or_default();
350354
for t in targets {
351355
edges.push(ComputedEdge {
@@ -362,7 +366,7 @@ pub fn build_call_edges(
362366
.get(implements_name.as_str())
363367
.map(|v| {
364368
v.iter()
365-
.filter(|n| n.kind == "interface" || n.kind == "class")
369+
.filter(|n| n.kind == "interface" || n.kind == "class" || n.kind == "trait")
366370
.collect::<Vec<_>>()
367371
})
368372
.unwrap_or_default();

0 commit comments

Comments
 (0)