diff options
author | michelou <michelou@epfl.ch> | 2008-01-23 11:10:45 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2008-01-23 11:10:45 +0000 |
commit | a5692b1f4060c0be1da97f384277e02a0172aac5 (patch) | |
tree | 6dd8f9cbb0e401fcb1847fb27cffe5523d77173e /src/compiler | |
parent | a8c4885e8802d91da2c778166b9313197f549db7 (diff) | |
download | scala-a5692b1f4060c0be1da97f384277e02a0172aac5.tar.gz scala-a5692b1f4060c0be1da97f384277e02a0172aac5.tar.bz2 scala-a5692b1f4060c0be1da97f384277e02a0172aac5.zip |
removed last warnings
Diffstat (limited to 'src/compiler')
5 files changed, 41 insertions, 39 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala index 4a971f0c0a..be79d93483 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2007 LAMP/EPFL + * Copyright 2005-2008 LAMP/EPFL * @author Martin Odersky */ @@ -49,7 +49,7 @@ abstract class GenICode extends SubComponent { else definitions.getMember(definitions.getClass("scala.runtime.Comparator"), nme.equals_) - override def run: Unit = { + override def run { scalaPrimitives.init classes.clear super.run @@ -83,7 +83,7 @@ abstract class GenICode extends SubComponent { log("Generating class: " + tree.symbol.fullNameString) ctx setClass (new IClass(tree.symbol) setCompilationUnit unit) addClassFields(ctx, tree.symbol); - classes += tree.symbol -> ctx.clazz + classes += (tree.symbol -> ctx.clazz) unit.icode += ctx.clazz gen(impl, ctx) ctx setClass null @@ -195,7 +195,7 @@ abstract class GenICode extends SubComponent { private def genLoad(tree: Tree, ctx: Context, expectedType: TypeKind): Context = { var generatedType = expectedType if (settings.debug.value) - log("at line: " + (tree.pos).line.map(_.toString).get(tree.pos.toString)) + log("at line: " + (tree.pos).line.map(_.toString).getOrElse(tree.pos.toString)) /** * Generate code for primitive arithmetic operations. @@ -389,7 +389,7 @@ abstract class GenICode extends SubComponent { label.patch(ctx.method.code) case None => - ctx1.labels += tree.symbol -> (new Label(tree.symbol) anchor ctx1.bb setParams (params map (_.symbol))); + ctx1.labels += (tree.symbol -> (new Label(tree.symbol) anchor ctx1.bb setParams (params map (_.symbol)))); ctx.method.addLocals(params map (p => new Local(p.symbol, toTypeKind(p.symbol.info), false))); if (settings.debug.value) log("Adding label " + tree.symbol); @@ -1290,7 +1290,7 @@ abstract class GenICode extends SubComponent { case LabelDef(name, params, rhs) => if (!ctx.labels.contains(tree.symbol)) { - ctx.labels += tree.symbol -> (new Label(tree.symbol) setParams(params map (_.symbol))); + ctx.labels += (tree.symbol -> (new Label(tree.symbol) setParams(params map (_.symbol)))); ctx.method.addLocals(params map (p => new Local(p.symbol, toTypeKind(p.symbol.info), false))); } super.traverse(rhs) @@ -1310,7 +1310,7 @@ abstract class GenICode extends SubComponent { thenCtx: Context, elseCtx: Context): Unit = { - def genComparisonOp(l: Tree, r: Tree, code: Int): Unit = { + def genComparisonOp(l: Tree, r: Tree, code: Int) { // special-case reference (in)equality test for null if (code == scalaPrimitives.ID || code == scalaPrimitives.NI) { val expr: Tree = (l, r) match { @@ -1526,7 +1526,7 @@ abstract class GenICode extends SubComponent { * Add all fields of the given class symbol to the current ICode * class. */ - private def addClassFields(ctx: Context, cls: Symbol): Unit = { + private def addClassFields(ctx: Context, cls: Symbol) { if (settings.debug.value) assert(ctx.clazz.symbol eq cls, "Classes are not the same: " + ctx.clazz.symbol + ", " + cls) @@ -1540,7 +1540,7 @@ abstract class GenICode extends SubComponent { * Add parameters to the current ICode method. It is assumed the methods * have been uncurried, so the list of lists contains just one list. */ - private def addMethodParams(ctx: Context, vparamss: List[List[ValDef]]): Unit = + private def addMethodParams(ctx: Context, vparamss: List[List[ValDef]]) { vparamss match { case Nil => () @@ -1556,6 +1556,7 @@ abstract class GenICode extends SubComponent { case _ => abort("Malformed parameter list: " + vparamss) } + } /** Does this tree have a try-catch block? */ def mayCleanStack(tree: Tree): Boolean = { @@ -1652,7 +1653,7 @@ abstract class GenICode extends SubComponent { do { changed = false - n = n + 1 + n += 1 method.code traverse prune0 } while (changed) @@ -1721,7 +1722,7 @@ abstract class GenICode extends SubComponent { val tree = copy.LabelDef(t, name1, params, transform(rhs)) tree.symbol = labels(t.symbol) - ctx.labels += tree.symbol -> (new Label(tree.symbol) setParams(params map (_.symbol))); + ctx.labels += (tree.symbol -> (new Label(tree.symbol) setParams(params map (_.symbol)))); ctx.method.addLocals(params map (p => new Local(p.symbol, toTypeKind(p.symbol.info), false))); tree @@ -1933,7 +1934,7 @@ abstract class GenICode extends SubComponent { def removeHandler(exh: ExceptionHandler): Unit = { assert(handlerCount > 0 && handlers.head == exh, "Wrong nesting of exception handlers." + this + " for " + exh) - handlerCount = handlerCount - 1 + handlerCount -= 1 handlers = handlers.tail if (settings.debug.value) log("removed handler: " + exh); @@ -2056,7 +2057,7 @@ abstract class GenICode extends SubComponent { def substMap: Map[Instruction, Instruction] = { val map = new HashMap[Instruction, Instruction]() - toPatch foreach (i => map += i -> patch(i)) + toPatch foreach (i => map += (i -> patch(i))) map } diff --git a/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala b/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala index 2e141e0f72..e12b6f1f21 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2006 LAMP/EPFL + * Copyright 2005-2008 LAMP/EPFL * @author Martin Odersky */ @@ -463,18 +463,18 @@ trait TypeKinds { self: ICodes => def initPrimitiveTypeMap = { log("Initializing primitive map") primitiveTypeMap = new HashMap() - primitiveTypeMap += definitions.UnitClass -> UNIT - primitiveTypeMap += definitions.BooleanClass -> BOOL - primitiveTypeMap += definitions.ByteClass -> BYTE - primitiveTypeMap += definitions.ShortClass -> SHORT - primitiveTypeMap += definitions.CharClass -> CHAR - primitiveTypeMap += definitions.IntClass -> INT - primitiveTypeMap += definitions.LongClass -> LONG + primitiveTypeMap += (definitions.UnitClass -> UNIT) + primitiveTypeMap += (definitions.BooleanClass -> BOOL) + primitiveTypeMap += (definitions.ByteClass -> BYTE) + primitiveTypeMap += (definitions.ShortClass -> SHORT) + primitiveTypeMap += (definitions.CharClass -> CHAR) + primitiveTypeMap += (definitions.IntClass -> INT) + primitiveTypeMap += (definitions.LongClass -> LONG) if (!forCLDC) { - primitiveTypeMap += definitions.FloatClass -> FLOAT - primitiveTypeMap += definitions.DoubleClass -> DOUBLE + primitiveTypeMap += (definitions.FloatClass -> FLOAT) + primitiveTypeMap += (definitions.DoubleClass -> DOUBLE) } -// primitiveTypeMap += definitions.StringClass -> STRING +// primitiveTypeMap += (definitions.StringClass -> STRING) } } diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala index 8b2aecafe8..0875c8876b 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2007 LAMP/EPFL + * Copyright 2005-2008 LAMP/EPFL * @author Martin Odersky */ @@ -161,7 +161,7 @@ abstract class CopyPropagation { val commonPairs = a.bindings.toList intersect (b.bindings.toList) val resBindings = new HashMap[Location, Value] for ((k, v) <- commonPairs) - resBindings += k -> v; + resBindings += (k -> v); new State(resBindings, resStack) } } @@ -259,11 +259,12 @@ abstract class CopyPropagation { v match { case Deref(LocalVar(other)) => if (other != local) - out.bindings += LocalVar(local) -> v; + out.bindings += (LocalVar(local) -> v); case _ => - out.bindings += LocalVar(local) -> v; + out.bindings += (LocalVar(local) -> v) } - case Nil => Predef.error("Incorrect icode in " + method + ". Expecting something on the stack.") + case Nil => + Predef.error("Incorrect icode in " + method + ". Expecting something on the stack.") } out.stack = out.stack drop 1; @@ -279,7 +280,7 @@ abstract class CopyPropagation { cleanReferencesTo(out, Field(AllRecords, field)); in.stack match { case v :: Record(_, bindings) :: vs => - bindings += field -> v; + bindings += (field -> v) case _ => (); } } @@ -492,7 +493,7 @@ abstract class CopyPropagation { for ((p, i) <- paramAccessors.zipWithIndex) { // assert(p.tpe == ctor.tpe.paramTypes(i), "In: " + ctor.fullNameString + " having: " + (paramAccessors map (_.tpe))+ " vs. " + ctor.tpe.paramTypes) if (p.tpe == ctor.tpe.paramTypes(i)) - bindings += p -> values.head; + bindings += (p -> values.head); values = values.tail; } diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/Liveness.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/Liveness.scala index 9192f9c043..9bb4e99924 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/analysis/Liveness.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/Liveness.scala @@ -52,8 +52,8 @@ abstract class Liveness { for (b <- m.code.blocks.toList; (g, k) = genAndKill(b)) { - gen += b -> g - kill += b -> k + gen += (b -> g) + kill += (b -> k) } init { @@ -89,7 +89,7 @@ abstract class Liveness { } def blockTransfer(b: BasicBlock, out: lattice.Elem): lattice.Elem = - gen(b) ++ (out excl kill(b)) + gen(b) ++ (out -- kill(b)) /** Abstract interpretation for one instruction. Very important: * liveness is a backward DFA, so this method should be used to compute @@ -115,7 +115,7 @@ abstract class Liveness { override def toString(): String = { val buf = new StringBuilder() - for (val b <- method.code.blocks.toList) { + for (b <- method.code.blocks.toList) { buf.append("\nlive-in(" + b + ")=" + in(b) + "\nlive-out(" + b + ")=" + out(b)); } buf.toString() 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 2ea2461a0e..ddb8125291 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2007 LAMP/EPFL + * Copyright 2005-2008 LAMP/EPFL * @author Martin Odersky */ @@ -89,12 +89,12 @@ abstract class TypeFlowAnalysis { for (binding1 <- env1.elements) { val tp2 = env2(binding1._1) - resultingLocals += binding1._1 -> typeLattice.lub2(binding1._2, tp2) + resultingLocals += (binding1._1 -> typeLattice.lub2(binding1._2, tp2)) } for (binding2 <- env2.elements if resultingLocals(binding2._1) eq typeLattice.bottom) { val tp1 = env1(binding2._1) - resultingLocals += binding2._1 -> typeLattice.lub2(binding2._2, tp1) + resultingLocals += (binding2._1 -> typeLattice.lub2(binding2._2, tp1)) } IState(resultingLocals, typeStackLattice.lub2(a.stack, b.stack)) @@ -208,7 +208,7 @@ abstract class TypeFlowAnalysis { case STORE_LOCAL(local) => val t = stack.pop - bindings += local -> t + bindings += (local -> t) case STORE_THIS(_) => stack.pop |