summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/PhaseAssembly.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-03-15 04:45:47 +0000
committerPaul Phillips <paulp@improving.org>2010-03-15 04:45:47 +0000
commitf972729b04c44c12ea10d5aa5bb841fc3b40ab69 (patch)
tree3cbbe97f20b10a5303828324be5b0a9ced00df0c /src/compiler/scala/tools/nsc/PhaseAssembly.scala
parent70d4eb9654a2e7a6ba7dad2b62df36793678d99f (diff)
downloadscala-f972729b04c44c12ea10d5aa5bb841fc3b40ab69.tar.gz
scala-f972729b04c44c12ea10d5aa5bb841fc3b40ab69.tar.bz2
scala-f972729b04c44c12ea10d5aa5bb841fc3b40ab69.zip
Leveraged -Xmigration to burn off some warts wh...
Leveraged -Xmigration to burn off some warts which arose in the new collections. Warnings put in place for behavioral changes, allowing the following. 1) Buffers: create new collections on ++ and -- like all the other collections. 2) Maps: eliminated never-shipped redundant method valuesIterable and supplied these return types: def keys: Iterable[A] def keysIterator: Iterator[A] def values: Iterable[B] def valuesIterator: Iterator[B] def keySet: Set[A] I concluded that keys should return Iterable because keySet also exists on Map, and is not solely in the province of Maps even if we wanted to change it: it's defined on Sorted and also appears in some Sets. So it seems sensible to have keySet return a Set and keys return the more general type. Closes #3089, #3145. Review by odersky.
Diffstat (limited to 'src/compiler/scala/tools/nsc/PhaseAssembly.scala')
-rw-r--r--src/compiler/scala/tools/nsc/PhaseAssembly.scala17
1 files changed, 2 insertions, 15 deletions
diff --git a/src/compiler/scala/tools/nsc/PhaseAssembly.scala b/src/compiler/scala/tools/nsc/PhaseAssembly.scala
index 95ccee6b9d..dabf9547fe 100644
--- a/src/compiler/scala/tools/nsc/PhaseAssembly.scala
+++ b/src/compiler/scala/tools/nsc/PhaseAssembly.scala
@@ -96,21 +96,8 @@ trait PhaseAssembly { self: Global =>
/* Given the entire graph, collect the phase objects at each level, where the phase
* names are sorted alphabetical at each level, into the compiler phase list
*/
- def compilerPhaseList(): List[SubComponent] = {
- var chain: List[SubComponent] = Nil
-
- var lvl = 1
- var nds = nodes.valuesIterator.filter(_.level == lvl).toList
- while(nds.size > 0) {
- nds = nds sortBy (_.phasename)
- for (n <- nds) {
- chain = chain ::: n.phaseobj.get
- }
- lvl += 1
- nds = nodes.valuesIterator.filter(_.level == lvl).toList
- }
- chain
- }
+ def compilerPhaseList(): List[SubComponent] =
+ nodes.values.toList sortBy (x => (x.level, x.phasename)) flatMap (_.phaseobj) flatten
/* Test if there are cycles in the graph, assign levels to the nodes
* and collapse hard links into nodes