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

Function firstSimpleIdentifier

src/extraction/tree-sitter.ts:292–304  ·  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

290 * a Kotlin/Swift property declarator for the shadow prune). For a tuple pattern
291 * (`let (a, b)`) it returns the first — acceptable, those are rare for consts. */
292function firstSimpleIdentifier(node: SyntaxNode | null): SyntaxNode | null {
293 const stack: SyntaxNode[] = node ? [node] : [];
294 let guard = 0;
295 while (stack.length > 0 && guard++ < 40) {
296 const n = stack.shift()!;
297 if (n.type === 'simple_identifier') return n;
298 for (let i = 0; i < n.namedChildCount; i++) {
299 const c = n.namedChild(i);
300 if (c) stack.push(c);
301 }
302 }
303 return null;
304}
305
306/** Swift property facts: the bound name, whether it's a `let`, and whether it's
307 * a *computed* property (a getter block, no stored value — never a constant). */

Callers 2

swiftPropertyInfoFunction · 0.85
flushValueRefsMethod · 0.85

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected