Skip to content

Commit

Permalink
Router: inline, remove TreeOps.findTemplate
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Oct 11, 2024
1 parent 8d096f1 commit 1bc8b0d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,8 @@ class Router(formatOps: FormatOps) {
case FormatToken(_: T.RightArrow | _: T.ContextArrow, right, _)
if (leftOwner match {
case _: Term.FunctionTerm | _: Term.PolyFunction => true
case t => findTemplate(t).parent.is[Term.NewAnonymous]
case t: Self => t.ancestor(2).is[Term.NewAnonymous]
case _ => false
}) =>
val (endOfFunction, expiresOn) = leftOwner match {
case t: Term.FunctionTerm => functionExpire(t)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -663,15 +663,6 @@ object TreeOps {
if (groups.isEmpty) None else Some(groups)
}

def findTemplate(t: Tree): Option[Template] = t match {
case t: Template => Some(t)
case _: Self | _: Template.Body => t.parent match {
case Some(p) => findTemplate(p)
case _ => None
}
case _ => None
}

// Scala syntax allows commas before right braces in weird places,
// like constructor bodies:
// def this() = {
Expand Down

0 comments on commit 1bc8b0d

Please sign in to comment.