diff options
author | Martin Odersky <odersky@gmail.com> | 2008-08-15 18:23:54 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2008-08-15 18:23:54 +0000 |
commit | 7261acdba484a39f6851d76c85590c352d536fb2 (patch) | |
tree | fa0bcef296bc040ca4751ae03dbd2a5df18ec0e3 /src | |
parent | 20a3e4ee457e61d3f695b794260b5a1e1e0156e9 (diff) | |
download | scala-7261acdba484a39f6851d76c85590c352d536fb2.tar.gz scala-7261acdba484a39f6851d76c85590c352d536fb2.tar.bz2 scala-7261acdba484a39f6851d76c85590c352d536fb2.zip |
Backed out from addition of vararg += in Buffer.
Diffstat (limited to 'src')
9 files changed, 23 insertions, 14 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/Trees.scala b/src/compiler/scala/tools/nsc/ast/Trees.scala index 5a12ed2f00..f6c2bfd40f 100644 --- a/src/compiler/scala/tools/nsc/ast/Trees.scala +++ b/src/compiler/scala/tools/nsc/ast/Trees.scala @@ -1628,7 +1628,7 @@ trait Trees { } object posAssigner extends Traverser { - private var pos: Position = _ + var pos: Position = _ override def traverse(t: Tree) { if (t != EmptyTree && t.pos == NoPosition) { t.setPos(pos) diff --git a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala index 6606d30a84..09a37d006d 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala @@ -61,11 +61,11 @@ abstract class TreeBuilder { override def traverse(tree: Tree): Unit = tree match { case Bind(name, Typed(tree1, tpt)) => if ((name != nme.WILDCARD) && (buf.elements forall (name !=))) - buf += (name, if (treeInfo.mayBeTypePat(tpt)) TypeTree() else tpt, tree.pos) + buf += ((name, if (treeInfo.mayBeTypePat(tpt)) TypeTree() else tpt, tree.pos)) traverse(tree1) case Bind(name, tree1) => if ((name != nme.WILDCARD) && (buf.elements forall (name !=))) - buf += (name, TypeTree(), tree.pos) + buf += ((name, TypeTree(), tree.pos)) traverse(tree1) case _ => super.traverse(tree) diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala index feb29d5de4..31e151ba29 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala @@ -652,7 +652,7 @@ abstract class ICodeReader extends ClassfileParser { var containsNEW = false def emit(i: Instruction) { - instrs += (pc, i) + instrs += ((pc, i)) if (i.isInstanceOf[DupX]) containsDUPX = true if (i.isInstanceOf[opcodes.NEW]) diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala b/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala index 57445add42..625dd820ed 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala @@ -363,7 +363,7 @@ abstract class UnPickler { while (readIndex != end) { val argref = readNat() if (isNameEntry(argref)) - assocs += (at(argref, readName), readAnnotationArgRef) + assocs += ((at(argref, readName), readAnnotationArgRef)) else args += at(argref, readAnnotationArg) } diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala index d83b581394..51288bab2e 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala @@ -299,7 +299,7 @@ trait Infer { explainName(sym1) explainName(sym2) if (sym1.owner == sym2.owner && !inIDE) sym2.name = newTypeName("(some other)"+sym2.name) - patches += (sym1, sym2, name) + patches += ((sym1, sym2, name)) } val result = op diff --git a/src/compiler/scala/tools/nsc/util/Position.scala b/src/compiler/scala/tools/nsc/util/Position.scala index 2978f44a14..320ee48e77 100644 --- a/src/compiler/scala/tools/nsc/util/Position.scala +++ b/src/compiler/scala/tools/nsc/util/Position.scala @@ -90,3 +90,8 @@ case class OffsetPosition(source0: SourceFile, offset0: Int) extends Position { } override def hashCode = offset0 + source0.file.hashCode } + +/** new for position ranges */ +class RangePosition(source0: SourceFile, offset0: Int, start: Int, end: Int) +extends OffsetPosition(source0, offset0) + diff --git a/src/library/scala/List.scala b/src/library/scala/List.scala index 287d552e34..dead80cdad 100644 --- a/src/library/scala/List.scala +++ b/src/library/scala/List.scala @@ -1158,7 +1158,7 @@ sealed abstract class List[+A] extends Seq[A] with Product { var these = this var those = that while (!these.isEmpty && !those.isEmpty) { - b += (these.head, those.head) + b += ((these.head, those.head)) these = these.tail those = those.tail } @@ -1177,7 +1177,7 @@ sealed abstract class List[+A] extends Seq[A] with Product { var idx = 0 while(!these.isEmpty) { - b += (these.head, idx) + b += ((these.head, idx)) these = these.tail idx += 1 } @@ -1209,16 +1209,16 @@ sealed abstract class List[+A] extends Seq[A] with Product { var these = this var those = that while (!these.isEmpty && !those.isEmpty) { - b += (these.head, those.head) + b += ((these.head, those.head)) these = these.tail those = those.tail } while (!these.isEmpty) { - b += (these.head, thatElem) + b += ((these.head, thatElem)) these = these.tail } while (!those.isEmpty) { - b += (thisElem, those.head) + b += ((thisElem, those.head)) those = those.tail } b.toList diff --git a/src/library/scala/collection/mutable/Buffer.scala b/src/library/scala/collection/mutable/Buffer.scala index cbe594bca1..9c00c140e0 100644 --- a/src/library/scala/collection/mutable/Buffer.scala +++ b/src/library/scala/collection/mutable/Buffer.scala @@ -37,15 +37,17 @@ trait Buffer[A] extends AnyRef /** Append a two or more elements to this buffer. * + * enable this for 2.8.0! + * * @param elem1 the first element to append. * @param elem2 the second element to append. * @param elems the remaining elements to append. - */ def +=(elem1: A, elem2: A, elems: A*): Unit = { this += elem1 this += elem2 this ++= elems } + */ /** Append a single element to this buffer and return * the identity of the buffer. @@ -57,12 +59,14 @@ trait Buffer[A] extends AnyRef /** Append two or more elements to this buffer and return * the identity of the buffer. * + * enable this for 2.8.0! + * * @param elem1 the first element to append. * @param elem2 the second element to append. * @param elems the remaining elements to append. - */ def +(elem1: A, elem2: A, elems: A*): Buffer[A] = this + elem1 + elem2 ++ elems + */ /** Prepend a single element to this buffer and return * the identity of the buffer. diff --git a/src/library/scala/testing/SUnit.scala b/src/library/scala/testing/SUnit.scala index 1a87c64b0e..7f4954e7e3 100644 --- a/src/library/scala/testing/SUnit.scala +++ b/src/library/scala/testing/SUnit.scala @@ -116,7 +116,7 @@ object SUnit { val buf = new ArrayBuffer[(Test, Throwable)]() def addFailure(test: Test, t: Throwable) { - buf += (test, t) + buf += ((test, t)) } def failureCount() = |