fix(extraction): index const-bound functions inside a body as symbols (#1669) - #1774
Merged
colbymchenry merged 5 commits intoSep 8, 2026
Merged
Conversation
…#1669) `const handleClear = () => {…}` inside a component — every React handler that skips useCallback — was never a symbol: the body walker only named nested function declarations and hook-bound arrows, so the handler was absent from callers/impact ("Symbol not found", indistinguishable from "no callers") and its calls attributed to the component. Bind the arrow or function expression to its declarator the way module scope already does, in both the wasm walker and the kernel. A navigation such a handler makes is now the handler's own edge and a hop in the Screens `via` chain — the shape a useCallback handler already has — so the react-router and expo-router expectations follow that convention.
…ound-nested-functions # Conflicts: # CHANGELOG.md
…ound-nested-functions # Conflicts: # CHANGELOG.md
…ound-nested-functions # Conflicts: # CHANGELOG.md # src/extraction/tree-sitter.ts
colbymchenry
deleted the
forge/fix-1669-declarator-bound-nested-functions
branch
September 8, 2026 15:07
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.
Fixes #1669.
Lands / rebases #1679 onto current
main(CHANGELOG conflict with #1772 / #1674+#1639 only).Problem
const handleClear = () => {…}inside a component — every React handler written withoutuseCallback— was never a symbol. The body walker named nested function declarations and hook-bound arrows (const x = useCallback(…)), but a plain declarator-bound arrow or function expression fell through, so the handler was absent fromcallers/callees/ impact ("Symbol not found", which reads exactly like "no callers") and its calls attributed to the component. The same declaration at module scope already names a function.Change
arrow_function/function_expressionthat is the wholevalueof avariable_declaratorwith a plain identifier name is extracted as a function, contained by the enclosing one, with its own calls.extractFunctionalready resolves the name from the declarator. A destructuring binding, an inline JSX arrow and a non-function value stay as they were. JS family only.torture.tsxgains the shape sokernel-tsjs-paritypins both arms.navigatesedge (same shape auseCallbackhandler already has).#1718 / fuzzy lexical reachability is already on main — nested handlers become real symbols without becoming fuzzy false positives across files.
Verification (Linux)
handleClearmissing,handleSelect(useCallback) present. Post-fix: both indexed asWidget::handleClear/Widget::handleSelect.codegraph init→ 12 nodes;callers handleClear→ Widget;query kind:functionlists both handlers.CODEGRAPH_KERNEL_EXPECT=1vitest:nested-declarator-functions,react-router,expo-router,kernel-tsjs-parity,fuzzy-lexical-reach— all passed.Re-index after upgrading to pick up the new symbols.