summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2008-01-21 10:49:24 +0000
committermichelou <michelou@epfl.ch>2008-01-21 10:49:24 +0000
commitfdcae0b7eba4a1f0f234178d0fe159a5a34ee1d0 (patch)
tree37d542702fdffbb47a6056f6d1a30da2d29f6564 /src
parentcb5425e58c2a3dbdcc36d940bdce24e7cbb7ff9a (diff)
downloadscala-fdcae0b7eba4a1f0f234178d0fe159a5a34ee1d0.tar.gz
scala-fdcae0b7eba4a1f0f234178d0fe159a5a34ee1d0.tar.bz2
scala-fdcae0b7eba4a1f0f234178d0fe159a5a34ee1d0.zip
removed some warnings
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Types.scala34
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala4
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala36
3 files changed, 37 insertions, 37 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala
index 1f24ff1bf6..8e754b95cd 100644
--- a/src/compiler/scala/tools/nsc/symtab/Types.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Types.scala
@@ -6,11 +6,11 @@
package scala.tools.nsc.symtab
-import scala.collection.mutable.{ListBuffer, HashMap}
import scala.collection.immutable
+import scala.collection.mutable.{ListBuffer, HashMap}
import scala.compat.Platform.currentTime
-import scala.tools.nsc.util.{HashSet, Position, NoPosition}
import scala.tools.nsc.ast.TreeGen
+import scala.tools.nsc.util.{HashSet, Position, NoPosition}
import Flags._
/* A standard type pattern match:
@@ -181,7 +181,7 @@ trait Types {
override def prefixString = underlying.prefixString
override def isComplete = underlying.isComplete
override def complete(sym: Symbol) = underlying.complete(sym)
- override def load(sym: Symbol): Unit = underlying.load(sym)
+ override def load(sym: Symbol) { underlying.load(sym) }
override def withAttributes(attribs: List[AnnotationInfo]) = maybeRewrap(underlying.withAttributes(attribs))
override def withoutAttributes = maybeRewrap(underlying.withoutAttributes)
}
@@ -460,7 +460,7 @@ trait Types {
}
/** Apply `f' to each part of this type */
- def foreach(f: Type => Unit): Unit = new ForEachTypeTraverser(f).traverse(this)
+ def foreach(f: Type => Unit) { new ForEachTypeTraverser(f).traverse(this) }
/** Is there part of this type which satisfies predicate `p'? */
def exists(p: Type => Boolean): Boolean = !find(p).isEmpty
@@ -475,7 +475,7 @@ trait Types {
/** Is this type a subtype of that type? */
def <:<(that: Type): Boolean = {
- if (util.Statistics.enabled) subtypeCount = subtypeCount + 1
+ if (util.Statistics.enabled) subtypeCount += 1
val startTime = if (util.Statistics.enabled) currentTime else 0l
val result =
((this eq that) ||
@@ -623,7 +623,7 @@ trait Types {
//TODO: use narrow only for modules? (correct? efficiency gain?)
def findMember(name: Name, excludedFlags: Int, requiredFlags: Long, stableOnly: Boolean): Symbol = {
if (inIDE) trackTypeIDE(typeSymbol)
- if (util.Statistics.enabled) findMemberCount = findMemberCount + 1
+ if (util.Statistics.enabled) findMemberCount += 1
val startTime = if (util.Statistics.enabled) currentTime else 0l
//Console.println("find member " + name.decode + " in " + this + ":" + this.baseClasses)//DEBUG
@@ -698,10 +698,10 @@ trait Types {
if (util.Statistics.enabled)
findMemberMillis = findMemberMillis + currentTime - startTime
if (members eq null) {
- if (util.Statistics.enabled) if (member == NoSymbol) noMemberCount = noMemberCount + 1;
+ if (util.Statistics.enabled) if (member == NoSymbol) noMemberCount += 1;
member
} else {
- if (util.Statistics.enabled) multMemberCount = multMemberCount + 1;
+ if (util.Statistics.enabled) multMemberCount += 1;
//val pre = if (this.typeSymbol.isClass) this.typeSymbol.thisType else this;
(baseClasses.head.newOverloaded(this, members.toList))
}
@@ -798,7 +798,7 @@ trait Types {
override def isStable = true
override def widen: Type = underlying.widen
override def closure: Array[Type] = {
- if (util.Statistics.enabled) singletonClosureCount = singletonClosureCount + 1
+ if (util.Statistics.enabled) singletonClosureCount += 1
addClosure(this, underlying.closure)
}
override def toString: String = prefixString + "type"
@@ -977,7 +977,7 @@ trait Types {
def computeClosure: Array[Type] =
try {
if (util.Statistics.enabled)
- compoundClosureCount = compoundClosureCount + 1
+ compoundClosureCount += 1
//Console.println("computing closure of " + typeSymbol.tpe + " " + parents)//DEBUG
val buf = new ListBuffer[Type]
buf += typeSymbol.tpe
@@ -1015,10 +1015,10 @@ trait Types {
if (!(minTypes exists (tp =:=))) minTypes = tp :: minTypes;
index(i) = index(i) + 1
}
- i = i + 1
+ i += 1
}
buf += intersectionType(minTypes)
- clSize = clSize + 1
+ clSize += 1
}
}
closureCache = new Array[Type](clSize)
@@ -1037,7 +1037,7 @@ trait Types {
assert(!closureCache(j).isInstanceOf[RefinedType], closureCache(j))
case _ =>
}
- j = j + 1
+ j += 1
}
//Console.println("closure of " + typeSymbol.tpe + " = " + List.fromArray(closureCache))//DEBUG
closureCache
@@ -1357,7 +1357,7 @@ trait Types {
var i = 0
while (i < cl.length) {
cl1(i) = transform(cl(i))
- i = i + 1
+ i += 1
}
cl1
}
@@ -1487,7 +1487,7 @@ A type's typeSymbol should never be inspected directly.
closurePeriod = currentPeriod
if (!isValidForBaseClasses(period)) {
if (util.Statistics.enabled)
- typerefClosureCount = typerefClosureCount + 1
+ typerefClosureCount += 1
closureCache =
if (sym.isAbstractType) addClosure(this, transform(bounds.hi).closure)
else transform(sym.info.closure)
@@ -2839,7 +2839,7 @@ A type's typeSymbol should never be inspected directly.
sym.setFlag(EXISTENTIAL)
- existSyms = existSyms + actualIdx -> sym
+ existSyms = existSyms + Pair(actualIdx, sym)
sym
}
@@ -3853,7 +3853,7 @@ A type's typeSymbol should never be inspected directly.
var i = 0
while (i < arr.length) {
arr(i) = lubs.head
- i = i + 1
+ i += 1
lubs = lubs.tail
}
arr
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
index 218f4e4983..1640fb9205 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
@@ -1,5 +1,5 @@
/* NSC -- new Scala compiler
- * Copyright 2005-2007 LAMP/EPFL
+ * Copyright 2005-2008 LAMP/EPFL
* @author Martin Odersky
*/
// $Id$
@@ -542,7 +542,7 @@ abstract class ClassfileParser {
while (sig(index) != '>') {
val tpname = subName(':'.==).toTypeName
val s = sym.newTypeParameter(NoPosition, tpname)
- tparams = tparams + tpname -> s
+ tparams = tparams + Pair(tpname, s)
val ts = new ListBuffer[Type]
while (sig(index) == ':') {
index += 1
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala
index e3d627f2aa..8d3d48ab2d 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala
@@ -1,5 +1,5 @@
/* NSC -- new Scala compiler
- * Copyright 2005-2007 LAMP/EPFL
+ * Copyright 2005-2008 LAMP/EPFL
* @author Iulian Dragos
*/
// $Id$
@@ -73,7 +73,7 @@ abstract class ICodeReader extends ClassfileParser {
} else super.getOwner(jflags)
}
- override def parseClass(): Unit = {
+ override def parseClass() {
val jflags = in.nextChar
val isAttribute = (jflags & JAVA_ACC_ANNOTATION) != 0
var sflags = transFlags(jflags)
@@ -92,7 +92,7 @@ abstract class ICodeReader extends ClassfileParser {
staticCode.methods = staticCode.methods.reverse
}
- override def parseField(): Unit = {
+ override def parseField() {
val (jflags, sym) = parseMember(true)
getCode(jflags).addField(new IField(sym))
skipAttributes()
@@ -174,7 +174,7 @@ abstract class ICodeReader extends ClassfileParser {
}
}
- def parseAttribute(): Unit = {
+ def parseAttribute() {
val attrName = pool.getName(in.nextChar)
val attrLen = in.nextInt
attrName match {
@@ -215,13 +215,13 @@ abstract class ICodeReader extends ClassfileParser {
var pc = 0
/** Parse java bytecode into ICode */
- def parseByteCode(): Unit = {
+ def parseByteCode() {
maxStack = in.nextChar
maxLocals = in.nextChar
val codeLength = in.nextInt
val code = new LinearCode
- def parseInstruction: Unit = {
+ def parseInstruction {
import opcodes._
import code._
var size = 1 // instruction size
@@ -236,7 +236,7 @@ abstract class ICodeReader extends ClassfileParser {
}
/** Parse 32 bit jump target. */
- def parseJumpTargetW = {
+ def parseJumpTargetW: Int = {
size += 4
val offset = in.nextInt
val target = pc + offset
@@ -450,8 +450,8 @@ abstract class ICodeReader extends ClassfileParser {
size += padding
in.bp += padding
assert((pc + size % 4) != 0)
-/* var byte1 = in.nextByte; size = size + 1;
- while (byte1 == 0) { byte1 = in.nextByte; size = size + 1; }
+/* var byte1 = in.nextByte; size += 1;
+ while (byte1 == 0) { byte1 = in.nextByte; size += 1; }
val default = byte1 << 24 | in.nextByte << 16 | in.nextByte << 8 | in.nextByte;
size = size + 3
*/
@@ -557,7 +557,7 @@ abstract class ICodeReader extends ClassfileParser {
case JVM.monitorenter => code.emit(MONITOR_ENTER())
case JVM.monitorexit => code.emit(MONITOR_EXIT())
case JVM.wide =>
- size = size + 1;
+ size += 1
toUnsignedByte(in.nextByte) match {
case JVM.iload => code.emit(LOAD_LOCAL(code.getLocal(in.nextChar, INT))); size += 2
case JVM.lload => code.emit(LOAD_LOCAL(code.getLocal(in.nextChar, LONG))); size += 2
@@ -651,7 +651,7 @@ abstract class ICodeReader extends ClassfileParser {
var containsDUPX = false
var containsNEW = false
- def emit(i: Instruction) = {
+ def emit(i: Instruction) {
instrs += (pc, i)
if (i.isInstanceOf[DupX])
containsDUPX = true
@@ -671,7 +671,7 @@ abstract class ICodeReader extends ClassfileParser {
def makeBasicBlocks: Map[Int, BasicBlock] = {
val block: Map[Int, BasicBlock] = new HashMap
- for (pc <- jmpTargets) block += pc -> code.newBlock
+ for (pc <- jmpTargets) block += Pair(pc, code.newBlock)
block
}
@@ -729,7 +729,7 @@ abstract class ICodeReader extends ClassfileParser {
code
}
- def resolveDups: Unit = {
+ def resolveDups {
import opcodes._
val tfa = new analysis.MethodTFA() {
@@ -944,7 +944,7 @@ abstract class ICodeReader extends ClassfileParser {
def getLocal(idx: Int, kind: TypeKind): Local = {
assert(idx < maxLocals, "Index too large for local variable.");
- def checkValidIndex: Unit = {
+ def checkValidIndex {
locals.get(idx - 1) match {
case Some(others) if ((others find { x => x._1 == LONG || x._1 == DOUBLE}) != None) =>
error("Illegal index: " + idx + " points in the middle of another local")
@@ -973,7 +973,7 @@ abstract class ICodeReader extends ClassfileParser {
checkValidIndex
val l = freshLocal(idx, kind, false)
log("Added new local for idx " + idx + ": " + kind)
- locals += idx -> List((l, kind))
+ locals += Pair(idx, List((l, kind)))
l
}
}
@@ -989,12 +989,12 @@ abstract class ICodeReader extends ClassfileParser {
l
}
- private var count = 0;
+ private var count = 0
/** Invent a new local, with a new index value outside the range of
* the original method. */
def freshLocal(kind: TypeKind): Local = {
- count = count + 1
+ count += 1
freshLocal(maxLocals + count, kind, false)
}
@@ -1003,7 +1003,7 @@ abstract class ICodeReader extends ClassfileParser {
val sym = method.symbol.newVariable(NoPosition, "par" + idx).setInfo(kind.toType);
val l = new Local(sym, kind, true)
assert(!locals.isDefinedAt(idx))
- locals += idx -> List((l, kind))
+ locals += Pair(idx, List((l, kind)))
l
}