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

Function callsItself

src/resolution/cpp-macro-visibility.ts:218–223  ·  view source on GitHub ↗

Does the body of the `#define NAME(` at `index` (continuation lines included) call `NAME`?

(lines: string[], index: number, name: string)

Source from the content-addressed store, hash-verified

216
217/** Does the body of the `#define NAME(` at `index` (continuation lines included) call `NAME`? */
218function callsItself(lines: string[], index: number, name: string): boolean {
219 let text = lines[index]!;
220 for (let j = index; /\\\s*$/.test(lines[j]!) && j + 1 < lines.length; j++) text += ' ' + lines[j + 1]!;
221 const body = text.slice(text.indexOf('(') + 1);
222 return new RegExp(`(?:\\b${name}\\s*\\(|\\(\\s*${name}\\s*\\)\\s*\\()`).test(body);
223}
224
225/**
226 * The include-guard idiom: `#ifndef X_H` (or `#if !defined(X_H)`) whose next

Callers 1

summarizeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected