Skip to content

Commit

Permalink
FormatOps: extract right delims methods
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Nov 23, 2024
1 parent 9d48629 commit af0a598
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2814,18 +2814,21 @@ class FormatOps(
case _ => Some(xft)
}

@inline
def getBeforeRightDelims(ft: FT): FT =
findTokenWith(ft, prev)(xft => noRighDelim(xft.left, xft)).merge
@inline
def getAfterRightDelims(ft: FT): FT =
findTokenWith(ft, next)(xft => noRighDelim(xft.right, xft)).merge

private def policyOnRightDelim(
ft: FT,
exclude: TokenRanges,
): (Option[FT], Policy) = {
val beforeDelims = findTokenWith(ft, prev) { xft =>
noRighDelim(xft.left, xft)
}.merge
val beforeDelims = getBeforeRightDelims(ft)
if (beforeDelims eq null) return (None, NoPolicy)

val afterDelims = findTokenWith(ft, next) { xft =>
noRighDelim(xft.right, xft)
}.merge
val afterDelims = getAfterRightDelims(ft)
if (afterDelims eq null) return (None, NoPolicy)

def closeBreakPolicy() = {
Expand Down

0 comments on commit af0a598

Please sign in to comment.