3 months ago
c3c70b3Python decorators (@app.route, @lru_cache, etc.) were parsed as
call nodes inside decorated_definition, but since the inner
function_definition hadn't been pushed to the context stack yet,
the decorator calls had no caller — they were added to
calledIdentifiers but never to callExpressions. The graph build
only uses callExpressions for call edges, so decorator dependency
edges were missing from the graph.
Fix: when encountering a decorated_definition node, pre-extract the
inner function/class name and create call edges from it to each
decorator name. Handles both simple (@lru_cache) and call-style
(@app.route("/api")) decorators.
Changed in both parsers:
- packages/native/src/parser.rs (Rust tree-sitter)
- packages/indexer/src/tree-sitter/parse.ts (TS tree-sitter)
This matches the existing regex parser behavior in languages.ts
which already creates these call edges.
Typecheck 8/8, tests 144 pass.
Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>Parentbcebc30