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

Function conditionDepthAfter

src/resolution/pascal-scope.ts:751–757  ·  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

749
750/** The depth of conditional blocks after a line's directives (`{$IFDEF X}` opens one, `{$ENDIF}` closes it). */
751function conditionDepthAfter(text: string, depth: number): number {
752 for (const m of text.matchAll(/\{\$(ifdef|ifndef|ifopt|ifend|endif|if)\b/gi)) {
753 const directive = m[1]!.toLowerCase();
754 depth = directive === 'endif' || directive === 'ifend' ? Math.max(0, depth - 1) : depth + 1;
755 }
756 return depth;
757}
758
759/**
760 * 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