@@ -581,7 +581,7 @@ class Global(var currentSettings: Settings, reporter0: Reporter)
581
581
// phaseName = "specialize"
582
582
object specializeTypes extends {
583
583
val global : Global .this .type = Global .this
584
- val runsAfter = List ( " " )
584
+ val runsAfter = Nil
585
585
val runsRightAfter = Some (" tailcalls" )
586
586
} with SpecializeTypes
587
587
@@ -595,14 +595,14 @@ class Global(var currentSettings: Settings, reporter0: Reporter)
595
595
// phaseName = "erasure"
596
596
override object erasure extends {
597
597
val global : Global .this .type = Global .this
598
- val runsAfter = List ( " explicitouter " )
598
+ val runsAfter = Nil
599
599
val runsRightAfter = Some (" explicitouter" )
600
600
} with Erasure
601
601
602
602
// phaseName = "posterasure"
603
603
override object postErasure extends {
604
604
val global : Global .this .type = Global .this
605
- val runsAfter = List ( " erasure " )
605
+ val runsAfter = Nil
606
606
val runsRightAfter = Some (" erasure" )
607
607
} with PostErasure
608
608
@@ -667,7 +667,7 @@ class Global(var currentSettings: Settings, reporter0: Reporter)
667
667
val global : Global .this .type = Global .this
668
668
} with SubComponent {
669
669
val phaseName = " terminal"
670
- val runsAfter = List ( " jvm " )
670
+ val runsAfter = Nil
671
671
val runsRightAfter = None
672
672
override val terminal = true
673
673
@@ -696,10 +696,10 @@ class Global(var currentSettings: Settings, reporter0: Reporter)
696
696
/** Add the internal compiler phases to the phases set.
697
697
* This implementation creates a description map at the same time.
698
698
*/
699
- protected def computeInternalPhases (): Unit = {
699
+ protected def computeInternalPhases (): Unit =
700
700
// Note: this fits -Xshow-phases into 80 column width, which is
701
701
// desirable to preserve.
702
- val phs = List (
702
+ List (
703
703
syntaxAnalyzer -> " parse source into ASTs, perform simple desugaring" ,
704
704
analyzer.namerFactory -> " resolve names, attach symbols to named trees" ,
705
705
analyzer.packageObjects -> " load package objects" ,
@@ -724,19 +724,16 @@ class Global(var currentSettings: Settings, reporter0: Reporter)
724
724
cleanup -> " platform-specific cleanups, generate reflective calls" ,
725
725
terminal -> " the last phase during a compilation run"
726
726
)
727
+ .foreach((addToPhasesSet _).tupled)
727
728
728
- phs foreach (addToPhasesSet _).tupled
729
- }
730
729
// This is slightly inelegant but it avoids adding a new member to SubComponent,
731
730
// and attractive -Vphases output is unlikely if the descs span 20 files anyway.
732
731
private val otherPhaseDescriptions = Map (
733
732
" flatten" -> " eliminate inner classes" ,
734
733
" jvm" -> " generate JVM bytecode"
735
734
) withDefaultValue " "
736
735
737
- protected def computePlatformPhases () = platform.platformPhases foreach { sub =>
738
- addToPhasesSet(sub, otherPhaseDescriptions(sub.phaseName))
739
- }
736
+ protected def computePlatformPhases () = platform.platformPhases.foreach(p => addToPhasesSet(p, otherPhaseDescriptions(p.phaseName)))
740
737
741
738
// sequences the phase assembly
742
739
protected def computePhaseDescriptors : List [SubComponent ] = {
@@ -769,7 +766,7 @@ class Global(var currentSettings: Settings, reporter0: Reporter)
769
766
/** The names of the phases. */
770
767
lazy val phaseNames = {
771
768
new Run // force some initialization
772
- phaseDescriptors map (_.phaseName)
769
+ phaseDescriptors. map(_.phaseName)
773
770
}
774
771
775
772
/** A description of the phases that will run in this configuration, or all if -Vdebug. */
@@ -1292,10 +1289,13 @@ class Global(var currentSettings: Settings, reporter0: Reporter)
1292
1289
} else phs
1293
1290
}
1294
1291
// Create phases and link them together. We supply the previous, and the ctor sets prev.next.
1295
- val last = components.foldLeft(NoPhase : Phase )((prev, c) => c newPhase prev)
1296
- val phaseList = Iterator .iterate(last)(_.prev).takeWhile(_ != NoPhase ).toList.reverse
1297
- val maxId = phaseList.map(_.id).max
1298
- nextFrom = Array .tabulate(maxId)(i => infoTransformers.nextFrom(i))
1292
+ val phaseList = {
1293
+ val last = components.foldLeft(NoPhase : Phase )((prev, c) => c.newPhase(prev))
1294
+ Iterator .iterate(last)(_.prev).takeWhile(_ != NoPhase ).toList.reverse
1295
+ }
1296
+ nextFrom = Array .tabulate(phaseList.maxBy(_.id).id)(infoTransformers.nextFrom(_))
1297
+ // println(s"nextFrom: ${scala.runtime.ScalaRunTime.stringOf(nextFrom.map(_.pid))}")
1298
+ // println(s"phaseList: ${scala.runtime.ScalaRunTime.stringOf(phaseList.map(_.name))}")
1299
1299
val first = phaseList.head
1300
1300
val ss = settings
1301
1301
0 commit comments