mirror of
https://github.com/safishamsi/graphify.git
synced 2026-09-04 20:55:50 +00:00
tree-sitter-swift parses both `class Foo` and `extension Foo` as `class_declaration`, and node ids carry the file stem, so `extension Foo` in a sibling file produced a second `Foo` node instead of attaching to the original. Same-file extensions already dedupe via seen_ids; only the cross-file case leaked. Per-file extraction now tags `extension` class_declarations, and the corpus-level `extract()` runs a merge pass: when exactly one non-extension declaration shares the label, the extension nodes redirect onto it and their edges are rewritten (self-loops dropped, duplicates collapsed). Extensions of types outside the corpus and ambiguous label matches stay untouched. On a 25-file Swift project this collapses Parser from 6 split nodes (top of the god-node list, four entries) to one canonical node, and lets the generic cross-file call resolver attach previously ambiguous call edges to the right target.