@@ -40,11 +40,10 @@ class FrontEnd extends Phase {
40
40
41
41
def monitor (doing : String )(body : => Unit )(using Context ): Unit =
42
42
try body
43
- catch {
43
+ catch
44
44
case NonFatal (ex) =>
45
45
report.echo(s " exception occurred while $doing ${ctx.compilationUnit}" )
46
46
throw ex
47
- }
48
47
49
48
def parse (using Context ): Unit = monitor(" parsing" ) {
50
49
val unit = ctx.compilationUnit
@@ -91,17 +90,16 @@ class FrontEnd extends Phase {
91
90
}
92
91
93
92
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
95
94
case PackageDef (_, defs) :: _ => firstTopLevelDef(defs)
96
95
case Import (_, _) :: defs => firstTopLevelDef(defs)
97
96
case (tree @ TypeDef (_, _)) :: _ => tree.symbol
98
97
case _ => NoSymbol
99
- }
100
98
101
99
protected def discardAfterTyper (unit : CompilationUnit )(using Context ): Boolean =
102
100
unit.isJava || unit.suspended
103
101
104
- override def runOn (units : List [CompilationUnit ])(using Context ): List [CompilationUnit ] = {
102
+ override def runOn (units : List [CompilationUnit ])(using Context ): List [CompilationUnit ] =
105
103
val unitContexts =
106
104
for unit <- units yield
107
105
report.inform(s " compiling ${unit.source}" )
@@ -113,7 +111,7 @@ class FrontEnd extends Phase {
113
111
enterSyms(using remaining.head)
114
112
remaining = remaining.tail
115
113
116
- if ( firstXmlPos.exists && ! defn.ScalaXmlPackageClass .exists)
114
+ if firstXmlPos.exists && ! defn.ScalaXmlPackageClass .exists then
117
115
report.error(""" To support XML literals, your project must depend on scala-xml.
118
116
|See https://github.com/scala/scala-xml for more information.""" .stripMargin,
119
117
firstXmlPos)
@@ -132,14 +130,13 @@ class FrontEnd extends Phase {
132
130
| ${suspendedUnits.toList}%, %
133
131
| """
134
132
val enableXprintSuspensionHint =
135
- if ( ctx.settings.XprintSuspension .value) " "
133
+ if ctx.settings.XprintSuspension .value then " "
136
134
else " \n\n Compiling with -Xprint-suspension gives more information."
137
135
report.error(em """ Cyclic macro dependencies $where
138
136
|Compilation stopped since no further progress can be made.
139
137
|
140
138
|To fix this, place macros in one set of files and their callers in another. $enableXprintSuspensionHint""" )
141
139
newUnits
142
- }
143
140
144
141
def run (using Context ): Unit = unsupported(" run" )
145
142
}
0 commit comments