Skip to main content

Module scope_resolve

Module scope_resolve 

Source
Expand description

Scope-aware reference resolver using tree-sitter ASTs.

Instead of bag-of-words tokenization (current graph.rs Pass 2), this module walks the tree-sitter AST to find actual reference nodes (calls, attribute access) and resolves them using scope chains. This gives compiler-like accuracy for name resolution without needing a full language server.

Key improvements over bag-of-words:

  • Distinguishes definitions from references in the AST
  • Resolves same-name entities via scope chains (no false collisions)
  • Tracks variable types through assignments (x = Foo() → x.method → Foo.method)
  • Uses AST structure, not string matching

Structs§

ResolutionEntry
Scope
A scope in the scope tree. Scopes are nested: module -> class -> function -> block.
ScopeResult
Result of scope-aware resolution

Functions§

extract_go_receiver_type
Parse Go receiver type from method content: func (r *ReceiverType) Name(...)
resolve_with_scopes
Public API that accepts caller-provided entity maps and normalizes them for resolver internals.
resolve_with_scopes_fast
Public API for callers that already hold an Fx-hashed entity map.