mirror of
https://github.com/colbymchenry/codegraph.git
synced 2026-10-02 01:37:32 +08:00
* fix(extraction): name a function bound through a curried wrapper (#1747) reactHookBoundName already names an anonymous function after the variable_declarator that binds it. The shape is general, but the method is bounded to three React hooks, so `const run = Effect.fn("Session.run")(function* () {…})` produced no function node at all -- and its body's calls were attributed to the enclosing container, so a file gained an outgoing edge belonging to a function and the callee's caller list named the file instead. Bound the new path by a different, equally decidable test: the callee is itself a call, i.e. a factory returning the wrapper. That admits Effect.fn(...)(fn), connect(mapState)(fn) and a project's own wrap("n")(fn), and excludes the single-call forms whose argument is a computation -- useMemo(() => …, []), arr.map(…) -- which stay anonymous exactly as before. Widening to "any callee" would have given useMemo a function node and reddened react-hook-handlers.test.ts. Generators are admitted here and not in reactHookBoundName: a React handler is never a generator, while function* is the common form in the ecosystem this shape comes from, and it is what the report opens with -- broadening the callee test alone would not have fixed that repro. Mirrored in the Rust kernel; kernel-parity.mjs reports byte-parity on the new shape. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WgtWMywGTyu6twnk1Bu9nP (cherry picked from commit4f2b40080d) * fix(extraction): name a curried-wrapper function that is an object member (#1747) The curried-wrapper bound stopped at a variable_declarator parent, so `return { getMode: Effect.fn("ACP.Session.getMode")(function* () {…}) }` still produced no function node. An Effect service is usually an object a factory returns, and on sst/opencode (df23b7f) these member positions were the bulk of what the branch missed. The member already has a name in the source: its property key. This repo names `key: () => {}` pairs by that key (extractObjectLiteralFunctions / objectKeyName), so a `pair` parent is now named the same way. The callee-is-a-call rule is unchanged, so `key: useMemo(() => …, [])` and `key: arr.map(…)` stay anonymous. extractObjectLiteralFunctions also reaches such a member, because an exported object with an inline function member is extracted member by member and its initializer is never walked. A wrapper passed as an argument to another call has no binding at all and is left as it was. Mirrored in the Rust kernel; kernel-parity.mjs reports byte-parity on the new shapes. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dfb3aazPY1ccmp5vam4k3L (cherry picked from commitbbdef20542) * chore: drop CHANGELOG entry (collected separately) --------- Co-authored-by: Max Hsu <maxmilian@gmail.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>