module

Noir::MobileSwiftBody

Brace-matched Swift body extraction shared by the iOS config analyzer (enum case bodies) and the iOS deep-link linker (handler and method bodies).

Instance methods

body_after_opening_brace(lines : Array(String), opening_index : Int32, col : Int32) : Tuple(String, Int32)

Brace-matched body text starting just after lines[opening_index][col], handling both a compact single-line body ({ case a, b, c }) and a multi-line one. Depth is tracked on SwiftLexer's masked output (comments AND string contents blanked) so a raw value or comment that contains // or unbalanced braces can't be mistaken for real source structure and corrupt where the body actually ends.

Source
find_opening_brace(lines : Array(String), start : Int32) : NamedTuple(index: Int32, col: Int32) | Nil

Finds the first { at/after the matched line (same line, else within a few lines for a declaration whose parameter list and/or brace wrap onto their own lines — a folded multi-line signature can run several lines before the body brace).

Source