MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / cFamilySpec

Function cFamilySpec

src/extraction/function-ref.ts:149–175  ·  view source on GitHub ↗

C / C++ / Objective-C share the C-family initializer & assignment shapes.

(extra?: { special?: string[]; addressOfOnly?: boolean })

Source from the content-addressed store, hash-verified

147
148/** C / C++ / Objective-C share the C-family initializer & assignment shapes. */
149function cFamilySpec(extra?: { special?: string[]; addressOfOnly?: boolean }): FnRefSpec {
150 return {
151 idTypes: new Set(['identifier']),
152 dispatch: new Map<string, CaptureRule>([
153 ['argument_list', { mode: 'args' }],
154 ['assignment_expression', { mode: 'rhs', field: 'right' }],
155 ['init_declarator', { mode: 'varinit', field: 'value' }],
156 ['initializer_list', { mode: 'list' }],
157 ['initializer_pair', { mode: 'value', field: 'value' }],
158 ]),
159 unwrap: new Map([['pointer_expression', 'argument']]),
160 special: new Set(extra?.special ?? []),
161 // C has no symbol imports, and callbacks are registered cross-file at repo
162 // scale (redis: server.c's command table names handlers from t_*.c) — so
163 // initializer positions bypass the gate and lean on resolution's
164 // unique-or-drop rule. ONLY 'value'/'list' (struct/array initializers),
165 // and the flush additionally requires FILE scope: a C file-scope
166 // initializer is a constant-expression context, so a bare identifier
167 // there can only be a function address (or enum/macro, which the
168 // function-kind filter drops) — never a variable. 'rhs'/'varinit' were
169 // tried and produced false edges (`prev = next`, `*str = field` — data
170 // assignments matching a unique same-named function elsewhere), so
171 // assignments stay gated to same-file/import.
172 ungatedModes: new Set<CaptureMode>(['value', 'list']),
173 addressOfOnly: extra?.addressOfOnly,
174 };
175}
176
177// `this.handleClick` capture (member_expression) emits a `this.`-PREFIXED
178// candidate name: resolution scopes it to the enclosing symbol's class

Callers 1

function-ref.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected