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
ScopeResult
Result of scope-aware resolution

Functions§

resolve_with_scopes
Resolve references using tree-sitter scope analysis.