feat(parser): emit FUNCTION nodes for namespace-assigned JS functions#77
Merged
Conversation
Plain-script JS (no ES modules) attaches its API to namespace objects:
CGUI.esc = function esc(s) {...}, window.CGViews.flows = (host) => {...}.
The TS/JS parser handled function declarations and const-assigned
functions but emitted nothing for member-expression assignments, so
these functions were invisible to the graph - no nodes, no CALLS
attribution, and review flagged the dashboard helper move (app.js ->
ui/helpers.js) as removed-referenced because the new definitions
produced no added nodes for move detection to match.
New _handle_assigned_function in the module-level visitor: LHS must be
a member expression of plain identifiers (computed members skipped),
window. prefix is stripped, RHS must be a function/arrow expression.
Node name is the property name (the API name callers use); an inner
named function expression is preserved as metadata.function_name. Body
calls/fetches are attributed to the new node like every other handler.
Gate: 779 tests pass, ruff + mypy --strict clean.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
codegraph PR reviewDiff vs main · severity ≤
|
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
Plain-script JS (no ES modules) attaches its API to namespace objects —
CGUI.esc = function esc(s) {...},window.CGViews.flows = (host) => {...}. The parser handled function declarations and const-assigned functions but emitted nothing for member-expression assignments, leaving these functions invisible to the graph.Concrete impact: PR #73's helper move (app.js → ui/helpers.js, the new module pattern of the whole refactored dashboard) was flagged
removed-referencedcritical three times, because the newCGUI.*definitions produced no added nodes for the move detection (#76) to match.New
_handle_assigned_functionin the module-level visitor:obj[key]skipped)window.prefix stripped (environment artifact, not a namespace)metadata.function_nameTest plan
codegraph lintself-run cleanUnblocks #73 (final wave-2 train car).
🤖 Generated with Claude Code