MCPcopy
hub / github.com/colbymchenry/codegraph / firstSimpleIdentifier

Function firstSimpleIdentifier

src/extraction/tree-sitter.ts:236–248  ·  view source on GitHub ↗

First `simple_identifier` in `node`'s subtree (breadth-ish, first-found). * Swift's property name nests as `property_declaration → pattern → * bound_identifier → simple_identifier`; this resolves it (and the bound name of * a Kotlin/Swift property declarator for the shadow prune). For a tu

(node: SyntaxNode | null)

Source from the content-addressed store, hash-verified

234 * a Kotlin/Swift property declarator for the shadow prune). For a tuple pattern
235 * (`let (a, b)`) it returns the first — acceptable, those are rare for consts. */
236function firstSimpleIdentifier(node: SyntaxNode | null): SyntaxNode | null {
237 const stack: SyntaxNode[] = node ? [node] : [];
238 let guard = 0;
239 while (stack.length > 0 && guard++ < 40) {
240 const n = stack.shift()!;
241 if (n.type === 'simple_identifier') return n;
242 for (let i = 0; i < n.namedChildCount; i++) {
243 const c = n.namedChild(i);
244 if (c) stack.push(c);
245 }
246 }
247 return null;
248}
249
250/** Swift property facts: the bound name, whether it's a `let`, and whether it's
251 * a *computed* property (a getter block, no stored value — never a constant). */

Callers 2

swiftPropertyInfoFunction · 0.85
flushValueRefsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected