diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/ant/Scaladoc.scala | 58 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/MainTokenMetric.scala | 6 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/ScalaDoc.scala | 6 | ||||
-rw-r--r-- | src/scalap/scala/tools/scalap/JavaWriter.scala | 68 | ||||
-rw-r--r-- | src/swing/scala/swing/CheckBox.scala | 2 | ||||
-rw-r--r-- | src/swing/scala/swing/Publisher.scala | 6 | ||||
-rw-r--r-- | src/swing/scala/swing/Reactor.scala | 4 | ||||
-rw-r--r-- | src/swing/scala/swing/model/Matrix.scala | 2 |
8 files changed, 87 insertions, 65 deletions
diff --git a/src/compiler/scala/tools/ant/Scaladoc.scala b/src/compiler/scala/tools/ant/Scaladoc.scala index 389668d4e9..e3178e8d9e 100644 --- a/src/compiler/scala/tools/ant/Scaladoc.scala +++ b/src/compiler/scala/tools/ant/Scaladoc.scala @@ -135,9 +135,10 @@ class Scaladoc extends MatchingTask { * * @param input The value of <code>origin</code>. */ - def setSrcdir(input: Path) = + def setSrcdir(input: Path) { if (origin.isEmpty) origin = Some(input) else origin.get.append(input) + } /** Sets the <code>origin</code> as a nested src Ant parameter. * @@ -152,23 +153,26 @@ class Scaladoc extends MatchingTask { * * @param input A reference to an origin path. */ - def setSrcref(input: Reference) = + def setSrcref(input: Reference) { createSrc().setRefid(input) + } /** Sets the <code>destdir</code> attribute. Used by Ant. * * @param input The value of <code>destination</code>. */ - def setDestdir(input: File) = + def setDestdir(input: File) { destination = Some(input) + } /** Sets the <code>classpath</code> attribute. Used by Ant. * * @param input The value of <code>classpath</code>. */ - def setClasspath(input: Path) = + def setClasspath(input: Path) { if (classpath.isEmpty) classpath = Some(input) else classpath.get.append(input) + } /** Sets the <code>classpath</code> as a nested classpath Ant parameter. * @@ -233,16 +237,18 @@ class Scaladoc extends MatchingTask { * * @param input A reference to a source path. */ - def setBootclasspathref(input: Reference) = + def setBootclasspathref(input: Reference) { createBootclasspath().setRefid(input) + } /** Sets the external extensions path attribute. Used by Ant. * * @param input The value of <code>extdirs</code>. */ - def setExtdirs(input: Path): Unit = + def setExtdirs(input: Path) { if (extdirs.isEmpty) extdirs = Some(input) else extdirs.get.append(input) + } /** Sets the <code>extdirs</code> as a nested sourcepath Ant parameter. * @@ -257,91 +263,103 @@ class Scaladoc extends MatchingTask { * * @param input A reference to an extensions path. */ - def setExtdirsref(input: Reference) = + def setExtdirsref(input: Reference) { createExtdirs().setRefid(input) + } /** Sets the <code>encoding</code> attribute. Used by Ant. * * @param input The value of <code>encoding</code>. */ - def setEncoding(input: String): Unit = + def setEncoding(input: String) { encoding = Some(input) + } /** Sets the <code>windowtitle</code> attribute. * * @param input The value of <code>windowtitle</code>. */ - def setWindowtitle(input: String): Unit = + def setWindowtitle(input: String) { windowtitle = Some(input) + } /** Sets the <code>doctitle</code> attribute. * * @param input The value of <code>doctitle</code>. */ - def setDoctitle(input: String): Unit = + def setDoctitle(input: String) { doctitle = Some(input) + } /** Sets the <code>stylesheetfile</code> attribute. * * @param input The value of <code>stylesheetfile</code>. */ - def setStylesheetfile(input: String): Unit = + def setStylesheetfile(input: String) { stylesheetfile = Some(input) + } /** Sets the <code>header</code> attribute. * * @param input The value of <code>header</code>. */ - def setHeader(input: String): Unit = + def setHeader(input: String) { pageheader = Some(input) + } /** Sets the <code>footer</code> attribute. * * @param input The value of <code>footer</code>. */ - def setFooter(input: String): Unit = + def setFooter(input: String) { pagefooter = Some(input) + } /** Sets the <code>top</code> attribute. * * @param input The value of <code>top</code>. */ - def setTop(input: String): Unit = + def setTop(input: String) { pagetop = Some(input) + } /** Sets the <code>bottom</code> attribute. * * @param input The value of <code>bottom</code>. */ - def setBottom(input: String): Unit = + def setBottom(input: String) { pagebottom = Some(input) + } /** Set the <code>addparams</code> info attribute. * * @param input The value for <code>addparams</code>. */ - def setAddparams(input: String): Unit = + def setAddparams(input: String) { addParams = input + } /** Set the <code>deprecation</code> info attribute. * * @param input One of the flags <code>yes/no</code> or <code>on/off</code>. */ - def setDeprecation(input: String): Unit = + def setDeprecation(input: String) { if (Flag.isPermissible(input)) deprecation = "yes".equals(input) || "on".equals(input) else error("Unknown deprecation flag '" + input + "'") + } /** Set the <code>unchecked</code> info attribute. * * @param input One of the flags <code>yes/no</code> or <code>on/off</code>. */ - def setUnchecked(input: String): Unit = + def setUnchecked(input: String) { if (Flag.isPermissible(input)) unchecked = "yes".equals(input) || "on".equals(input) else error("Unknown unchecked flag '" + input + "'") + } /*============================================================================*\ ** Properties getters ** @@ -568,7 +586,7 @@ class Scaladoc extends MatchingTask { // Compiles the actual code val compiler = new Global(commandSettings, reporter) { - override protected def computeInternalPhases() : Unit = { + override protected def computeInternalPhases() { phasesSet += syntaxAnalyzer phasesSet += analyzer.namerFactory phasesSet += analyzer.typerFactory @@ -597,7 +615,7 @@ class Scaladoc extends MatchingTask { "; see the documenter output for details.") reporter.printSummary() } catch { - case exception: Throwable if (exception.getMessage ne null) => + case exception: Throwable if exception.getMessage ne null => exception.printStackTrace() error("Document failed because of an internal documenter error (" + exception.getMessage + "); see the error output for details.") diff --git a/src/compiler/scala/tools/nsc/MainTokenMetric.scala b/src/compiler/scala/tools/nsc/MainTokenMetric.scala index 5b88700dfb..20b4b2c48b 100644 --- a/src/compiler/scala/tools/nsc/MainTokenMetric.scala +++ b/src/compiler/scala/tools/nsc/MainTokenMetric.scala @@ -15,7 +15,7 @@ object MainTokenMetric { private var reporter: ConsoleReporter = _ - def tokenMetric(compiler: Global, fnames: List[String]): unit = { + def tokenMetric(compiler: Global, fnames: List[String]) { import compiler.CompilationUnit import compiler.syntaxAnalyzer.UnitScanner import ast.parser.Tokens.EOF @@ -24,8 +24,8 @@ object MainTokenMetric { val s = new UnitScanner(new CompilationUnit(compiler.getSourceFile(source))) s.nextToken var i = 0 - while(s.token != EOF) { - i = i + 1 + while (s.token != EOF) { + i += 1 s.nextToken } Console.println(i.toString + " " + source.toString()) diff --git a/src/compiler/scala/tools/nsc/ScalaDoc.scala b/src/compiler/scala/tools/nsc/ScalaDoc.scala index bb41e0fa04..ba985d9094 100644 --- a/src/compiler/scala/tools/nsc/ScalaDoc.scala +++ b/src/compiler/scala/tools/nsc/ScalaDoc.scala @@ -14,8 +14,8 @@ import scala.tools.nsc.reporters.{Reporter, ConsoleReporter} import scala.tools.nsc.util.FakePos //{Position} -/** The main class for scaladoc, a frontend for the Scala compiler - * that generates documentation from source files. +/** The main class for scaladoc, a front-end for the Scala compiler + * that generates documentation from source files. */ object ScalaDoc { @@ -45,7 +45,7 @@ object ScalaDoc { } try { object compiler extends Global(command.settings, reporter) { - override protected def computeInternalPhases() : Unit = { + override protected def computeInternalPhases() { phasesSet += syntaxAnalyzer phasesSet += analyzer.namerFactory phasesSet += analyzer.typerFactory diff --git a/src/scalap/scala/tools/scalap/JavaWriter.scala b/src/scalap/scala/tools/scalap/JavaWriter.scala index 46d1f0fb56..55e5df5f27 100644 --- a/src/scalap/scala/tools/scalap/JavaWriter.scala +++ b/src/scalap/scala/tools/scalap/JavaWriter.scala @@ -1,6 +1,6 @@ /* ___ ____ ___ __ ___ ___ ** / _// __// _ | / / / _ | / _ \ Scala classfile decoder -** __\ \/ /__/ __ |/ /__/ __ |/ ___/ (c) 2003-2006, LAMP/EPFL +** __\ \/ /__/ __ |/ /__/ __ |/ ___/ (c) 2003-2009, LAMP/EPFL ** /____/\___/_/ |_/____/_/ |_/_/ ** */ @@ -16,7 +16,7 @@ class JavaWriter(classfile: Classfile, writer: Writer) extends CodeWriter(writer val cf = classfile - def flagsToStr(clazz: Boolean, flags: Int) = { + def flagsToStr(clazz: Boolean, flags: Int): String = { val buffer = new StringBuffer() var x: StringBuffer = buffer if (((flags & 0x0007) == 0) && @@ -32,7 +32,7 @@ class JavaWriter(classfile: Classfile, writer: Writer) extends CodeWriter(writer buffer.toString() } - def nameToClass(str: String) = { + def nameToClass(str: String): String = { val res = Names.decode(str.replace('/', '.')) if (res == "java.lang.Object") "scala.Any" else res } @@ -54,37 +54,41 @@ class JavaWriter(classfile: Classfile, writer: Writer) extends CodeWriter(writer def sigToType(str: String): String = sigToType(str, 0)._1 - def sigToType(str: String, i: Int): Pair[String, Int] = str.charAt(i) match { - case 'B' => Pair("scala.Byte", i + 1) - case 'C' => Pair("scala.Char", i + 1) - case 'D' => Pair("scala.Double", i + 1) - case 'F' => Pair("scala.Float", i + 1) - case 'I' => Pair("scala.Int", i + 1) - case 'J' => Pair("scala.Long", i + 1) - case 'S' => Pair("scala.Short", i + 1) - case 'V' => Pair("scala.Unit", i + 1) - case 'Z' => Pair("scala.Boolean", i + 1) - case 'L' => val j = str.indexOf(';', i); - Pair(nameToClass(str.substring(i + 1, j)), j + 1) - case '[' => val Pair(tpe, j) = sigToType(str, i + 1); - Pair("scala.Array[" + tpe + "]", j) - case '(' => val Pair(tpe, j) = sigToType0(str, i + 1); - Pair("(" + tpe, j) - case ')' => val Pair(tpe, j) = sigToType(str, i + 1); - Pair("): " + tpe, j) + def sigToType(str: String, i: Int): (String, Int) = str.charAt(i) match { + case 'B' => ("scala.Byte", i + 1) + case 'C' => ("scala.Char", i + 1) + case 'D' => ("scala.Double", i + 1) + case 'F' => ("scala.Float", i + 1) + case 'I' => ("scala.Int", i + 1) + case 'J' => ("scala.Long", i + 1) + case 'S' => ("scala.Short", i + 1) + case 'V' => ("scala.Unit", i + 1) + case 'Z' => ("scala.Boolean", i + 1) + case 'L' => + val j = str.indexOf(';', i) + (nameToClass(str.substring(i + 1, j)), j + 1) + case '[' => + val (tpe, j) = sigToType(str, i + 1) + ("scala.Array[" + tpe + "]", j) + case '(' => + val (tpe, j) = sigToType0(str, i + 1) + ("(" + tpe, j) + case ')' => + val (tpe, j) = sigToType(str, i + 1) + ("): " + tpe, j) } - def sigToType0(str: String, i: Int): Pair[String, Int] = + def sigToType0(str: String, i: Int): (String, Int) = if (str.charAt(i) == ')') sigToType(str, i) else { - val Pair(tpe, j) = sigToType(str, i) + val (tpe, j) = sigToType(str, i) if (str.charAt(j) == ')') { - val Pair(rest, k) = sigToType(str, j) - Pair(tpe + rest, k) + val (rest, k) = sigToType(str, j) + (tpe + rest, k) } else { - val Pair(rest, k) = sigToType0(str, j) - Pair(tpe + ", " + rest, k) + val (rest, k) = sigToType0(str, j) + (tpe + ", " + rest, k) } } @@ -109,7 +113,7 @@ class JavaWriter(classfile: Classfile, writer: Writer) extends CodeWriter(writer def isConstr(name: String) = (name == "<init>") - def printField(flags: Int, name: Int, tpe: Int, attribs: List[cf.Attribute]) = { + def printField(flags: Int, name: Int, tpe: Int, attribs: List[cf.Attribute]) { print(flagsToStr(false, flags)) if ((flags & 0x0010) != 0) print("val " + Names.decode(getName(name))) @@ -118,7 +122,7 @@ class JavaWriter(classfile: Classfile, writer: Writer) extends CodeWriter(writer print(": " + getType(tpe) + ";").newline } - def printMethod(flags: Int, name: Int, tpe: Int, attribs: List[cf.Attribute]) = { + def printMethod(flags: Int, name: Int, tpe: Int, attribs: List[cf.Attribute]) { if (getName(name) == "<init>") print(flagsToStr(false, flags)) attribs find { @@ -155,7 +159,7 @@ class JavaWriter(classfile: Classfile, writer: Writer) extends CodeWriter(writer case Some(cf.Attribute(_, data)) => val n = ((data(0) & 0xff) << 8) + (data(1) & 0xff) indent.print("throws ") - for (val i <- Iterator.range(0, n) map {x => 2 * (x + 1)}) { + for (i <- Iterator.range(0, n) map {x => 2 * (x + 1)}) { val inx = ((data(i) & 0xff) << 8) + (data(i+1) & 0xff) if (i > 2) print(", ") print(getClassName(inx).trim()) @@ -165,7 +169,7 @@ class JavaWriter(classfile: Classfile, writer: Writer) extends CodeWriter(writer } } - def printClassHeader = { + def printClassHeader { if (isInterface(cf.flags)) { print("trait " + getSimpleClassName(cf.classname)) } else { @@ -178,7 +182,7 @@ class JavaWriter(classfile: Classfile, writer: Writer) extends CodeWriter(writer } } - def printClass = { + def printClass { val pck = getPackage(cf.classname); if (pck.length() > 0) println("package " + pck + ";") diff --git a/src/swing/scala/swing/CheckBox.scala b/src/swing/scala/swing/CheckBox.scala index 845b7f7024..8fb1e2bb5f 100644 --- a/src/swing/scala/swing/CheckBox.scala +++ b/src/swing/scala/swing/CheckBox.scala @@ -13,4 +13,4 @@ class CheckBox(text: String) extends ToggleButton { def borderPaintedFlat: Boolean = peer.isBorderPaintedFlat def borderPaintedFlat_=(flat: Boolean) { peer.setBorderPaintedFlat(flat) } -}
\ No newline at end of file +} diff --git a/src/swing/scala/swing/Publisher.scala b/src/swing/scala/swing/Publisher.scala index e6f990418c..67728705a0 100644 --- a/src/swing/scala/swing/Publisher.scala +++ b/src/swing/scala/swing/Publisher.scala @@ -33,7 +33,7 @@ trait Publisher extends Reactor { /** * Notify all registered reactions. */ - def publish(e: Event) { for (val l <- listeners) l(e) } + def publish(e: Event) { for (l <- listeners) l(e) } listenTo(this) } @@ -42,7 +42,7 @@ import scala.ref._ private[swing] trait SingleRefCollection[+A <: AnyRef] extends Collection[A] { self => - trait Ref[+A<:AnyRef] extends Reference[A] { + trait Ref[+A <: AnyRef] extends Reference[A] { override def hashCode() = { val v = get if (v == None) 0 else v.get.hashCode @@ -64,7 +64,7 @@ private[swing] trait SingleRefCollection[+A <: AnyRef] extends Collection[A] { s def purgeReferences() { var ref = referenceQueue.poll - while(ref != None) { + while (ref != None) { removeReference(ref.get.asInstanceOf[Reference[A]]) ref = referenceQueue.poll } diff --git a/src/swing/scala/swing/Reactor.scala b/src/swing/scala/swing/Reactor.scala index 1b2d806d85..9f13e3f6a3 100644 --- a/src/swing/scala/swing/Reactor.scala +++ b/src/swing/scala/swing/Reactor.scala @@ -12,9 +12,9 @@ trait Reactor { * Listen to the given publisher as long as <code>deafTo</code> isn't called for * them. */ - def listenTo(ps: Publisher*) = for (val p <- ps) p.subscribe(reactions) + def listenTo(ps: Publisher*) = for (p <- ps) p.subscribe(reactions) /** * Installed reaction won't receive events from the given publisher anylonger. */ - def deafTo(ps: Publisher*) = for (val p <- ps) p.unsubscribe(reactions) + def deafTo(ps: Publisher*) = for (p <- ps) p.unsubscribe(reactions) } diff --git a/src/swing/scala/swing/model/Matrix.scala b/src/swing/scala/swing/model/Matrix.scala index d028b6826e..40f7e4c6f7 100644 --- a/src/swing/scala/swing/model/Matrix.scala +++ b/src/swing/scala/swing/model/Matrix.scala @@ -100,7 +100,7 @@ object Matrix { implicit def MatrixToSeqs[A](matrix: Matrix[A]): Seq[Seq[A]] = { val result = new Array[SubArray[A]](matrix.width) - for (val col <- 0 until matrix.width) + for (col <- 0 until matrix.width) result(col) = new SubArray[A](matrix.delegate, col * matrix.height, matrix.height) result } |