Fixing up a few instances of suboptimal reversing, no review.

git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@25576 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
extempore 2011-08-27 18:02:20 +00:00
parent e82fd5e80e
commit 268cdc3942
4 changed files with 4 additions and 4 deletions

View File

@ -94,7 +94,7 @@ trait BasicBlocks {
/** Return an iterator over the instructions in this basic block. */
def iterator: Iterator[Instruction] =
if (closed) instrs.iterator else instructionList.reverse.iterator
if (closed) instrs.iterator else instructionList.reverseIterator
/** return the underlying array of instructions */
def getArray: Array[Instruction] = {

View File

@ -232,7 +232,7 @@ abstract class ClosureElimination extends SubComponent {
while (t != Nil) {
peep(b, h, t.head) match {
case Some(newInstrs) =>
newInstructions = seen.reverse ::: newInstrs ::: t.tail;
newInstructions = seen reverse_::: newInstrs ::: t.tail
redo = true
case None =>
()

View File

@ -99,7 +99,7 @@ class Queue[+A] protected(protected val in: List[A], protected val out: List[A])
* @param iter an iterable object
*/
def enqueue[B >: A](iter: Iterable[B]) =
new Queue(iter.toList.reverse ::: in, out)
new Queue(iter.toList reverse_::: in, out)
/** Returns a tuple with the first element in the queue,
* and a new queue with this element removed.

View File

@ -22,7 +22,7 @@ object ArrayStack extends SeqFactory[ArrayStack] {
def newBuilder[A]: Builder[A, ArrayStack[A]] = new ArrayStack[A]
def empty: ArrayStack[Nothing] = new ArrayStack()
def apply[A: ClassManifest](elems: A*): ArrayStack[A] = {
val els: Array[AnyRef] = elems.reverse.map{_.asInstanceOf[AnyRef]}(breakOut)
val els: Array[AnyRef] = elems.reverseMap(_.asInstanceOf[AnyRef])(breakOut)
if (els.length == 0) new ArrayStack()
else new ArrayStack[A](els, els.length)
}