Home

giogio / openez-graph

public
Overview Code History Branches Pull requestsIssuesInsights
main
HomeOverview Code PRsIssues

fix(python): link decorator calls to decorated function in call graph

3 months ago

c3c70b3
Authored
asta-nguyen8/8/2026, 7:02:21 AM
Python 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

2 files changed
  • packages/indexer/src/tree-sitter/parse.ts+47−0
  • packages/native/src/parser.rs+68−0