The depth of conditional blocks after a line's directives (`{$IFDEF X}` opens one, `{$ENDIF}` closes it).
(text: string, depth: number)
| 749 | |
| 750 | /** The depth of conditional blocks after a line's directives (`{$IFDEF X}` opens one, `{$ENDIF}` closes it). */ |
| 751 | function 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 |
no outgoing calls
no test coverage detected