@@ -40,11 +40,10 @@ class FrontEnd extends Phase {
4040
4141 def monitor (doing : String )(body : => Unit )(using Context ): Unit =
4242 try body
43- catch {
43+ catch
4444 case NonFatal (ex) =>
4545 report.echo(s " exception occurred while $doing ${ctx.compilationUnit}" )
4646 throw ex
47- }
4847
4948 def parse (using Context ): Unit = monitor(" parsing" ) {
5049 val unit = ctx.compilationUnit
@@ -91,17 +90,16 @@ class FrontEnd extends Phase {
9190 }
9291
9392
94- private def firstTopLevelDef (trees : List [tpd.Tree ])(using Context ): Symbol = trees match {
93+ private def firstTopLevelDef (trees : List [tpd.Tree ])(using Context ): Symbol = trees match
9594 case PackageDef (_, defs) :: _ => firstTopLevelDef(defs)
9695 case Import (_, _) :: defs => firstTopLevelDef(defs)
9796 case (tree @ TypeDef (_, _)) :: _ => tree.symbol
9897 case _ => NoSymbol
99- }
10098
10199 protected def discardAfterTyper (unit : CompilationUnit )(using Context ): Boolean =
102100 unit.isJava || unit.suspended
103101
104- override def runOn (units : List [CompilationUnit ])(using Context ): List [CompilationUnit ] = {
102+ override def runOn (units : List [CompilationUnit ])(using Context ): List [CompilationUnit ] =
105103 val unitContexts =
106104 for unit <- units yield
107105 report.inform(s " compiling ${unit.source}" )
@@ -113,7 +111,7 @@ class FrontEnd extends Phase {
113111 enterSyms(using remaining.head)
114112 remaining = remaining.tail
115113
116- if ( firstXmlPos.exists && ! defn.ScalaXmlPackageClass .exists)
114+ if firstXmlPos.exists && ! defn.ScalaXmlPackageClass .exists then
117115 report.error(""" To support XML literals, your project must depend on scala-xml.
118116 |See https://github.com/scala/scala-xml for more information.""" .stripMargin,
119117 firstXmlPos)
@@ -132,14 +130,13 @@ class FrontEnd extends Phase {
132130 | ${suspendedUnits.toList}%, %
133131 | """
134132 val enableXprintSuspensionHint =
135- if ( ctx.settings.XprintSuspension .value) " "
133+ if ctx.settings.XprintSuspension .value then " "
136134 else " \n\n Compiling with -Xprint-suspension gives more information."
137135 report.error(em """ Cyclic macro dependencies $where
138136 |Compilation stopped since no further progress can be made.
139137 |
140138 |To fix this, place macros in one set of files and their callers in another. $enableXprintSuspensionHint""" )
141139 newUnits
142- }
143140
144141 def run (using Context ): Unit = unsupported(" run" )
145142}
0 commit comments