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

Function conditionDepthAfter

src/resolution/pascal-scope.ts:269–275  ·  view source on GitHub ↗

The depth of conditional blocks after a line's directives (`{$IFDEF X}` opens one, `{$ENDIF}` closes it).

(text: string, depth: number)

Source from the content-addressed store, hash-verified

267
268/** The depth of conditional blocks after a line's directives (`{$IFDEF X}` opens one, `{$ENDIF}` closes it). */
269function conditionDepthAfter(text: string, depth: number): number {
270 for (const m of text.matchAll(/\{\$(ifdef|ifndef|ifopt|ifend|endif|if)\b/gi)) {
271 const directive = m[1]!.toLowerCase();
272 depth = directive === 'endif' || directive === 'ifend' ? Math.max(0, depth - 1) : depth + 1;
273 }
274 return depth;
275}
276
277/**
278 * The class whose method makes a call: the one the nearest method header

Callers 1

declaredUnderConditionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected