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