feat: Add Rust trait inheritance and impl block extraction with method receiver type support

Addresses Rust's impl block syntax where trait implementations (`impl Trait for Type`) and trait supertraits (`trait Sub: Super`) create inheritance relationships. Adds getReceiverType to extract method receiver types from impl blocks, enabling proper method-to-struct relationships and qualified name resolution. Verified against Deno codebase and moved from "Needs Verification" to completed language support.
This commit is contained in:
Colby McHenry committed 2026-04-06 21:50:03 -05:00
1 parent ce7b7684db
commit 2d14503258
4 files changed
+243 -7

No files matched your search

+1 -1
View File
@@ -523,12 +523,12 @@ if (receiverType) {
- [x] **Swift** — NOT needed. Tree-sitter nests methods inside class/extension bodies
- [x] **Java** — NOT needed. Methods nested in class body. Verified against Guava
- [x] **Python** — NOT needed. Methods nested in class body. Verified against Flask
- [x] **Rust** — `getReceiverType` walks up to parent `impl_item` to extract type name. Also adds `contains` edges from struct to impl methods. Verified against Deno
### Needs Verification
Check these — may need `getReceiverType` if methods are top-level in the AST:
- [ ] Rust — methods in `impl Type { }` blocks
- [ ] C++ — out-of-class method definitions `Type::method()`
- [ ] Kotlin — extension functions `fun Type.method()`