feat(pipeline): emit CALLS edges for decorator applications#208
Open
map588 wants to merge 4 commits intoDeusData:mainfrom
Open
feat(pipeline): emit CALLS edges for decorator applications#208map588 wants to merge 4 commits intoDeusData:mainfrom
map588 wants to merge 4 commits intoDeusData:mainfrom
Conversation
Decorators previously only created DECORATES edges. References like
@login_required were invisible to "find all references" queries which
look for CALLS and USAGE edges. Now both sequential (resolve_decorator)
and parallel (resolve_def_decorators) paths emit a CALLS edge alongside
DECORATES.
Uses "{}" properties to avoid clobbering richer metadata from pass_calls
when a function both has @decorator and calls decorator() directly.
There was a problem hiding this comment.
Pull request overview
This PR updates the indexing pipeline so decorator applications (e.g., @login_required) also emit CALLS edges (in addition to DECORATES) to make decorators visible to reference queries that traverse CALLS / USAGE relationships.
Changes:
- Emit a
CALLSedge alongsideDECORATESin the sequential semantic pass (resolve_decorator). - Emit a
CALLSedge alongsideDECORATESin the parallel semantic resolver (resolve_def_decorators). - Use
"{}"edge properties to avoid overwriting richerCALLSmetadata produced bypass_callswhen an edge already exists.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/pipeline/pass_semantic.c | Adds a synthetic CALLS edge for each resolved decorator in the sequential semantic pass. |
| src/pipeline/pass_parallel.c | Adds a synthetic CALLS edge for each resolved decorator in the parallel semantic resolver path. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Contributor
Author
|
I noticed CBM was marking python functions as dead, because it had no callers, however the decorators were not taken into account. This marks them as "USAGE", so functions do not get falsely flagged as dead. @DeusData |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Decorators previously only created DECORATES edges. References like @login_required were invisible to "find all references" queries which look for CALLS and USAGE edges. Now both sequential (resolve_decorator) and parallel (resolve_def_decorators) paths emit a CALLS edge alongside DECORATES.
Uses "{}" properties to avoid clobbering richer metadata from pass_calls when a function both has @decorator and calls decorator() directly.