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

Function registryEntryNames

src/resolution/callback-synthesizer.ts:2185–2202  ·  view source on GitHub ↗

Top-level `key: Identifier` entries of an object-literal body. DEPTH-AWARE: only depth-0 * segments are considered, so method-shorthand bodies (`number(a,b){…}`), arrow values * (`x: () => …`), and nested objects (`x: { … }`) don't leak their inner `k: v` pairs as * bogus handlers. The per-seg

(body: string)

Source from the content-addressed store, hash-verified

2183 * bogus handlers. The per-segment anchor (`^… key: Ident …$`) keeps only pure identifier
2184 * values — a data value (`x: 5`), call, or arrow fails to match. */
2185function registryEntryNames(body: string): string[] {
2186 const segs: string[] = [];
2187 let depth = 0;
2188 let start = 0;
2189 for (let i = 0; i < body.length; i++) {
2190 const c = body[i];
2191 if (c === '{' || c === '(' || c === '[') depth++;
2192 else if (c === '}' || c === ')' || c === ']') depth--;
2193 else if (c === ',' && depth === 0) { segs.push(body.slice(start, i)); start = i + 1; }
2194 }
2195 segs.push(body.slice(start));
2196 const names: string[] = [];
2197 for (const seg of segs) {
2198 const m = /^\s*(?:\[[^\]]+\]|['"]?[\w$]+['"]?)\s*:\s*([A-Za-z_$][\w$]*)\s*$/.exec(seg);
2199 if (m && m[1]!.length >= 3 && !names.includes(m[1]!)) names.push(m[1]!);
2200 }
2201 return names;
2202}
2203
2204/** Resolve a registered handler name to its callable entry: a function value, or a class's
2205 * `execute`-like method (preferring the method chained at the dispatch site), else the class. */

Callers 1

objectRegistryEdgesFunction · 0.85

Calls 1

execMethod · 0.65

Tested by

no test coverage detected