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

Function cFamilySpec

src/extraction/function-ref.ts:145–171  ·  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

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