summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorGilles Dubochet <gilles.dubochet@epfl.ch>2009-05-27 19:35:02 +0000
committerGilles Dubochet <gilles.dubochet@epfl.ch>2009-05-27 19:35:02 +0000
commitcc5e79c9ec9cea8d0f22020b528877d8f6e00153 (patch)
tree94e43f77c7b7271b3d0b6f9fb7372ae83b39360d /src/compiler
parent4b8be5d8bec86358276407d6521c41702ccda835 (diff)
downloadscala-cc5e79c9ec9cea8d0f22020b528877d8f6e00153.tar.gz
scala-cc5e79c9ec9cea8d0f22020b528877d8f6e00153.tar.bz2
scala-cc5e79c9ec9cea8d0f22020b528877d8f6e00153.zip
In "Iterable" and in all its subclasses, "itera...
In "Iterable" and in all its subclasses, "iterator" replaces "elements" (and assorted changes).
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/ant/ScalaBazaar.scala8
-rw-r--r--src/compiler/scala/tools/ant/ScalaTool.scala6
-rw-r--r--src/compiler/scala/tools/ant/Scalac.scala2
-rw-r--r--src/compiler/scala/tools/ant/Scaladoc.scala14
-rw-r--r--src/compiler/scala/tools/ant/sabbus/Compilers.scala2
-rw-r--r--src/compiler/scala/tools/nsc/ConsoleWriter.scala2
-rw-r--r--src/compiler/scala/tools/nsc/Global.scala6
-rw-r--r--src/compiler/scala/tools/nsc/Main.scala2
-rw-r--r--src/compiler/scala/tools/nsc/MainTokenMetric.scala2
-rw-r--r--src/compiler/scala/tools/nsc/ScalaDoc.scala2
-rw-r--r--src/compiler/scala/tools/nsc/ast/Trees.scala16
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala8
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala24
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala10
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/GenICode.scala4
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/Members.scala4
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/analysis/DataFlowAnalysis.scala4
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala4
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala4
-rw-r--r--src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/opt/Inliners.scala2
-rw-r--r--src/compiler/scala/tools/nsc/doc/DefaultDocDriver.scala2
-rw-r--r--src/compiler/scala/tools/nsc/doc/DocUtil.scala4
-rw-r--r--src/compiler/scala/tools/nsc/doc/ModelExtractor.scala6
-rw-r--r--src/compiler/scala/tools/nsc/doc/ModelToXML.scala4
-rw-r--r--src/compiler/scala/tools/nsc/io/AbstractFile.scala4
-rw-r--r--src/compiler/scala/tools/nsc/io/PlainFile.scala4
-rw-r--r--src/compiler/scala/tools/nsc/io/VirtualDirectory.scala2
-rw-r--r--src/compiler/scala/tools/nsc/io/VirtualFile.scala2
-rw-r--r--src/compiler/scala/tools/nsc/io/ZipArchive.scala12
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Constants.scala2
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Scopes.scala4
-rw-r--r--src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala10
-rw-r--r--src/compiler/scala/tools/nsc/symtab/SymbolWalker.scala12
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Types.scala21
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/AbstractFileReader.scala2
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala2
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala2
-rw-r--r--src/compiler/scala/tools/nsc/symtab/clr/CLRTypes.scala6
-rw-r--r--src/compiler/scala/tools/nsc/symtab/clr/TypeParser.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/AddInterfaces.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/Constructors.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/LambdaLift.scala10
-rw-r--r--src/compiler/scala/tools/nsc/transform/Mixin.scala4
-rw-r--r--src/compiler/scala/tools/nsc/transform/Reifiers.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/IdeSupport.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Implicits.scala10
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/RefChecks.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala2
-rw-r--r--src/compiler/scala/tools/nsc/util/HashSet.scala2
-rw-r--r--src/compiler/scala/tools/nsc/util/Set.scala6
-rw-r--r--src/compiler/scala/tools/nsc/util/TreeSet.scala2
54 files changed, 144 insertions, 137 deletions
diff --git a/src/compiler/scala/tools/ant/ScalaBazaar.scala b/src/compiler/scala/tools/ant/ScalaBazaar.scala
index a787d08365..aba6835eae 100644
--- a/src/compiler/scala/tools/ant/ScalaBazaar.scala
+++ b/src/compiler/scala/tools/ant/ScalaBazaar.scala
@@ -87,8 +87,8 @@ package scala.tools.ant {
content.update(key, value :: content(key))
else content.update(key, List(value))
}
- def fileSets = elements.toList
- def elements = content.elements
+ def fileSets = content.toList
+ def iterator = content.iterator
}
@@ -125,7 +125,7 @@ package scala.tools.ant {
/** Sets the depends attribute. Used by Ant.
* @param input The value for <code>depends</code>. */
def setDepends(input: String) = {
- depends = List.fromArray(input.split(",")).flatMap { s: String =>
+ depends = input.split(",").toList.flatMap { s: String =>
val st = s.trim()
(if (st != "") List(st) else Nil)
}
@@ -291,7 +291,7 @@ package scala.tools.ant {
for {
Pair(folder, fileSets) <- fileSetsMap.fileSets
fileSet <- fileSets
- file <- List.fromArray(fileSet.getDirectoryScanner(getProject).getIncludedFiles)
+ file <- fileSet.getDirectoryScanner(getProject).getIncludedFiles.toList
} yield Triple(folder, fileSet.getDir(getProject), file)
val zip = new ZipOutputStream(new FileOutputStream(file.get, false))
if (!zipContent.isEmpty) {
diff --git a/src/compiler/scala/tools/ant/ScalaTool.scala b/src/compiler/scala/tools/ant/ScalaTool.scala
index 9fc02859c8..4faf5a2e90 100644
--- a/src/compiler/scala/tools/ant/ScalaTool.scala
+++ b/src/compiler/scala/tools/ant/ScalaTool.scala
@@ -93,7 +93,7 @@ class ScalaTool extends MatchingTask {
/** Sets the platforms attribute. */
def setPlatforms(input: String) = {
- platforms = List.fromArray(input.split(",")).flatMap { s: String =>
+ platforms = input.split(",").toList.flatMap { s: String =>
val st = s.trim
if (Platforms.isPermissible(st))
(if (input != "") List(st) else Nil)
@@ -119,7 +119,7 @@ class ScalaTool extends MatchingTask {
/** Sets JVM properties that will be set whilst running the tool. */
def setProperties(input: String) = {
- properties = List.fromArray(input.split(",")).flatMap { s: String =>
+ properties = input.split(",").toList.flatMap { s: String =>
val st = s.trim
val stArray = st.split("=", 2)
if (stArray.length == 2) {
@@ -177,7 +177,7 @@ class ScalaTool extends MatchingTask {
}
private def readAndPatchResource(resource: String, tokens: Map[String, String]): String = {
- val chars = getResourceAsCharStream(this.getClass, resource).elements
+ val chars = getResourceAsCharStream(this.getClass, resource).iterator
val builder = new StringBuilder()
while (chars.hasNext) {
diff --git a/src/compiler/scala/tools/ant/Scalac.scala b/src/compiler/scala/tools/ant/Scalac.scala
index 3ede08f40c..9fb6d09f56 100644
--- a/src/compiler/scala/tools/ant/Scalac.scala
+++ b/src/compiler/scala/tools/ant/Scalac.scala
@@ -324,7 +324,7 @@ class Scalac extends MatchingTask {
/** Sets the <code>logphase</code> attribute. Used by Ant.
* @param input The value for <code>logPhase</code>. */
def setLogPhase(input: String) {
- logPhase = List.fromArray(input.split(",")).flatMap { s: String =>
+ logPhase = input.split(",").toList.flatMap { s: String =>
val st = s.trim()
if (CompilerPhase.isPermissible(st))
(if (input != "") List(st) else Nil)
diff --git a/src/compiler/scala/tools/ant/Scaladoc.scala b/src/compiler/scala/tools/ant/Scaladoc.scala
index 51aa33b06e..8a85393293 100644
--- a/src/compiler/scala/tools/ant/Scaladoc.scala
+++ b/src/compiler/scala/tools/ant/Scaladoc.scala
@@ -372,7 +372,7 @@ class Scaladoc extends MatchingTask {
*/
private def getClasspath: List[File] =
if (classpath.isEmpty) error("Member 'classpath' is empty.")
- else List.fromArray(classpath.get.list()).map(nameToFile)
+ else classpath.get.list().toList.map(nameToFile)
/** Gets the value of the <code>origin</code> attribute in a Scala-friendly
* form.
@@ -381,7 +381,7 @@ class Scaladoc extends MatchingTask {
*/
private def getOrigin: List[File] =
if (origin.isEmpty) error("Member 'origin' is empty.")
- else List.fromArray(origin.get.list()).map(nameToFile)
+ else origin.get.list().toList.map(nameToFile)
/** Gets the value of the <code>destination</code> attribute in a
* Scala-friendly form.
@@ -399,7 +399,7 @@ class Scaladoc extends MatchingTask {
*/
private def getSourcepath: List[File] =
if (sourcepath.isEmpty) error("Member 'sourcepath' is empty.")
- else List.fromArray(sourcepath.get.list()).map(nameToFile)
+ else sourcepath.get.list().toList.map(nameToFile)
/** Gets the value of the <code>bootclasspath</code> attribute in a
* Scala-friendly form.
@@ -408,7 +408,7 @@ class Scaladoc extends MatchingTask {
*/
private def getBootclasspath: List[File] =
if (bootclasspath.isEmpty) error("Member 'bootclasspath' is empty.")
- else List.fromArray(bootclasspath.get.list()).map(nameToFile)
+ else bootclasspath.get.list().toList.map(nameToFile)
/** Gets the value of the <code>extdirs</code> attribute in a
* Scala-friendly form.
@@ -417,7 +417,7 @@ class Scaladoc extends MatchingTask {
*/
private def getExtdirs: List[File] =
if (extdirs.isEmpty) error("Member 'extdirs' is empty.")
- else List.fromArray(extdirs.get.list()).map(nameToFile)
+ else extdirs.get.list().toList.map(nameToFile)
/*============================================================================*\
** Compilation and support methods **
@@ -513,7 +513,7 @@ class Scaladoc extends MatchingTask {
originFile <- {
val includedFiles =
getDirectoryScanner(originDir).getIncludedFiles()
- val list = List.fromArray(includedFiles)
+ val list = includedFiles.toList
if (list.length > 0)
log(
"Documenting " + list.length + " source file" +
@@ -566,7 +566,7 @@ class Scaladoc extends MatchingTask {
log("Scaladoc params = '" + addParams + "'", Project.MSG_DEBUG)
var args =
if (addParams.trim() == "") Nil
- else List.fromArray(addParams.trim().split(" ")).map(_.trim())
+ else addParams.trim().split(" ").toList.map(_.trim())
while (!args.isEmpty) {
if (args.head startsWith "-") {
diff --git a/src/compiler/scala/tools/ant/sabbus/Compilers.scala b/src/compiler/scala/tools/ant/sabbus/Compilers.scala
index b1566fd12c..33a328f140 100644
--- a/src/compiler/scala/tools/ant/sabbus/Compilers.scala
+++ b/src/compiler/scala/tools/ant/sabbus/Compilers.scala
@@ -18,7 +18,7 @@ object Compilers extends collection.DefaultMap[String, Compiler] {
private val container = new collection.mutable.HashMap[String, Compiler]
- def elements = container.elements
+ def iterator = container.iterator
def get(id: String) = container.get(id)
diff --git a/src/compiler/scala/tools/nsc/ConsoleWriter.scala b/src/compiler/scala/tools/nsc/ConsoleWriter.scala
index c8a1901683..f77f2541a5 100644
--- a/src/compiler/scala/tools/nsc/ConsoleWriter.scala
+++ b/src/compiler/scala/tools/nsc/ConsoleWriter.scala
@@ -20,7 +20,7 @@ class ConsoleWriter extends Writer {
def write(cbuf: Array[Char], off: Int, len: Int) {
if (len > 0)
- write(new String(cbuf.subArray(off, off+len)))
+ write(new String(cbuf.slice(off, off+len)))
}
override def write(str: String) { Console.print(str) }
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala
index bb3e37e291..ecf2bc521c 100644
--- a/src/compiler/scala/tools/nsc/Global.scala
+++ b/src/compiler/scala/tools/nsc/Global.scala
@@ -728,7 +728,7 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable
}
/* An iterator returning all the units being compiled in this run */
- def units: Iterator[CompilationUnit] = unitbuf.elements
+ def units: Iterator[CompilationUnit] = unitbuf.iterator
/** A map from compiled top-level symbols to their source files */
val symSource = new HashMap[Symbol, AbstractFile]
@@ -792,7 +792,7 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable
showDef(newTermName(settings.Xshowobj.value), true)
if (reporter.hasErrors) {
- for ((sym, file) <- symSource.elements) {
+ for ((sym, file) <- symSource.iterator) {
sym.reset(new loaders.SourcefileLoader(file))
if (sym.isTerm) sym.moduleClass.reset(loaders.moduleClassLoader)
}
@@ -805,7 +805,7 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable
warning("there were unchecked warnings; re-run with " + settings.unchecked.name + " for details")
}
}
- for ((sym, file) <- symSource.elements) resetPackageClass(sym.owner)
+ for ((sym, file) <- symSource.iterator) resetPackageClass(sym.owner)
informTime("total", startTime)
dependencyAnalysis.writeToFile();
diff --git a/src/compiler/scala/tools/nsc/Main.scala b/src/compiler/scala/tools/nsc/Main.scala
index 36e0b67457..dbd9c496d6 100644
--- a/src/compiler/scala/tools/nsc/Main.scala
+++ b/src/compiler/scala/tools/nsc/Main.scala
@@ -43,7 +43,7 @@ object Main extends AnyRef with EvalLoop {
def process(args: Array[String]) {
val settings = new Settings(error)
reporter = new ConsoleReporter(settings)
- val command = new CompilerCommand(List.fromArray(args), settings, error, false)
+ val command = new CompilerCommand(args.toList, settings, error, false)
if (command.settings.version.value)
reporter.info(null, versionMsg, true)
else {
diff --git a/src/compiler/scala/tools/nsc/MainTokenMetric.scala b/src/compiler/scala/tools/nsc/MainTokenMetric.scala
index 20b4b2c48b..760ab12822 100644
--- a/src/compiler/scala/tools/nsc/MainTokenMetric.scala
+++ b/src/compiler/scala/tools/nsc/MainTokenMetric.scala
@@ -37,7 +37,7 @@ object MainTokenMetric {
def process(args: Array[String]) {
val settings = new Settings(error)
reporter = new ConsoleReporter(settings)
- val command = new CompilerCommand(List.fromArray(args), settings, error, false)
+ val command = new CompilerCommand(args.toList, settings, error, false)
try {
val compiler = new Global(command.settings, reporter)
tokenMetric(compiler, command.files)
diff --git a/src/compiler/scala/tools/nsc/ScalaDoc.scala b/src/compiler/scala/tools/nsc/ScalaDoc.scala
index 564207c478..6f8c258cc2 100644
--- a/src/compiler/scala/tools/nsc/ScalaDoc.scala
+++ b/src/compiler/scala/tools/nsc/ScalaDoc.scala
@@ -33,7 +33,7 @@ object ScalaDoc {
def process(args: Array[String]) {
val docSettings : doc.Settings = new doc.Settings(error)
reporter = new ConsoleReporter(docSettings)
- val command = new CompilerCommand(List.fromArray(args), docSettings, error, false)
+ val command = new CompilerCommand(args.toList, docSettings, error, false)
if (command.settings.version.value)
reporter.info(null, versionMsg, true)
else {
diff --git a/src/compiler/scala/tools/nsc/ast/Trees.scala b/src/compiler/scala/tools/nsc/ast/Trees.scala
index 12c5c9c46d..3293b08a39 100644
--- a/src/compiler/scala/tools/nsc/ast/Trees.scala
+++ b/src/compiler/scala/tools/nsc/ast/Trees.scala
@@ -1464,23 +1464,23 @@ trait Trees {
}
def transformTrees(trees: List[Tree]): List[Tree] =
- List.mapConserve(trees)(transform)
+ trees mapConserve (transform(_))
def transformTemplate(tree: Template): Template =
transform(tree: Tree).asInstanceOf[Template]
def transformTypeDefs(trees: List[TypeDef]): List[TypeDef] =
- List.mapConserve(trees)(tree => transform(tree).asInstanceOf[TypeDef])
+ trees mapConserve (tree => transform(tree).asInstanceOf[TypeDef])
def transformValDef(tree: ValDef): ValDef =
if (tree.isEmpty) tree else transform(tree).asInstanceOf[ValDef]
def transformValDefs(trees: List[ValDef]): List[ValDef] =
- List.mapConserve(trees)(transformValDef)
+ trees mapConserve (transformValDef(_))
def transformValDefss(treess: List[List[ValDef]]): List[List[ValDef]] =
- List.mapConserve(treess)(transformValDefs)
+ treess mapConserve (transformValDefs(_))
def transformCaseDefs(trees: List[CaseDef]): List[CaseDef] =
- List.mapConserve(trees)(tree => transform(tree).asInstanceOf[CaseDef])
+ trees mapConserve (tree => transform(tree).asInstanceOf[CaseDef])
def transformIdents(trees: List[Ident]): List[Ident] =
- List.mapConserve(trees)(tree => transform(tree).asInstanceOf[Ident])
+ trees mapConserve (tree => transform(tree).asInstanceOf[Ident])
def transformStats(stats: List[Tree], exprOwner: Symbol): List[Tree] =
- List.mapConserve(stats)(stat =>
+ stats mapConserve (stat =>
if (exprOwner != currentOwner && stat.isTerm) atOwner(exprOwner)(transform(stat))
else transform(stat)) filter (EmptyTree !=)
def transformUnit(unit: CompilationUnit) { unit.body = transform(unit.body) }
@@ -1789,7 +1789,7 @@ trait Trees {
override def end: Int = original.pos.end
override def underlying = original.pos.underlying
override def focus = original.pos.focus
- override def show = "["+underlying.show+"]"
+ override def show = "["+ underlying.show +"]"
}
}
diff --git a/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala b/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala
index 2630bf374d..abcca4b79c 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala
@@ -173,7 +173,7 @@ abstract class SymbolicXMLBuilder(make: TreeBuilder, p: Parsers # Parser, preser
def parseAttribute(pos: Position, s: String): Tree = {
val ns = xml.Utility.parseAttributeValue(s)
val ts: ListBuffer[Tree] = new ListBuffer
- val it = ns.elements
+ val it = ns.iterator
while (it.hasNext) it.next match {
case Text(s) => ts += text(pos, s) // makeText1(Literal(Constant(s)))
case EntityRef(s) => ts += entityRef(pos, s)
@@ -209,7 +209,7 @@ abstract class SymbolicXMLBuilder(make: TreeBuilder, p: Parsers # Parser, preser
//var _buffer = New( _scala_xml_NodeBuffer, List(Nil))
var as:List[Tree] = ValDef(NoMods, _buf, TypeTree(), New( _scala_xml_NodeBuffer, List(Nil)))::Nil
- val it = args.elements
+ val it = args.iterator
while (it.hasNext) {
val t = it.next
if (!isEmptyText(t)) {
@@ -264,7 +264,7 @@ abstract class SymbolicXMLBuilder(make: TreeBuilder, p: Parsers # Parser, preser
}
/* DEBUG */
- val attrIt = attrMap.keys
+ val attrIt = attrMap.keysIterator
while (attrIt.hasNext) {
val z = attrIt.next
if (z startsWith "xmlns") { // handle namespace
@@ -317,7 +317,7 @@ abstract class SymbolicXMLBuilder(make: TreeBuilder, p: Parsers # Parser, preser
tlist2 = t :: tlist2
}
- var it = attrMap.elements
+ var it = attrMap.iterator
while (it.hasNext) {
val ansk = it.next
getPrefix(ansk._1) match {
diff --git a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
index 3c67b56e0b..8d334a9d78 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
@@ -64,11 +64,11 @@ abstract class TreeBuilder {
def init: Traverser = { buf.clear; this }
override def traverse(tree: Tree): Unit = tree match {
case Bind(name, Typed(tree1, tpt)) =>
- if ((name != nme.WILDCARD) && (buf.elements forall (name !=)))
+ if ((name != nme.WILDCARD) && (buf.iterator forall (name !=)))
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 !=)))
+ if ((name != nme.WILDCARD) && (buf.iterator forall (name !=)))
buf += ((name, TypeTree(), tree.pos))
traverse(tree1)
case _ =>
@@ -231,33 +231,33 @@ abstract class TreeBuilder {
*
* 1.
*
- * for (val P <- G) E ==> G.foreach (P => E)
+ * for (P <- G) E ==> G.foreach (P => E)
*
* Here and in the following (P => E) is interpreted as the function (P => E)
* if P is a a variable pattern and as the partial function { case P => E } otherwise.
*
* 2.
*
- * for (val P <- G) yield E ==> G.map (P => E)
+ * for (P <- G) yield E ==> G.map (P => E)
*
* 3.
*
- * for (val P_1 <- G_1; val P_2 <- G_2; ...) ...
+ * for (P_1 <- G_1; val P_2 <- G_2; ...) ...
* ==>
- * G_1.flatMap (P_1 => for (val P_2 <- G_2; ...) ...)
+ * G_1.flatMap (P_1 => for (P_2 <- G_2; ...) ...)
*
* 4.
*
- * for (val P <- G; E; ...) ...
+ * for (P <- G; E; ...) ...
* =>
- * for (val P <- G.filter (P => E); ...) ...
+ * for (P <- G.filter (P => E); ...) ...
*
* 5. For N < MaxTupleArity:
*
- * for (val P_1 <- G; val P_2 = E_2; val P_N = E_N; ...)
+ * for (P_1 <- G; val P_2 = E_2; val P_N = E_N; ...)
* ==>
- * for (val TupleN(P_1, P_2, ... P_N) <-
- * for (val x_1 @ P_1 <- G) yield {
+ * for (TupleN(P_1, P_2, ... P_N) <-
+ * for (x_1 @ P_1 <- G) yield {
* val x_2 @ P_2 = E_2
* ...
* val x_N & P_N = E_N
@@ -415,7 +415,7 @@ abstract class TreeBuilder {
val firstDef = ValDef(Modifiers(PRIVATE | LOCAL | SYNTHETIC | (mods.flags & LAZY)),
tmp, TypeTree(), matchExpr)
var cnt = 0
- val restDefs = for (val (vname, tpt, pos) <- vars) yield atPos(pos) {
+ val restDefs = for ((vname, tpt, pos) <- vars) yield atPos(pos) {
cnt = cnt + 1
ValDef(mods, vname, tpt, Select(Ident(tmp), newTermName("_" + cnt)))
}
diff --git a/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala b/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala
index b57bb2df16..4267b5c95e 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala
@@ -84,13 +84,15 @@ trait BasicBlocks {
override def toList: List[Instruction] = {
if (closed && touched)
- instructionList = List.fromArray(instrs)
+ instructionList = instrs.toList
instructionList
}
/** Return an iterator over the instructions in this basic block. */
- def elements: Iterator[Instruction] =
- if (closed) instrs.elements else instructionList.reverse.elements
+ def iterator: Iterator[Instruction] =
+ if (closed) instrs.iterator else instructionList.reverse.iterator
+
+ @deprecated def elements = iterator
/** return the underlying array of instructions */
def getArray: Array[Instruction] = {
@@ -436,7 +438,7 @@ trait BasicBlocks {
* in different code 'chunks' than the rest of the method.
*/
def predecessors: List[BasicBlock] = {
- preds = code.blocks.elements.filter (_.successors.contains(this)).toList
+ preds = code.blocks.iterator.filter (_.successors.contains(this)).toList
preds
}
diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
index 76a6498e2d..98237ef504 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
@@ -507,7 +507,7 @@ abstract class GenICode extends SubComponent {
tmp = ctx.makeLocal(tree.pos, tree.tpe, "tmp")
}
def duplicateFinalizer =
- (new DuplicateLabels(ctx.labels.keySet))(ctx, finalizer)
+ (new DuplicateLabels(ctx.labels.keys))(ctx, finalizer)
var handlers = for (CaseDef(pat, _, body) <- catches.reverse)
yield pat match {
@@ -1526,7 +1526,7 @@ abstract class GenICode extends SubComponent {
assert(ctx.clazz.symbol eq cls,
"Classes are not the same: " + ctx.clazz.symbol + ", " + cls)
- for (f <- cls.info.decls.elements)
+ for (f <- cls.info.decls.iterator)
if (!f.isMethod && f.isTerm)
ctx.clazz.addField(new IField(f));
}
diff --git a/src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala b/src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala
index 13bb286517..d69bf7dc1e 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala
@@ -156,7 +156,7 @@ trait Linearizers { self: ICodes =>
if (m.code.startBlock.predecessors eq Nil)
blocks
else
- m.code.startBlock :: (blocks.remove(_ == m.code.startBlock))
+ m.code.startBlock :: (blocks.filterNot(_ == m.code.startBlock))
}
def linearizeAt(m: IMethod, start: BasicBlock): List[BasicBlock] = {
diff --git a/src/compiler/scala/tools/nsc/backend/icode/Members.scala b/src/compiler/scala/tools/nsc/backend/icode/Members.scala
index a13c8751db..aba565d556 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/Members.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/Members.scala
@@ -79,7 +79,7 @@ trait Members { self: ICodes =>
/* This method applies the given function to each basic block. */
def traverseFeedBack(f: (BasicBlock, HashMap[BasicBlock, Boolean]) => Unit) = {
val visited : HashMap[BasicBlock, Boolean] = new HashMap;
- visited ++= blocks.elements.map(x => (x, false));
+ visited ++= blocks.iterator.map(x => (x, false));
var blockToVisit: List[BasicBlock] = List(startBlock)
@@ -274,7 +274,7 @@ trait Members { self: ICodes =>
} while (nextBlock.isDefinedAt(succ))
bb.close
} else
- bb = nextBlock.keys.next
+ bb = nextBlock.keysIterator.next
}
}
diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/DataFlowAnalysis.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/DataFlowAnalysis.scala
index 144223f866..23a28b4a2d 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/analysis/DataFlowAnalysis.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/DataFlowAnalysis.scala
@@ -56,7 +56,7 @@ trait DataFlowAnalysis[L <: CompleteLattice] {
while (!worklist.isEmpty) {
if (stat) iterations += 1
//Console.println("worklist in: " + worklist);
- val point = worklist.elements.next; worklist -= point; visited += point;
+ val point = worklist.iterator.next; worklist -= point; visited += point;
//Console.println("taking out point: " + point + " worklist out: " + worklist);
val output = f(point, in(point))
@@ -88,7 +88,7 @@ trait DataFlowAnalysis[L <: CompleteLattice] {
def backwardAnalysis(f: (P, lattice.Elem) => lattice.Elem): Unit =
while (!worklist.isEmpty) {
if (stat) iterations += 1
- val point = worklist.elements.next; worklist -= point
+ val point = worklist.iterator.next; worklist -= point
out(point) = lattice.lub(point.successors map in.apply)
val input = f(point, out(point))
diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala
index c5464a272e..6ffd1645db 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala
@@ -87,12 +87,12 @@ abstract class TypeFlowAnalysis {
val resultingLocals = new VarBinding
- for (binding1 <- env1.elements) {
+ for (binding1 <- env1.iterator) {
val tp2 = env2(binding1._1)
resultingLocals += ((binding1._1, typeLattice.lub2(binding1._2, tp2)))
}
- for (binding2 <- env2.elements if resultingLocals(binding2._1) eq typeLattice.bottom) {
+ for (binding2 <- env2.iterator if resultingLocals(binding2._1) eq typeLattice.bottom) {
val tp1 = env1(binding2._1)
resultingLocals += ((binding2._1, typeLattice.lub2(binding2._2, tp1)))
}
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
index ef39bb3f0d..ec58e71a50 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
@@ -464,7 +464,7 @@ abstract class GenJVM extends SubComponent {
return
val length = buf.position();
- val arr = buf.array().subArray(0, length);
+ val arr = buf.array().slice(0, length);
val attr = jmember.getContext().JOtherAttribute(jmember.getJClass(),
jmember,
@@ -476,7 +476,7 @@ abstract class GenJVM extends SubComponent {
def addInnerClasses(jclass: JClass) {
def addOwnInnerClasses(cls: Symbol) {
- for (sym <- cls.info.decls.elements if sym.isClass)
+ for (sym <- cls.info.decls.iterator if sym.isClass)
innerClasses = innerClasses + sym;
}
// add inner classes which might not have been referenced yet
diff --git a/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala b/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala
index 33abd62ee8..39fe0f4733 100644
--- a/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala
+++ b/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala
@@ -430,7 +430,7 @@ abstract class GenMSIL extends SubComponent {
}
val length = buf.position()
- buf.array().subArray(0, length)
+ buf.array().slice(0, length)
}
def writeAssembly() {
diff --git a/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala b/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala
index 3847c97a18..0c6f7cad23 100644
--- a/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala
+++ b/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala
@@ -135,7 +135,7 @@ abstract class DeadCodeElimination extends SubComponent {
def mark {
// log("Starting with worklist: " + worklist)
while (!worklist.isEmpty) {
- val (bb, idx) = worklist.elements.next
+ val (bb, idx) = worklist.iterator.next
worklist -= ((bb, idx))
if (settings.debug.value)
log("Marking instr: \tBB_" + bb + ": " + idx + " " + bb(idx))
diff --git a/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala b/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala
index 0ac08e0d6a..23a100ba44 100644
--- a/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala
+++ b/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala
@@ -83,7 +83,7 @@ abstract class Inliners extends SubComponent {
/* Map 'original' blocks to the ones inlined in the caller. */
val inlinedBlock: Map[BasicBlock, BasicBlock] = new HashMap
- val varsInScope: Set[Local] = new HashSet[Local] ++ block.varsInScope.elements
+ val varsInScope: Set[Local] = new HashSet[Local] ++ block.varsInScope.iterator
val instrBefore = block.toList.takeWhile {
case i @ SCOPE_ENTER(l) => varsInScope += l
diff --git a/src/compiler/scala/tools/nsc/doc/DefaultDocDriver.scala b/src/compiler/scala/tools/nsc/doc/DefaultDocDriver.scala
index a7d38d8245..adc48f6943 100644
--- a/src/compiler/scala/tools/nsc/doc/DefaultDocDriver.scala
+++ b/src/compiler/scala/tools/nsc/doc/DefaultDocDriver.scala
@@ -109,7 +109,7 @@ abstract class DefaultDocDriver extends DocDriver with ModelFrames with ModelToX
for (pp <- d.sym.tpe.parents) subClasses(pp.typeSymbol) += d
}
copyResources
- lazy val packages0 = sort(allClasses.keySet)
+ lazy val packages0 = sort(allClasses.keys)
new AllPackagesFrame with Frame { def packages = packages0 }
new PackagesContentFrame with Frame { def packages = packages0 }
new NavigationFrame with Frame { }
diff --git a/src/compiler/scala/tools/nsc/doc/DocUtil.scala b/src/compiler/scala/tools/nsc/doc/DocUtil.scala
index 4012143535..096c1b8374 100644
--- a/src/compiler/scala/tools/nsc/doc/DocUtil.scala
+++ b/src/compiler/scala/tools/nsc/doc/DocUtil.scala
@@ -90,14 +90,14 @@ object DocUtil {
def merge[T,S <: Ordered[S]](ts0: ListMap[T,TreeSet[S]],
ts1: ListMap[T,TreeSet[S]]): ListMap[T,TreeSet[S]] = {
var ts = ts0
- for (t <- ts1.elements) {
+ for (t <- ts1.iterator) {
if (!ts.contains(t._1))
ts = ts.updated(t._1, new TreeSet[S]);
ts = ts.updated(t._1, merge(ts(t._1), t._2))
}
ts
}
- implicit def coerceIterable[T](list : Iterable[T]) = NodeWrapper(list.elements)
+ implicit def coerceIterable[T](list : Iterable[T]) = NodeWrapper(list.iterator)
implicit def coerceIterator[T](list : Iterator[T]) = NodeWrapper(list)
case class NodeWrapper[T](list : Iterator[T]) {
diff --git a/src/compiler/scala/tools/nsc/doc/ModelExtractor.scala b/src/compiler/scala/tools/nsc/doc/ModelExtractor.scala
index 8b900e44a7..7261043505 100644
--- a/src/compiler/scala/tools/nsc/doc/ModelExtractor.scala
+++ b/src/compiler/scala/tools/nsc/doc/ModelExtractor.scala
@@ -231,7 +231,7 @@ trait ModelExtractor {
val str = flagsToString(arg.flags)
assert((arg hasFlag PRIVATE) && (arg hasFlag LOCAL), arg)
val argName = arg.name.toString.trim
- val actual = sym.tpe.decls.elements.find(e => {
+ val actual = sym.tpe.decls.iterator.find(e => {
val eName = e.name.toString.trim;
argName == eName && {
val str = flagsToString(e.flags);
@@ -243,7 +243,7 @@ trait ModelExtractor {
});
}
object decls extends mutable.LinkedHashMap[Symbol, Member] {
- sym.tpe.decls.elements.foreach(e => {
+ sym.tpe.decls.iterator.foreach(e => {
if (!constructorArgs.contains(e)) {
val m = Member(e)
if (!m.isEmpty && !this.contains(e)) this.put(e, m.get)
@@ -254,7 +254,7 @@ trait ModelExtractor {
def members(c: Category): Iterable[Member] = members0(c.f)
object inherited extends mutable.LinkedHashMap[Symbol, List[Member]]() {
override def default(tpe: Symbol) = Nil
- for (m <- sym.tpe.members if !sym.tpe.decls.elements.contains(m) &&
+ for (m <- sym.tpe.members if !sym.tpe.decls.iterator.contains(m) &&
(Values.f(m) || Methods.f(m))) {
val o = m.overridingSymbol(sym)
if (o == NoSymbol) {
diff --git a/src/compiler/scala/tools/nsc/doc/ModelToXML.scala b/src/compiler/scala/tools/nsc/doc/ModelToXML.scala
index b3c1a6ab26..dc8f6a1771 100644
--- a/src/compiler/scala/tools/nsc/doc/ModelToXML.scala
+++ b/src/compiler/scala/tools/nsc/doc/ModelToXML.scala
@@ -243,7 +243,7 @@ trait ModelToXML extends ModelExtractor {
def longList(entity: ClassOrObject, category: Category)(implicit from: Frame): NodeSeq = {
val xs = entity.members(category)
- if (!xs.elements.hasNext)
+ if (!xs.iterator.hasNext)
NodeSeq.Empty
else Group(
<table cellpadding="3" class="member-detail" summary="">
@@ -255,7 +255,7 @@ trait ModelToXML extends ModelExtractor {
def shortList(entity: ClassOrObject, category: Category)(implicit from: Frame): NodeSeq = {
val xs = entity.members(category)
var seq: NodeSeq = NodeSeq.Empty
- if (xs.elements.hasNext) {
+ if (xs.iterator.hasNext) {
// alphabetic
val set = new scala.collection.immutable.TreeSet[entity.Member]()(mA => new Ordered[entity.Member] {
def compare(mB: entity.Member): Int =
diff --git a/src/compiler/scala/tools/nsc/io/AbstractFile.scala b/src/compiler/scala/tools/nsc/io/AbstractFile.scala
index 0c793eb9de..169c230c69 100644
--- a/src/compiler/scala/tools/nsc/io/AbstractFile.scala
+++ b/src/compiler/scala/tools/nsc/io/AbstractFile.scala
@@ -151,7 +151,9 @@ abstract class AbstractFile extends AnyRef with Iterable[AbstractFile] {
}
/** Returns all abstract subfiles of this abstract directory. */
- def elements: Iterator[AbstractFile]
+ def iterator: Iterator[AbstractFile]
+
+ @deprecated def elements = iterator
/** Returns the abstract file in this abstract directory with the specified
* name. If there is no such file, returns <code>null</code>. The argument
diff --git a/src/compiler/scala/tools/nsc/io/PlainFile.scala b/src/compiler/scala/tools/nsc/io/PlainFile.scala
index 8b4a867d76..6b11295d49 100644
--- a/src/compiler/scala/tools/nsc/io/PlainFile.scala
+++ b/src/compiler/scala/tools/nsc/io/PlainFile.scala
@@ -54,11 +54,11 @@ class PlainFile(val file: File) extends AbstractFile {
def lastModified: Long = file.lastModified()
/** Returns all abstract subfiles of this abstract directory. */
- def elements: Iterator[AbstractFile] = {
+ def iterator: Iterator[AbstractFile] = {
assert(isDirectory, "not a directory '" + this + "'")
val names: Array[String] = file.list()
if ((names eq null) || names.length == 0) Iterator.empty
- else names.elements.map { name: String => new File(file, name) }
+ else names.iterator.map { name: String => new File(file, name) }
.filter(_.exists).map(file => new PlainFile(file))
}
diff --git a/src/compiler/scala/tools/nsc/io/VirtualDirectory.scala b/src/compiler/scala/tools/nsc/io/VirtualDirectory.scala
index 29ec6b2344..403d59d289 100644
--- a/src/compiler/scala/tools/nsc/io/VirtualDirectory.scala
+++ b/src/compiler/scala/tools/nsc/io/VirtualDirectory.scala
@@ -31,7 +31,7 @@ extends AbstractFile {
// the toList is so that the directory may continue to be
// modified while its elements are iterated
- def elements = files.values.toList.elements
+ def iterator = files.values.toList.iterator
override def lookupName(name: String, directory: Boolean): AbstractFile = {
files.get(name) match {
diff --git a/src/compiler/scala/tools/nsc/io/VirtualFile.scala b/src/compiler/scala/tools/nsc/io/VirtualFile.scala
index 36e48614bf..0b9c703757 100644
--- a/src/compiler/scala/tools/nsc/io/VirtualFile.scala
+++ b/src/compiler/scala/tools/nsc/io/VirtualFile.scala
@@ -72,7 +72,7 @@ class VirtualFile(val name: String, _path: String) extends AbstractFile {
def lastModified: Long = Math.MIN_LONG
/** Returns all abstract subfiles of this abstract directory. */
- def elements: Iterator[AbstractFile] = {
+ def iterator: Iterator[AbstractFile] = {
assert(isDirectory, "not a directory '" + this + "'")
Iterator.empty
}
diff --git a/src/compiler/scala/tools/nsc/io/ZipArchive.scala b/src/compiler/scala/tools/nsc/io/ZipArchive.scala
index af595720c5..ab730128bd 100644
--- a/src/compiler/scala/tools/nsc/io/ZipArchive.scala
+++ b/src/compiler/scala/tools/nsc/io/ZipArchive.scala
@@ -85,9 +85,9 @@ final class ZipArchive(file: File, val archive: ZipFile) extends PlainFile(file)
override def isDirectory = true
/** Returns all abstract subfiles of this abstract directory. */
- override def elements: Iterator[AbstractFile] = {
+ override def iterator: Iterator[AbstractFile] = {
if (root eq null) load()
- root.elements
+ root.iterator
}
/**
@@ -189,7 +189,7 @@ final class ZipArchive(file: File, val archive: ZipFile) extends PlainFile(file)
override def lastModified: Long =
if (entry ne null) entry.getTime() else super.lastModified
- override def elements: Iterator[AbstractFile] = entries.values
+ override def iterator: Iterator[AbstractFile] = entries.valuesIterator
override def lookupName(name: String, directory: Boolean): AbstractFile =
entries.get(if (directory) name + "/" else name) match {
@@ -241,9 +241,9 @@ final class URLZipArchive(url: URL) extends AbstractFile {
def output = throw new Error("unsupported")
- override def elements: Iterator[AbstractFile] = {
+ override def iterator: Iterator[AbstractFile] = {
if (root eq null) load()
- root.elements
+ root.iterator
}
override def lookupName(name: String, directory: Boolean): AbstractFile = {
@@ -324,7 +324,7 @@ final class URLZipArchive(url: URL) extends AbstractFile {
override def lastModified: Long =
if (entry ne null) entry.getTime() else super.lastModified
- override def elements: Iterator[AbstractFile] = entries.values
+ override def iterator: Iterator[AbstractFile] = entries.valuesIterator
override def lookupName(name: String, directory: Boolean): AbstractFile =
entries.get(if (directory) name + "/" else name) match {
diff --git a/src/compiler/scala/tools/nsc/symtab/Constants.scala b/src/compiler/scala/tools/nsc/symtab/Constants.scala
index 116e34f97b..04e2e5181c 100644
--- a/src/compiler/scala/tools/nsc/symtab/Constants.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Constants.scala
@@ -201,7 +201,7 @@ trait Constants {
def escapedStringValue: String = {
def escape(text: String): String = {
val buf = new StringBuilder
- for (c <- text.elements)
+ for (c <- text.iterator)
if (c.isControl)
buf.append("\\0" + toOctalString(c.asInstanceOf[Int]))
else
diff --git a/src/compiler/scala/tools/nsc/symtab/Scopes.scala b/src/compiler/scala/tools/nsc/symtab/Scopes.scala
index c42c3219ba..29a01cf9c1 100644
--- a/src/compiler/scala/tools/nsc/symtab/Scopes.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Scopes.scala
@@ -344,7 +344,9 @@ trait Scopes {
/** Return all symbols as an interator in the order they were entered in this scope.
*/
- def elements: Iterator[Symbol] = toList.elements
+ def iterator: Iterator[Symbol] = toList.iterator
+
+ @deprecated def elements = iterator
def filter(p: Symbol => Boolean): Scope =
if (!(toList forall p)) newScope(toList filter p) else this
diff --git a/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala b/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala
index b24aadb909..8758239629 100644
--- a/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala
+++ b/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala
@@ -175,7 +175,7 @@ abstract class SymbolLoaders {
}
// do classes first
- for ((name, file) <- classes.elements) {
+ for ((name, file) <- classes.iterator) {
val loader = if (!file.isSourceFile) {
new ClassfileLoader(file.classFile, file.sourceFile, file.sourcePath)
} else {
@@ -186,7 +186,7 @@ abstract class SymbolLoaders {
}
// packages second
- for ((name, file) <- packages.elements)
+ for ((name, file) <- packages.iterator)
enterPackage(name, newPackageLoader(file))
// if there's a $member object, enter its members as well.
@@ -198,7 +198,7 @@ abstract class SymbolLoaders {
def openPackageModule(m: Symbol) = {
val owner = m.owner
- for (member <- m.info.decls.elements) {
+ for (member <- m.info.decls.iterator) {
// todo: handle overlapping definitions in some way: mark as errors
// or treat as abstractions. For now the symbol in the package module takes precedence.
for (existing <- owner.info.decl(member.name).alternatives)
@@ -235,7 +235,7 @@ abstract class SymbolLoaders {
super.doComplete(root)
- for (namespace <- namespaces.elements) {
+ for (namespace <- namespaces.iterator) {
val oldPkg = root.info.decls lookup newTermName(namespace)
if (oldPkg == NoSymbol)
enterPackage(namespace, new NamespaceLoader(new classPath0.Context(List())))
@@ -243,7 +243,7 @@ abstract class SymbolLoaders {
}
// import the CLR types contained in the package (namespace)
- for ((name, typ) <- types.elements) {
+ for ((name, typ) <- types.iterator) {
assert(namespace == typ.Namespace, typ.FullName)
if (typ.IsDefined(clrTypes.SCALA_SYMTAB_ATTR, false)) {
diff --git a/src/compiler/scala/tools/nsc/symtab/SymbolWalker.scala b/src/compiler/scala/tools/nsc/symtab/SymbolWalker.scala
index e663011d7c..c5218346b6 100644
--- a/src/compiler/scala/tools/nsc/symtab/SymbolWalker.scala
+++ b/src/compiler/scala/tools/nsc/symtab/SymbolWalker.scala
@@ -24,11 +24,11 @@ trait SymbolWalker {
def f(t : Tree) : Unit = {
if (visited.add(t)) return
def fs(l : List[Tree]) : Unit = {
- val i = l.elements
+ val i = l.iterator
while (i.hasNext) f(i.next)
}
def fss(l : List[List[Tree]]) : Unit = {
- val i = l.elements
+ val i = l.iterator
while (i.hasNext) fs(i.next)
}
if (t.isInstanceOf[StubTree]) return
@@ -109,8 +109,8 @@ trait SymbolWalker {
(t) match {
case (t : MemberDef) if t.symbol != null && t.symbol != NoSymbol =>
val annotated = if (sym.isModule) sym.moduleClass else sym
- val i = t.mods.annotations.elements
- val j = annotated.attributes.elements
+ val i = t.mods.annotations.iterator
+ val j = annotated.attributes.iterator
while (i.hasNext && j.hasNext) {
val tree = i.next.constr
val ainfo = j.next
@@ -156,8 +156,8 @@ trait SymbolWalker {
case tree : UnApply => f(tree.fun); fs(tree.args)
case tree : AppliedTypeTree =>
if (tree.tpe != null) {
- val i = tree.tpe.typeArgs.elements
- val j = tree.args.elements
+ val i = tree.tpe.typeArgs.iterator
+ val j = tree.args.iterator
while (i.hasNext && j.hasNext) {
val tpe = i.next
val arg = j.next
diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala
index 6411ddf532..33fdfaf76b 100644
--- a/src/compiler/scala/tools/nsc/symtab/Types.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Types.scala
@@ -1047,7 +1047,7 @@ trait Types {
baseTypeSeqCache.normalize(parents)
// println("normalized baseTypeSeq of "+typeSymbol+"/"+parents+": "+baseTypeSeqCache)//DEBUG
}
- //Console.println("baseTypeSeq(" + typeSymbol + ") = " + List.fromArray(baseTypeSeqCache));//DEBUG
+ //Console.println("baseTypeSeq(" + typeSymbol + ") = " + baseTypeSeqCache.toList);//DEBUG
}
if (baseTypeSeqCache eq undetBaseTypeSeq)
throw new TypeError("illegal cyclic inheritance involving " + typeSymbol)
@@ -1176,7 +1176,7 @@ trait Types {
case ps @ (_ :: ps1) =>
(ps ne parents) ||
(ps1 exists contributesAbstractMembers) ||
- (decls.elements exists (m => m.isDeferred && isVisible(m)))
+ (decls.iterator exists (m => m.isDeferred && isVisible(m)))
case _ =>
false
})
@@ -1296,7 +1296,7 @@ trait Types {
val lastRefs = Array(refs(0), refs(1))
state = Initialized
var change = false
- for ((from, targets) <- refs(NonExpansive).elements)
+ for ((from, targets) <- refs(NonExpansive).iterator)
for (target <- targets) {
var thatInfo = classInfo(target)
if (thatInfo.state != Initialized)
@@ -1304,7 +1304,7 @@ trait Types {
addRefs(NonExpansive, from, thatInfo.getRefs(NonExpansive, target))
addRefs(Expansive, from, thatInfo.getRefs(Expansive, target))
}
- for ((from, targets) <- refs(Expansive).elements)
+ for ((from, targets) <- refs(Expansive).iterator)
for (target <- targets) {
var thatInfo = classInfo(target)
addRefs(Expansive, from, thatInfo.getRefs(NonExpansive, target))
@@ -2376,7 +2376,7 @@ A type's typeSymbol should never be inspected directly.
else mkSuperType(thistp1, supertp1)
case TypeRef(pre, sym, args) =>
val pre1 = this(pre)
- //val args1 = List.mapConserve(args)(this)
+ //val args1 = args mapConserve this(_)
val args1 = if (args.isEmpty) args
else {
val tparams = sym.typeParams
@@ -4175,11 +4175,10 @@ A type's typeSymbol should never be inspected directly.
val glbThisType = glbRefined.typeSymbol.thisType
def glbsym(proto: Symbol): Symbol = {
val prototp = glbThisType.memberInfo(proto)
- val syms = for {
- val t <- ts
- val alt <- t.nonPrivateMember(proto.name).alternatives
- glbThisType.memberInfo(alt) matches prototp
- } yield alt
+ val syms = for (t <- ts;
+ alt <- (t.nonPrivateMember(proto.name).alternatives);
+ if glbThisType.memberInfo(alt) matches prototp
+ ) yield alt
val symtypes = syms map glbThisType.memberInfo
assert(!symtypes.isEmpty)
proto.cloneSymbol(glbRefined.typeSymbol).setInfo(
@@ -4210,7 +4209,7 @@ A type's typeSymbol should never be inspected directly.
try {
globalGlbDepth += 1
val dss = ts flatMap refinedToDecls
- for (ds <- dss; val sym <- ds.elements)
+ for (ds <- dss; val sym <- ds.iterator)
if (globalGlbDepth < globalGlbLimit && !(glbThisType specializes sym))
try {
addMember(glbThisType, glbRefined, glbsym(sym))
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/AbstractFileReader.scala b/src/compiler/scala/tools/nsc/symtab/classfile/AbstractFileReader.scala
index 3563c69646..19b24d0f67 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/AbstractFileReader.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/AbstractFileReader.scala
@@ -46,7 +46,7 @@ class AbstractFileReader(val file: AbstractFile) {
*/
def nextBytes(len: Int): Array[Byte] = {
bp += len
- buf.subArray(bp - len, bp)
+ buf.slice(bp - len, bp)
}
/** read a character
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala
index 6753ae3194..510183a22d 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala
@@ -682,7 +682,7 @@ abstract class ICodeReader extends ClassfileParser {
var otherBlock: BasicBlock = null
var disableJmpTarget = false
- for ((pc, instr) <- instrs.elements) {
+ for ((pc, instr) <- instrs.iterator) {
// Console.println("> " + pc + ": " + instr);
if (jmpTargets contains pc) {
otherBlock = blocks(pc)
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala b/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala
index 0f610f2538..052fe1647e 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala
@@ -178,7 +178,7 @@ abstract class Pickler extends SubComponent {
putType(lo); putType(hi)
case RefinedType(parents, decls) =>
val rclazz = tp.typeSymbol
- for (m <- decls.elements)
+ for (m <- decls.iterator)
if (m.owner != rclazz) assert(false, "bad refinement member "+m+" of "+tp+", owner = "+m.owner)
putSymbol(rclazz); putTypes(parents); putSymbols(decls.toList)
case ClassInfoType(parents, decls, clazz) =>
diff --git a/src/compiler/scala/tools/nsc/symtab/clr/CLRTypes.scala b/src/compiler/scala/tools/nsc/symtab/clr/CLRTypes.scala
index ff51038581..a0c2b07176 100644
--- a/src/compiler/scala/tools/nsc/symtab/clr/CLRTypes.scala
+++ b/src/compiler/scala/tools/nsc/symtab/clr/CLRTypes.scala
@@ -161,7 +161,7 @@ abstract class CLRTypes {
*/
private def findAssembly(name: String): Assembly = {
// see if the assembly is referenced directly
- for (file <- global.assemrefs.elements if file.getName() == name) {
+ for (file <- global.assemrefs.iterator if file.getName() == name) {
val assem = Assembly.LoadFrom(file.getPath())
if (assem != null) {
global.assemrefs -= file
@@ -170,7 +170,7 @@ abstract class CLRTypes {
}
}
// look in directories specified with the '-r' option
- for (dir <- global.assemrefs.elements if dir.isDirectory()) {
+ for (dir <- global.assemrefs.iterator if dir.isDirectory()) {
val file = new File(dir, name)
if (file.exists()) {
val assem = Assembly.LoadFrom(file.getPath())
@@ -196,7 +196,7 @@ abstract class CLRTypes {
/** Load the rest of the assemblies specified with the '-r' option
*/
private def findAllAssemblies() {
- for (file <- global.assemrefs.elements) {
+ for (file <- global.assemrefs.iterator) {
if (file.isFile()) {
//System.out.println("Loading assembly " + file)
val assem = Assembly.LoadFrom(file.getPath())
diff --git a/src/compiler/scala/tools/nsc/symtab/clr/TypeParser.scala b/src/compiler/scala/tools/nsc/symtab/clr/TypeParser.scala
index 3a0ef52113..81b2df32ee 100644
--- a/src/compiler/scala/tools/nsc/symtab/clr/TypeParser.scala
+++ b/src/compiler/scala/tools/nsc/symtab/clr/TypeParser.scala
@@ -222,7 +222,7 @@ abstract class TypeParser {
}
} */
- for (method <- methodsSet.elements)
+ for (method <- methodsSet.iterator)
if (!method.IsPrivate() && !method.IsAssembly() && !method.IsFamilyAndAssembly())
createMethod(method);
diff --git a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
index 0d94658118..b7418f7827 100644
--- a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
+++ b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
@@ -133,7 +133,7 @@ abstract class AddInterfaces extends InfoTransform {
if ((ifaceDecls lookup nme.MIXIN_CONSTRUCTOR) == NoSymbol)
decls enter (implClass.newMethod(implClass.pos, nme.MIXIN_CONSTRUCTOR)
setInfo MethodType(List(), UnitClass.tpe))
- for (sym <- ifaceDecls.elements) {
+ for (sym <- ifaceDecls.iterator) {
if (isInterfaceMember(sym)) {
if (needsImplMethod(sym)) {
val impl = sym.cloneSymbol(implClass).setInfo(sym.info).resetFlag(lateDEFERRED)
diff --git a/src/compiler/scala/tools/nsc/transform/Constructors.scala b/src/compiler/scala/tools/nsc/transform/Constructors.scala
index 31ef241ac8..41137e0798 100644
--- a/src/compiler/scala/tools/nsc/transform/Constructors.scala
+++ b/src/compiler/scala/tools/nsc/transform/Constructors.scala
@@ -249,7 +249,7 @@ abstract class Constructors extends Transform {
// first traverse all definitions except outeraccesors
// (outeraccessors are avoided in accessTraverser)
- for (stat <- defBuf.elements) accessTraverser.traverse(stat)
+ for (stat <- defBuf.iterator) accessTraverser.traverse(stat)
// then traverse all bodies of outeraccessors which are accessed themselves
// note: this relies on the fact that an outer accessor never calls another
diff --git a/src/compiler/scala/tools/nsc/transform/LambdaLift.scala b/src/compiler/scala/tools/nsc/transform/LambdaLift.scala
index 8d9069ca7b..52c75fc70e 100644
--- a/src/compiler/scala/tools/nsc/transform/LambdaLift.scala
+++ b/src/compiler/scala/tools/nsc/transform/LambdaLift.scala
@@ -182,7 +182,7 @@ abstract class LambdaLift extends InfoTransform {
}
*/
def freeVars(sym: Symbol): Iterator[Symbol] = free.get(sym) match {
- case Some(ss) => ss.elements
+ case Some(ss) => ss.iterator
case None => Iterator.empty
}
@@ -238,12 +238,12 @@ abstract class LambdaLift extends InfoTransform {
do {
changedFreeVars = false
for (caller <- called.keys;
- callee <- called(caller).elements;
+ callee <- called(caller).iterator;
fv <- freeVars(callee))
markFree(fv, caller)
} while (changedFreeVars);
- for (sym <- renamable.elements) {
+ for (sym <- renamable.iterator) {
val base =
if (sym.isAnonymousFunction && sym.owner.isMethod)
sym.name.toString() + "$" + sym.owner.name.toString() + "$"
@@ -256,9 +256,9 @@ abstract class LambdaLift extends InfoTransform {
atPhase(phase.next) {
for (owner <- free.keys) {
if (settings.debug.value)
- log("free(" + owner + owner.locationString + ") = " + free(owner).elements.toList);
+ log("free(" + owner + owner.locationString + ") = " + free(owner).iterator.toList);
proxies(owner) =
- for (fv <- free(owner).elements.toList) yield {
+ for (fv <- free(owner).iterator.toList) yield {
val proxy = owner.newValue(owner.pos, fv.name)
.setFlag(if (owner.isClass) PARAMACCESSOR | PRIVATE | LOCAL else PARAM)
.setFlag(SYNTHETIC)
diff --git a/src/compiler/scala/tools/nsc/transform/Mixin.scala b/src/compiler/scala/tools/nsc/transform/Mixin.scala
index c41ade3ea7..f1ee06db45 100644
--- a/src/compiler/scala/tools/nsc/transform/Mixin.scala
+++ b/src/compiler/scala/tools/nsc/transform/Mixin.scala
@@ -749,7 +749,7 @@ abstract class Mixin extends InfoTransform {
// parents != baseClasses.map(_.tpe): bug #1535
val fields = for {
sc <- clazz.info.baseClasses.map(_.tpe)
- field <- sc.decls.elements.toList
+ field <- sc.decls.iterator.toList
if needsBitmapField(sc, field)
} yield field
@@ -764,7 +764,7 @@ abstract class Mixin extends InfoTransform {
*/
def buildFieldPositions(clazz: Symbol) {
var fields = usedBits(clazz)
- for (f <- clazz.info.decls.elements if needsInitFlag(f) || f.hasFlag(LAZY)) {
+ for (f <- clazz.info.decls.iterator if needsInitFlag(f) || f.hasFlag(LAZY)) {
if (settings.debug.value) log(f.fullNameString + " -> " + fields)
fieldOffset(f) = fields
fields += 1
diff --git a/src/compiler/scala/tools/nsc/transform/Reifiers.scala b/src/compiler/scala/tools/nsc/transform/Reifiers.scala
index 9a0a1b6526..5973fa07e8 100644
--- a/src/compiler/scala/tools/nsc/transform/Reifiers.scala
+++ b/src/compiler/scala/tools/nsc/transform/Reifiers.scala
@@ -188,7 +188,7 @@ trait Reifiers {
case Some(tgt) => tgt
}
def hasAllTargets: Boolean =
- targets.elements.map(_._2).forall {
+ targets.iterator.map(_._2).forall {
case Some(_) => true
case None => false
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/IdeSupport.scala b/src/compiler/scala/tools/nsc/typechecker/IdeSupport.scala
index c933b281cb..6d5ad19f5c 100644
--- a/src/compiler/scala/tools/nsc/typechecker/IdeSupport.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/IdeSupport.scala
@@ -49,7 +49,7 @@ trait IdeSupport extends Analyzer {
val oldType = oldTypeFor(sym0)
oldType match {
case PolyType(xxx,_) =>
- val i = xxx.elements
+ val i = xxx.iterator
var pause = false
while (i.hasNext) {
if (i.next.pos == util.NoPosition) pause = true
diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
index 3e86181b73..a828e9165e 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
@@ -467,13 +467,13 @@ self: Analyzer =>
}
/** A candidate for best applicable info wrt `improves` */
- val best = (NoImplicitInfo /: applicable.keySet) (
+ val best = (NoImplicitInfo /: applicable.keys) (
(best, alt) => if (improves(alt, best)) alt else best)
if (best == NoImplicitInfo) SearchFailure
else {
/** The list of all applicable infos which are not improved upon by `best`. */
- val competing = applicable.keySet dropWhile (alt => best == alt || improves(best, alt))
- if (!competing.isEmpty) ambiguousImplicitError(best, competing.elements.next, "both", "and", "") // !!! streamline when new collection is there
+ val competing = applicable.keys dropWhile (alt => best == alt || improves(best, alt))
+ if (!competing.isEmpty) ambiguousImplicitError(best, competing.iterator.next, "both", "and", "") // !!! streamline when new collection is there
// Also check that applicable infos that did not get selected are not
// in (a companion object of) a subclass of (a companion object of) the class
@@ -564,7 +564,7 @@ self: Analyzer =>
else t :: compactify(ts1 remove (pre <:< _.prefix))
}
getParts(tp)
- for ((k, ts) <- partMap.elements.toList; t <- compactify(ts)) yield t
+ for ((k, ts) <- partMap.iterator.toList; t <- compactify(ts)) yield t
}
/** The implicits made available by type `pt`.
@@ -572,7 +572,7 @@ self: Analyzer =>
* such that some part of `tp` has C as one of its superclasses.
*/
private def implicitsOfExpectedType: List[List[ImplicitInfo]] =
- parts(pt).elements.map(implicitsOfClass).toList
+ parts(pt).iterator.map(implicitsOfClass).toList
/** The manifest corresponding to type `pt`, provided `pt` is an instance of Manifest.
*/
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
index 360ab6d09d..37f2c266cd 100644
--- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
@@ -331,7 +331,7 @@ abstract class RefChecks extends InfoTransform {
//
// (3) is violated but not (2).
def checkNoAbstractDecls(bc: Symbol) {
- for (decl <- bc.info.decls.elements) {
+ for (decl <- bc.info.decls.iterator) {
if (decl.isDeferred && !isAbstractTypeWithoutFBound(decl)) {
val impl = decl.matchingSymbol(clazz.thisType)
if (impl == NoSymbol || (decl.owner isSubClass impl.owner)) {
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 68ae453793..33316d8da0 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -2135,7 +2135,7 @@ trait Typers { self: Analyzer =>
val attrScope = annType.decls
.filter(sym => sym.isMethod && !sym.isConstructor && sym.hasFlag(JAVA))
val names = new collection.mutable.HashSet[Symbol]
- names ++= attrScope.elements.filter(_.isMethod)
+ names ++= attrScope.iterator.filter(_.isMethod)
if (args.length == 1) {
names.retain(sym => sym.name != nme.value)
}
diff --git a/src/compiler/scala/tools/nsc/util/HashSet.scala b/src/compiler/scala/tools/nsc/util/HashSet.scala
index bc7c8cf69d..593b82da7f 100644
--- a/src/compiler/scala/tools/nsc/util/HashSet.scala
+++ b/src/compiler/scala/tools/nsc/util/HashSet.scala
@@ -41,7 +41,7 @@ class HashSet[T >: Null <: AnyRef](initialCapacity: Int) extends Set[T] {
if (used >= (capacity >> 2)) growTable()
}
- def elements = new Iterator[T] {
+ def iterator = new Iterator[T] {
private var i = 0
def hasNext: Boolean = {
while (i < capacity && (table(i) eq null)) i += 1
diff --git a/src/compiler/scala/tools/nsc/util/Set.scala b/src/compiler/scala/tools/nsc/util/Set.scala
index 8f39f07d05..42c865e1b2 100644
--- a/src/compiler/scala/tools/nsc/util/Set.scala
+++ b/src/compiler/scala/tools/nsc/util/Set.scala
@@ -14,11 +14,13 @@ abstract class Set[T <: AnyRef] {
def addEntry(x: T): Unit
- def elements: Iterator[T]
+ def iterator: Iterator[T]
+
+ @deprecated def elements = iterator
def contains(x: T): Boolean =
findEntry(x) ne null
- def toList = elements.toList
+ def toList = iterator.toList
}
diff --git a/src/compiler/scala/tools/nsc/util/TreeSet.scala b/src/compiler/scala/tools/nsc/util/TreeSet.scala
index 40e889065c..5adaeb589a 100644
--- a/src/compiler/scala/tools/nsc/util/TreeSet.scala
+++ b/src/compiler/scala/tools/nsc/util/TreeSet.scala
@@ -40,7 +40,7 @@ class TreeSet[T >: Null <: AnyRef](less: (T, T) => Boolean) extends Set[T] {
tree = add(tree)
}
- def elements = {
+ def iterator = {
def elems(t: Tree): Iterator[T] = {
var it = Iterator.single(t.elem)
if (t.l ne null) it = elems(t.l) append it