diff options
author | Paul Phillips <paulp@improving.org> | 2009-11-20 18:59:30 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2009-11-20 18:59:30 +0000 |
commit | e10d77e1ab3df39dc4a3e36399cb8f477ca5a90c (patch) | |
tree | 9ca3a1d3a857982bf411f659c9af696580b9971b /src/compiler | |
parent | b59bb7d36cc6125938b9bbeddff8da4e0efd68fa (diff) | |
download | scala-e10d77e1ab3df39dc4a3e36399cb8f477ca5a90c.tar.gz scala-e10d77e1ab3df39dc4a3e36399cb8f477ca5a90c.tar.bz2 scala-e10d77e1ab3df39dc4a3e36399cb8f477ca5a90c.zip |
More deprecation avoidance and some minor smoot...
More deprecation avoidance and some minor smoothings.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala | 11 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala | 4 |
2 files changed, 10 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala b/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala index a5076eb28c..161b09a415 100644 --- a/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala +++ b/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala @@ -832,6 +832,10 @@ abstract class GenMSIL extends SubComponent { case -1 => xs case idx => x :: (xs take idx) ::: (xs drop (idx + 1)) } + def moveToEnd[T](xs: List[T], x: T) = (xs indexOf x) match { + case -1 => xs + case idx => (xs take idx) ::: (xs drop (idx + 1)) ::: List(x) + } var blocksToPut: List[BasicBlock] = blocks var nextBlock: BasicBlock = null @@ -965,8 +969,9 @@ abstract class GenMSIL extends SubComponent { firstBlockAfter(exh) = outside(0) //else () //assert(firstBlockAfter(exh) == outside(0), "try/catch leaving to multiple targets: " + firstBlockAfter(exh) + ", new: " + outside(0)) + val last = leaving(0)._1 - ((blocks - last) ::: List(last), None) + (moveToEnd(blocks, last), None) } else { val outside = leaving.flatMap(p => p._2) //assert(outside.forall(b => b == outside(0)), "exception-block leaving to multiple targets") @@ -1002,7 +1007,7 @@ abstract class GenMSIL extends SubComponent { h1.addBlock(block) case None => () } - val orderedCatchBlocks = h1.startBlock :: (adaptedBlocks - h1.startBlock) + val orderedCatchBlocks = moveToFront(adaptedBlocks, h1.startBlock) exceptionBlock match { case Some(excBlock) => @@ -1033,7 +1038,7 @@ abstract class GenMSIL extends SubComponent { singleAffectedHandler.finalizer.addBlock(block) case None => () } - val blocks = singleAffectedHandler.finalizer.startBlock :: (blocks0 - singleAffectedHandler.finalizer.startBlock) + val blocks = moveToFront(blocks0, singleAffectedHandler.finalizer.startBlock) currentBlock = excBlock.finallyBlock addBlocks(blocks) } diff --git a/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala b/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala index 05d384cda2..6af23f8fde 100644 --- a/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala +++ b/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala @@ -131,7 +131,7 @@ class RefinedBuildManager(val settings: Settings) extends Changes with BuildMana println("Changes: " + changesOf) updateDefinitions(files) val compiled = updated ++ files - val invalid = invalidated(files, changesOf, additionalDefs ++ compiled) + val invalid = invalidated(files, changesOf, additionalDefs.clone() ++= compiled) update0(invalid -- compiled, compiled) } @@ -224,7 +224,7 @@ class RefinedBuildManager(val settings: Settings) extends Changes with BuildMana if (buf.isEmpty) processed else - invalidated(buf -- processed, newChangesOf, processed ++ buf) + invalidated(buf.clone() --= processed, newChangesOf, processed ++ buf) } /** Update the map of definitions per source file */ |