diff options
author | michelou <michelou@epfl.ch> | 2007-04-19 15:45:58 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2007-04-19 15:45:58 +0000 |
commit | a87d9a20e00c4951b774976ef2350d11be764b3d (patch) | |
tree | f92af868f6e5c67210646a72eb7b9f688ab0f0ab /src/compiler/scala | |
parent | 28edfc11090d9075200dcdd47227b4f067284f9a (diff) | |
download | scala-a87d9a20e00c4951b774976ef2350d11be764b3d.tar.gz scala-a87d9a20e00c4951b774976ef2350d11be764b3d.tar.bz2 scala-a87d9a20e00c4951b774976ef2350d11be764b3d.zip |
updated for-comprehension syntax
Diffstat (limited to 'src/compiler/scala')
17 files changed, 107 insertions, 120 deletions
diff --git a/src/compiler/scala/tools/ant/ScalaBazaar.scala b/src/compiler/scala/tools/ant/ScalaBazaar.scala index 6d60d98d5a..b3783299fb 100644 --- a/src/compiler/scala/tools/ant/ScalaBazaar.scala +++ b/src/compiler/scala/tools/ant/ScalaBazaar.scala @@ -257,7 +257,7 @@ package scala.tools.ant { <version>{version.get}</version>{ if (!depends.isEmpty) <depends>{ - for (val depend <- depends) yield + for (depend <- depends) yield <name>{depend}</name> }</depends> else Nil @@ -289,13 +289,13 @@ package scala.tools.ant { val zipContent = for { - val Pair(folder, fileSets) <- fileSetsMap.fileSets - val fileSet <- fileSets - val file <- List.fromArray(fileSet.getDirectoryScanner(getProject).getIncludedFiles) + Pair(folder, fileSets) <- fileSetsMap.fileSets + fileSet <- fileSets + file <- List.fromArray(fileSet.getDirectoryScanner(getProject).getIncludedFiles) } yield Triple(folder, fileSet.getDir(getProject), file) val zip = new ZipOutputStream(new FileOutputStream(file.get, false)) if (!zipContent.isEmpty) { - for (val Triple(destFolder, srcFolder, file) <- zipContent) { + for (Triple(destFolder, srcFolder, file) <- zipContent) { log(file, Project.MSG_DEBUG) zip.putNextEntry(new ZipEntry(destFolder + "/" + file)) val input = new FileInputStream(nameToFile(srcFolder)(file)) diff --git a/src/compiler/scala/tools/ant/Scalac.scala b/src/compiler/scala/tools/ant/Scalac.scala index b06d916eec..069e274239 100644 --- a/src/compiler/scala/tools/ant/Scalac.scala +++ b/src/compiler/scala/tools/ant/Scalac.scala @@ -605,7 +605,7 @@ class Scalac extends MatchingTask { while (!args.isEmpty) { val argsBuf = args if (args.head startsWith "-") { - for (val setting <- settings.allSettings) + for (setting <- settings.allSettings) args = setting.tryToSet(args); } else error("Parameter '" + args.head + "' does not start with '-'.") if (argsBuf eq args) diff --git a/src/compiler/scala/tools/ant/Scaladoc.scala b/src/compiler/scala/tools/ant/Scaladoc.scala index 17b2852f52..fd8cfc61d0 100644 --- a/src/compiler/scala/tools/ant/Scaladoc.scala +++ b/src/compiler/scala/tools/ant/Scaladoc.scala @@ -439,8 +439,8 @@ class Scaladoc extends MatchingTask { // older than the .scala file will be used. val sourceFiles: List[File] = for { - val originDir <- getOrigin - val originFile <- { + originDir <- getOrigin + originFile <- { val includedFiles = getDirectoryScanner(originDir).getIncludedFiles() val list = List.fromArray(includedFiles) @@ -493,7 +493,7 @@ class Scaladoc extends MatchingTask { while (!args.isEmpty) { val argsBuf = args if (args.head startsWith "-") { - for (val setting <- settings.allSettings) + for (setting <- settings.allSettings) args = setting.tryToSet(args); } else error("Parameter '" + args.head + "' does not start with '-'.") if (argsBuf eq args) diff --git a/src/compiler/scala/tools/nsc/CompileSocket.scala b/src/compiler/scala/tools/nsc/CompileSocket.scala index d71347631f..a5a5f178e3 100644 --- a/src/compiler/scala/tools/nsc/CompileSocket.scala +++ b/src/compiler/scala/tools/nsc/CompileSocket.scala @@ -79,10 +79,10 @@ object CompileSocket { val potentials = for { - val trial <- totry + trial <- totry val expanded = expand(trial) - !expanded.isEmpty - isDirWritable(expanded.get) + if !expanded.isEmpty + if isDirWritable(expanded.get) } yield expanded.get @@ -138,7 +138,7 @@ object CompileSocket { if (hits.length == 0) -1 else try { - for (val i <- 1 until hits.length) hits(i).delete() + for (i <- 1 until hits.length) hits(i).delete() hits(0).getName.toInt } catch { case ex: NumberFormatException => @@ -159,7 +159,7 @@ object CompileSocket { if (port < 0) startNewServer(vmArgs) while (port < 0 && attempts < MaxAttempts) { - attempts = attempts + 1 + attempts += 1 Thread.sleep(sleepTime) port = pollPort() } diff --git a/src/compiler/scala/tools/nsc/CompilerCommand.scala b/src/compiler/scala/tools/nsc/CompilerCommand.scala index 081af5b921..e34cf8c5b5 100644 --- a/src/compiler/scala/tools/nsc/CompilerCommand.scala +++ b/src/compiler/scala/tools/nsc/CompilerCommand.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2006 LAMP/EPFL + * Copyright 2005-2007 LAMP/EPFL * @author Martin Odersky */ // $Id$ @@ -7,8 +7,6 @@ package scala.tools.nsc -import compat.StringBuilder - /** A class representing command line info for scalac */ class CompilerCommand(arguments: List[String], val settings: Settings, error: String => unit, interactive: boolean) { @@ -31,7 +29,7 @@ class CompilerCommand(arguments: List[String], val settings: Settings, def format(s: String): String = { val buf = new StringBuilder(s) var i = s.length() - while (i < helpSyntaxColumnWidth) { buf.append(' '); i = i + 1 } + while (i < helpSyntaxColumnWidth) { buf.append(' '); i += 1 } buf.toString() } settings.allSettings @@ -55,7 +53,7 @@ class CompilerCommand(arguments: List[String], val settings: Settings, ok = false } else { val args0 = args - for (val setting <- settings.allSettings) + for (setting <- settings.allSettings) if (args eq args0) args = setting.tryToSet(args) diff --git a/src/compiler/scala/tools/nsc/GenericRunnerCommand.scala b/src/compiler/scala/tools/nsc/GenericRunnerCommand.scala index 9cd2e528e3..26742f5a88 100644 --- a/src/compiler/scala/tools/nsc/GenericRunnerCommand.scala +++ b/src/compiler/scala/tools/nsc/GenericRunnerCommand.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2006 LAMP/EPFL + * Copyright 2007 LAMP/EPFL * @author Lex Spoon */ @@ -29,8 +29,8 @@ class GenericRunnerCommand(allargs: List[String], error: String => Unit) { while (!args.isEmpty && ok && args.head.startsWith("-")) { val args0 = args - for (val setting <- settings.allSettings) - if(args eq args0) + for (setting <- settings.allSettings) + if (args eq args0) args = setting.tryToSet(args) if (args eq args0) { error("unknown option: '" + args.head + "'") @@ -38,7 +38,7 @@ class GenericRunnerCommand(allargs: List[String], error: String => Unit) { } } - if(!args.isEmpty) { + if (!args.isEmpty) { thingToRun = Some(args.head) arguments = args.tail } diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala index 4df833f002..fb6d3ff139 100644 --- a/src/compiler/scala/tools/nsc/Global.scala +++ b/src/compiler/scala/tools/nsc/Global.scala @@ -204,8 +204,9 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable val global: Global.this.type = Global.this } - def rootLoader: LazyType = if (forMSIL) new loaders.NamespaceLoader(classPath.root) - else new loaders.PackageLoader(classPath.root /* getRoot() */) + def rootLoader: LazyType = + if (forMSIL) new loaders.NamespaceLoader(classPath.root) + else new loaders.PackageLoader(classPath.root /* getRoot() */) val migrateMsg = "migration problem when moving from Scala version 1.0 to version 2.0:\n" @@ -215,8 +216,8 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable val MaxPhases = 64 - val phaseWithId = new Array[Phase](MaxPhases); - { for (val i <- List.range(0, MaxPhases)) phaseWithId(i) = NoPhase } + val phaseWithId = new Array[Phase](MaxPhases) + for (i <- List.range(0, MaxPhases)) phaseWithId(i) = NoPhase abstract class GlobalPhase(prev: Phase) extends Phase(prev) { phaseWithId(id) = this @@ -412,7 +413,7 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable private var p: Phase = firstPhase - for (val pd <- phaseDescriptors.takeWhile(pd => !(settings.stop contains pd.phaseName))) + for (pd <- phaseDescriptors.takeWhile(pd => !(settings.stop contains pd.phaseName))) if (!(settings.skip contains pd.phaseName)) p = pd.newPhase(p) def cancel { reporter.cancelled = true } @@ -482,8 +483,7 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable def compileSources(sources: List[SourceFile]): unit = { val startTime = currentTime reporter.reset - for (val source <- sources) - addUnit(new CompilationUnit(source)) + for (source <- sources) addUnit(new CompilationUnit(source)) globalPhase = firstPhase while (globalPhase != terminalPhase && !reporter.hasErrors) { @@ -511,7 +511,7 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable showDef(newTermName(settings.Xshowobj.value), true) if (reporter.hasErrors) { - for (val (sym, file) <- symSource.elements) { + for ((sym, file) <- symSource.elements) { sym.reset(new loaders.SourcefileLoader(file)) if (sym.isTerm) sym.moduleClass.reset(loaders.moduleClassLoader) } @@ -524,7 +524,7 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable warning("there were unchecked warnings; re-run with -unchecked for details") } } - for (val (sym, file) <- symSource.elements) resetPackageClass(sym.owner) + for ((sym, file) <- symSource.elements) resetPackageClass(sym.owner) //units foreach (.clear()) informTime("total", startTime) } diff --git a/src/compiler/scala/tools/nsc/Interpreter.scala b/src/compiler/scala/tools/nsc/Interpreter.scala index 4b385cf604..6ee45b4676 100644 --- a/src/compiler/scala/tools/nsc/Interpreter.scala +++ b/src/compiler/scala/tools/nsc/Interpreter.scala @@ -1,13 +1,13 @@ /* NSC -- new Scala compiler - * Copyright 2005-2006 LAMP/EPFL + * Copyright 2005-2007 LAMP/EPFL * @author Martin Odersky */ // $Id$ package scala.tools.nsc -import java.lang.{Class, ClassLoader} import java.io.{File, PrintWriter, StringWriter} +import java.lang.{Class, ClassLoader} import java.net.{URL, URLClassLoader} import scala.collection.mutable @@ -281,7 +281,7 @@ class Interpreter(val settings: Settings, reporter: Reporter, out: PrintWriter) // loop through previous requests, adding imports // for each one - for(val req <- reqsToUse) { + for (req <- reqsToUse) { req match { case req:ImportReq => // If the user entered an import, then just use it @@ -305,8 +305,8 @@ class Interpreter(val settings: Settings, reporter: Reporter, out: PrintWriter) // For other requests, import each bound variable. // import them explicitly instead of with _, so that // ambiguity errors will not be generated. - for(val imv <- req.boundNames) { - if(currentImps.contains(imv)) + for (imv <- req.boundNames) { + if (currentImps.contains(imv)) addWrapper() code.append("import ") code.append(req.objectName + req.accessPath + "." + imv + ";\n") @@ -543,18 +543,14 @@ class Interpreter(val settings: Settings, reporter: Reporter, out: PrintWriter) /** list of methods defined */ val defNames = - for { - val DefDef(mods, name, _, _, _, _) <- trees - mods.isPublic - } yield name + for (DefDef(mods, name, _, _, _, _) <- trees if mods.isPublic) + yield name /** list of val's and var's defined */ val valAndVarNames = { val baseNames = - for { - val ValDef(mods, name, _, _) <- trees - mods.isPublic - } yield name + for (ValDef(mods, name, _, _) <- trees if mods.isPublic) + yield name if (needsVarName) compiler.encode(varName) :: baseNames // add a var name @@ -565,7 +561,7 @@ class Interpreter(val settings: Settings, reporter: Reporter, out: PrintWriter) /** list of modules defined */ val moduleNames = { val explicit = - for(val ModuleDef(mods, name, _) <- trees; mods.isPublic) + for (ModuleDef(mods, name, _) <- trees if mods.isPublic) yield name val caseClasses = for {val ClassDef(mods, name, _, _, _) <- trees @@ -577,12 +573,12 @@ class Interpreter(val settings: Settings, reporter: Reporter, out: PrintWriter) /** list of classes defined */ val classNames = - for (val ClassDef(mods, name, _, _, _) <- trees; mods.isPublic) + for (ClassDef(mods, name, _, _, _) <- trees if mods.isPublic) yield name /** list of type aliases defined */ val typeNames = - for (val AliasTypeDef(mods, name, _, _) <- trees; mods.isPublic) + for (AliasTypeDef(mods, name, _, _) <- trees if mods.isPublic) yield name /** all (public) names defined by these statements */ @@ -655,7 +651,7 @@ class Interpreter(val settings: Settings, reporter: Reporter, out: PrintWriter) }) def resultExtractionCode(code: PrintWriter): Unit = - for (val vname <- valAndVarNames) { + for (vname <- valAndVarNames) { code.print(" + \"" + vname + ": " + typeOf(vname) + " = \" + " + objectName + accessPath + "." + vname + " + \"\\n\"") @@ -752,7 +748,7 @@ class Interpreter(val settings: Settings, reporter: Reporter, out: PrintWriter) /** return a summary of the defined methods */ def defTypesSummary: String = stringFrom(summ => { - for (val methname <- defNames) + for (methname <- defNames) summ.println("" + methname + ": " + typeOf(methname)) }) } @@ -871,7 +867,7 @@ object Interpreter { path match { case _ if !path.exists => {} case _ if path.isDirectory => - for (val p <- path.listFiles) + for (p <- path.listFiles) deleteRecursively(p) path.delete case _ => path.delete diff --git a/src/compiler/scala/tools/nsc/InterpreterLoop.scala b/src/compiler/scala/tools/nsc/InterpreterLoop.scala index 15c984a034..b50633d043 100644 --- a/src/compiler/scala/tools/nsc/InterpreterLoop.scala +++ b/src/compiler/scala/tools/nsc/InterpreterLoop.scala @@ -12,7 +12,7 @@ import java.io.{BufferedReader, InputStreamReader, File, FileReader, PrintWriter import java.io.IOException import scala.tools.nsc.reporters.{Reporter, ConsoleReporter} -import scala.tools.nsc.util.{Position} +import scala.tools.nsc.util.Position import nsc.{InterpreterResults=>IR} /** The main loop of the command-line interface to the @@ -118,7 +118,7 @@ class InterpreterLoop(in0: BufferedReader, out: PrintWriter) { out.print("\nscala> ") out.flush } - if(first) { + if (first) { /* For some reason, the first interpreted command always takes * a second or two. So, wait until the welcome message * has been printed before calling bindSettings. That way, @@ -173,7 +173,7 @@ class InterpreterLoop(in0: BufferedReader, out: PrintWriter) { def replay() { closeInterpreter createInterpreter - for (val cmd <- replayCommands) { + for (cmd <- replayCommands) { out.println("Replaying: " + cmd) command(cmd) out.println @@ -215,9 +215,9 @@ class InterpreterLoop(in0: BufferedReader, out: PrintWriter) { shouldReplay = Some(line) }) } - else if (line.matches(replayRegexp)) + else if (line matches replayRegexp) replay - else if (line.startsWith(":")) + else if (line startsWith ":") out.println("Unknown command. Type :help for help.") else shouldReplay = interpretStartingWith(line) diff --git a/src/compiler/scala/tools/nsc/MainTokenMetric.scala b/src/compiler/scala/tools/nsc/MainTokenMetric.scala index 05b0f3c33c..1f1632fd48 100644 --- a/src/compiler/scala/tools/nsc/MainTokenMetric.scala +++ b/src/compiler/scala/tools/nsc/MainTokenMetric.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2006 LAMP/EPFL + * Copyright 2005-2007 LAMP/EPFL * @author Martin Odersky */ // $Id$ @@ -16,20 +16,20 @@ object MainTokenMetric { private var reporter: ConsoleReporter = _ - def tokenMetric(compiler: Global, fnames: List[String]): unit = { + private def tokenMetric(compiler: Global, fnames: List[String]) { import compiler.CompilationUnit import compiler.syntaxAnalyzer.UnitScanner import ast.parser.Tokens.EOF var totale = 0 - for (val source <- fnames) { + for (source <- fnames) { val s = new UnitScanner(new CompilationUnit(compiler.getSourceFile(source))) var i = 0 while(s.token != EOF) { - i = i + 1 + i += 1 s.nextToken } var j = 0 ; while(j + log(i) / log(10) < 7) { - j = j+1 + j += 1 Console.print(' ') } Console.print(i.toString()) diff --git a/src/compiler/scala/tools/nsc/ObjectRunner.scala b/src/compiler/scala/tools/nsc/ObjectRunner.scala index 7e3442ce02..5bafbd7cc7 100644 --- a/src/compiler/scala/tools/nsc/ObjectRunner.scala +++ b/src/compiler/scala/tools/nsc/ObjectRunner.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2006 LAMP/EPFL + * Copyright 2005-2007 LAMP/EPFL * @author Lex Spoon */ @@ -7,9 +7,8 @@ package scala.tools.nsc -import java.lang.Class -import java.lang.{ClassNotFoundException, NoSuchMethodException} import java.io.File +import java.lang.{Class, ClassNotFoundException, NoSuchMethodException} import java.lang.reflect.{Method,Modifier} import java.net.URLClassLoader diff --git a/src/compiler/scala/tools/nsc/ScriptRunner.scala b/src/compiler/scala/tools/nsc/ScriptRunner.scala index 6ee8348600..40ad350fda 100644 --- a/src/compiler/scala/tools/nsc/ScriptRunner.scala +++ b/src/compiler/scala/tools/nsc/ScriptRunner.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2006 LAMP/EPFL + * Copyright 2005-2007 LAMP/EPFL * @author Martin Odersky */ // $Id$ @@ -8,10 +8,9 @@ package scala.tools.nsc import java.io.{BufferedReader, File, FileInputStream, FileOutputStream, FileReader, InputStreamReader, PrintWriter} -import java.util.jar.{JarEntry, JarOutputStream} import java.lang.reflect.InvocationTargetException +import java.util.jar.{JarEntry, JarOutputStream} -import compat.StringBuilder import scala.tools.nsc.io.PlainFile import scala.tools.nsc.reporters.ConsoleReporter import scala.tools.nsc.util.{CompoundSourceFile, SourceFile, SourceFileFragment} @@ -67,7 +66,7 @@ object ScriptRunner { val buf = new Array[byte](10240) def addFromDir(dir: File, prefix: String): Unit = { - for (val entry <- dir.listFiles) { + for (entry <- dir.listFiles) { if (entry.isFile) { jar.putNextEntry(new JarEntry(prefix + entry.getName)) @@ -165,16 +164,13 @@ object ScriptRunner { scriptFileIn: String): Boolean = { val scriptFile = CompileClient.absFileName(scriptFileIn) - for { - val setting:settings.StringSetting <- List( + for (setting:settings.StringSetting <- List( settings.classpath, settings.sourcepath, settings.bootclasspath, settings.extdirs, - settings.outdir) - } { + settings.outdir)) setting.value = CompileClient.absFileNames(setting.value) - } val compSettingNames = (new Settings(error)).allSettings.map(.name) diff --git a/src/compiler/scala/tools/nsc/symtab/Constants.scala b/src/compiler/scala/tools/nsc/symtab/Constants.scala index 1bc5ddc489..e622d85d47 100644 --- a/src/compiler/scala/tools/nsc/symtab/Constants.scala +++ b/src/compiler/scala/tools/nsc/symtab/Constants.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2006 LAMP/EPFL + * Copyright 2005-2007 LAMP/EPFL * @author Martin Odersky */ // $Id$ @@ -8,7 +8,6 @@ package scala.tools.nsc.symtab import java.lang.Integer.toOctalString -import compat.StringBuilder import classfile.PickleFormat._ @@ -200,7 +199,7 @@ trait Constants { def escapedStringValue: String = { def escape(text: String): String = { val buf = new StringBuilder - for (val c <- Iterator.fromString(text)) + for (c <- Iterator.fromString(text)) if (c.isControl) buf.append("\\0" + toOctalString(c.asInstanceOf[Int])) else diff --git a/src/compiler/scala/tools/nsc/symtab/Flags.scala b/src/compiler/scala/tools/nsc/symtab/Flags.scala index 89d5060a88..ebe587acae 100644 --- a/src/compiler/scala/tools/nsc/symtab/Flags.scala +++ b/src/compiler/scala/tools/nsc/symtab/Flags.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2006 LAMP/EPFL + * Copyright 2005-2007 LAMP/EPFL * @author Martin Odersky */ // $Id$ @@ -128,7 +128,7 @@ object Flags extends Enumeration { ss.filter("" !=).mkString("", " ", "") def flagsToString(flags: long): String = - listToString(for (val i <- List.range(0, 63)) yield flagToString(flags & (1L << i))) + listToString(for (i <- List.range(0, 63)) yield flagToString(flags & (1L << i))) def flagsToString(flags: long, privateWithin: String): String = { var f = flags @@ -210,36 +210,36 @@ object Flags extends Enumeration { def isVariable = (mods & MUTABLE) != 0 def isPublic = !isPrivate && !isProtected } - case class FlagEnum(mask : Int) extends Val(maskToBit(mask), flagToString(mask)); - - val Implicit = FlagEnum(IMPLICIT) - val Final = FlagEnum(FINAL) - val Private = FlagEnum(PRIVATE) - val Protected= FlagEnum(PROTECTED) - val Sealed = FlagEnum(SEALED) - val Override = FlagEnum(OVERRIDE) - val Case = FlagEnum(CASE) - val Abstract = FlagEnum(ABSTRACT) - val Deferred = FlagEnum(DEFERRED) - val Method = FlagEnum(METHOD) - val Module = FlagEnum(MODULE) - val Interface= FlagEnum(INTERFACE) - val Mutable = FlagEnum(MUTABLE) - val Param = FlagEnum(PARAM) - val Package = FlagEnum(PACKAGE) - val Deprecated=FlagEnum(DEPRECATED) - val Covariant=FlagEnum(COVARIANT) - val Contravariant=FlagEnum(CONTRAVARIANT) - val AbsOverride=FlagEnum(ABSOVERRIDE) - val Local=FlagEnum(LOCAL) - val Synthetic=FlagEnum(SYNTHETIC) - val Stable=FlagEnum(STABLE) - val CaseAccessor=FlagEnum(CASEACCESSOR) - val Trait=FlagEnum(TRAIT) - val Bridge=FlagEnum(BRIDGE) - val Accessor=FlagEnum(ACCESSOR) - val SuperAccessor=FlagEnum(SUPERACCESSOR) - val ParamAccessor=FlagEnum(PARAMACCESSOR) - val ModuleVar=FlagEnum(MODULEVAR) + case class FlagEnum(mask: Int) extends Val(maskToBit(mask), flagToString(mask)) + + val Implicit = FlagEnum(IMPLICIT) + val Final = FlagEnum(FINAL) + val Private = FlagEnum(PRIVATE) + val Protected = FlagEnum(PROTECTED) + val Sealed = FlagEnum(SEALED) + val Override = FlagEnum(OVERRIDE) + val Case = FlagEnum(CASE) + val Abstract = FlagEnum(ABSTRACT) + val Deferred = FlagEnum(DEFERRED) + val Method = FlagEnum(METHOD) + val Module = FlagEnum(MODULE) + val Interface = FlagEnum(INTERFACE) + val Mutable = FlagEnum(MUTABLE) + val Param = FlagEnum(PARAM) + val Package = FlagEnum(PACKAGE) + val Deprecated = FlagEnum(DEPRECATED) + val Covariant = FlagEnum(COVARIANT) + val Contravariant = FlagEnum(CONTRAVARIANT) + val AbsOverride = FlagEnum(ABSOVERRIDE) + val Local = FlagEnum(LOCAL) + val Synthetic = FlagEnum(SYNTHETIC) + val Stable = FlagEnum(STABLE) + val CaseAccessor = FlagEnum(CASEACCESSOR) + val Trait = FlagEnum(TRAIT) + val Bridge = FlagEnum(BRIDGE) + val Accessor = FlagEnum(ACCESSOR) + val SuperAccessor = FlagEnum(SUPERACCESSOR) + val ParamAccessor = FlagEnum(PARAMACCESSOR) + val ModuleVar = FlagEnum(MODULEVAR) } diff --git a/src/compiler/scala/tools/nsc/util/ClassPath.scala b/src/compiler/scala/tools/nsc/util/ClassPath.scala index af89eb1603..2707e1675d 100644 --- a/src/compiler/scala/tools/nsc/util/ClassPath.scala +++ b/src/compiler/scala/tools/nsc/util/ClassPath.scala @@ -1,7 +1,7 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2006, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | ** +** / __/ __// _ | / / / _ | (c) 2003-2007, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** \* */ @@ -53,8 +53,8 @@ class ClassPath(onlyPresentation: Boolean) { } class Context(val entries: List[Entry]) { - def find(name: String, isDir: Boolean) : Context = if (isPackage) { - def find0(entries: List[Entry]) : Context = { + def find(name: String, isDir: Boolean): Context = if (isPackage) { + def find0(entries: List[Entry]): Context = { if (entries.isEmpty) new Context(Nil) else { val ret = find0(entries.tail) @@ -240,7 +240,7 @@ class ClassPath(onlyPresentation: Boolean) { while (strtok.hasMoreTokens()) { val file = AbstractFile.getDirectory(strtok.nextToken()) if (file ne null) { - for (val file0 <- file) { + for (file0 <- file) { val name = file0.name if (name.endsWith(".jar") || name.endsWith(".zip") || file0.isDirectory) { val archive = AbstractFile.getDirectory(new File(file.file, name)) diff --git a/src/compiler/scala/tools/nsc/util/ListBuffer.scala b/src/compiler/scala/tools/nsc/util/ListBuffer.scala index c4b90fa316..348b3f5700 100644 --- a/src/compiler/scala/tools/nsc/util/ListBuffer.scala +++ b/src/compiler/scala/tools/nsc/util/ListBuffer.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2006 LAMP/EPFL + * Copyright 2005-2007 LAMP/EPFL * @author Martin Odersky */ // $Id$ @@ -18,7 +18,7 @@ class ListBuffer[T] extends Iterator[T] { } def ++=(xs: Iterable[T]): unit = - for (val x <- xs.elements) +=(x) + for (x <- xs.elements) +=(x) def +(x: T): ListBuffer[T] = { +=(x); this } def ++(xs: Iterable[T]): ListBuffer[T] = { ++=(xs); this } diff --git a/src/compiler/scala/tools/nsc/util/ShowPickled.scala b/src/compiler/scala/tools/nsc/util/ShowPickled.scala index df7374778a..617ab47e47 100644 --- a/src/compiler/scala/tools/nsc/util/ShowPickled.scala +++ b/src/compiler/scala/tools/nsc/util/ShowPickled.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2006 LAMP/EPFL + * Copyright 2005-2007 LAMP/EPFL * @author Martin Odersky */ // $Id$ @@ -62,7 +62,7 @@ object ShowPickled extends Names { case _ => "***BAD TAG***(" + tag + ")" } - def printFile(buf: PickleBuffer, out: PrintStream): unit = { + def printFile(buf: PickleBuffer, out: PrintStream) { out.println("Version " + buf.readNat() + "." + buf.readNat()) val index = buf.createIndex @@ -169,8 +169,7 @@ object ShowPickled extends Names { ", factual = " + buf.readIndex) } - for (val i <- 0 until index.length) - printEntry(i) + for (i <- 0 until index.length) printEntry(i) } def main(args: Array[String]): unit = { |