mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-10-29 06:32:28 +00:00
fix(rust): capture abstract trait methods for scope resolution
fn foo(&self) -> T; (no body) parses as function_signature_item, a grammar node distinct from function_item that RUST_SCOPE_QUERY never captured. An abstract trait method therefore had no Function scope and no declaration, so populateClassOwnedMembers never wired its ownerId to the trait's Class scope — invisible to the CALLS-edge receiver-bound resolution pass even after a receiver's type resolves to the trait correctly. Together with the previous commit's dyn-stripping fix, a call through a &dyn Trait parameter now emits a CALLS edge to the trait's method (#2604).
This commit is contained in:
parent
a7eaf93e11
commit
2d545dcd2a
1 changed files with 9 additions and 0 deletions
|
|
@ -10,6 +10,7 @@ const RUST_SCOPE_QUERY = `
|
|||
(enum_item) @scope.class
|
||||
(union_item) @scope.class
|
||||
(function_item) @scope.function
|
||||
(function_signature_item) @scope.function
|
||||
(closure_expression) @scope.function
|
||||
(block) @scope.block
|
||||
(if_expression) @scope.block
|
||||
|
|
@ -55,6 +56,14 @@ const RUST_SCOPE_QUERY = `
|
|||
(function_item
|
||||
name: (identifier) @declaration.name) @declaration.function
|
||||
|
||||
;; Declarations — trait method signature (required method, no body,
|
||||
;; e.g. fn foo(self) -> T; inside a trait body). Without this, an abstract
|
||||
;; trait method is invisible to scope resolution — never owned by its
|
||||
;; trait's Class scope, so a dyn Trait receiver can never dispatch to
|
||||
;; it (#2604).
|
||||
(function_signature_item
|
||||
name: (identifier) @declaration.name) @declaration.function
|
||||
|
||||
;; Declarations — struct fields
|
||||
(field_declaration
|
||||
name: (field_identifier) @declaration.name
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue