summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2009-11-20 15:16:45 +0000
committerPaul Phillips <paulp@improving.org>2009-11-20 15:16:45 +0000
commitf7b8e8f346fed1d8128976db959bff7001ed1d57 (patch)
tree59f18491ee87c9f33922b510f071f27013b355a6 /src/compiler
parent99d8d53c36cb2283df9d42b25273aeba594e82b5 (diff)
downloadscala-f7b8e8f346fed1d8128976db959bff7001ed1d57.tar.gz
scala-f7b8e8f346fed1d8128976db959bff7001ed1d57.tar.bz2
scala-f7b8e8f346fed1d8128976db959bff7001ed1d57.zip
More world-shaking deprecation work.
object, updating some @deprecated messages to give realistic alternatives, properly resolving the semantic mismatch between List.-- and diff, its once-recommended but inequivalent alternative.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Scanners.scala4
-rw-r--r--src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala19
-rw-r--r--src/compiler/scala/tools/nsc/interactive/RangePositions.scala2
-rw-r--r--src/compiler/scala/tools/nsc/io/VirtualFile.scala2
-rw-r--r--src/compiler/scala/tools/nsc/javac/JavaScanners.scala4
-rw-r--r--src/compiler/scala/tools/nsc/symtab/BaseTypeSeqs.scala4
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Types.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/RefChecks.scala2
-rw-r--r--src/compiler/scala/tools/nsc/util/HashSet.scala2
10 files changed, 24 insertions, 19 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
index 267d5bd17f..9648735a15 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
@@ -680,7 +680,7 @@ trait Scanners {
var value: Long = 0
val divider = if (base == 10) 1 else 2
val limit: Long =
- if (token == LONGLIT) Math.MAX_LONG else Math.MAX_INT
+ if (token == LONGLIT) Long.MaxValue else Int.MaxValue
var i = 0
val len = strVal.length
while (i < len) {
@@ -709,7 +709,7 @@ trait Scanners {
*/
def floatVal(negated: Boolean): Double = {
val limit: Double =
- if (token == DOUBLELIT) Math.MAX_DOUBLE else Math.MAX_FLOAT
+ if (token == DOUBLELIT) Double.MaxValue else Float.MaxValue
try {
val value: Double = java.lang.Double.valueOf(strVal).doubleValue()
if (value > limit)
diff --git a/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala b/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala
index 8e794f4787..a5076eb28c 100644
--- a/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala
+++ b/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala
@@ -561,7 +561,7 @@ abstract class GenMSIL extends SubComponent {
}
if (mcode != null) {
- for (local <- m.locals -- m.params) {
+ for (local <- m.locals ; if !(m.params contains local)) {
if (settings.debug.value)
log("add local var: " + local + ", of kind " + local.kind)
val t: MsilType = msilType(local.kind)
@@ -828,6 +828,11 @@ abstract class GenMSIL extends SubComponent {
// covering the same blocks
def orderBlocksForExh(blocks: List[BasicBlock], exH: List[ExceptionHandler]): List[BasicBlock] = {
+ def moveToFront[T](xs: List[T], x: T) = (xs indexOf x) match {
+ case -1 => xs
+ case idx => x :: (xs take idx) ::: (xs drop (idx + 1))
+ }
+
var blocksToPut: List[BasicBlock] = blocks
var nextBlock: BasicBlock = null
var untreatedHandlers: List[ExceptionHandler] = exH
@@ -841,7 +846,7 @@ abstract class GenMSIL extends SubComponent {
// problem: block may already be added, and and needs to be moved.
// if nextblock NOT in b: check if nextblock in blocksToPut, if NOT, check if movable, else don't put
if (nextBlock != null && b.contains(nextBlock)) {
- val blocksToAdd = nextBlock :: (b - nextBlock)
+ val blocksToAdd = moveToFront(b, nextBlock)
nextBlock = null
addBlocks(blocksToAdd)
}
@@ -854,7 +859,7 @@ abstract class GenMSIL extends SubComponent {
{
// the block is not part of some catch or finally code
currentBlock.addBasicBlock(x)
- blocksToPut = blocksToPut - x
+ blocksToPut = moveToFront(blocksToPut, x)
if (settings.debug.value) log(" -> addBlocks(" + xs + ")")
addBlocks(xs)
} else {
@@ -865,7 +870,7 @@ abstract class GenMSIL extends SubComponent {
// is optimized by compiler (no try left)
if(untreatedHandlers.forall(h =>
(!h.blocks.contains(x) || h.covered.isEmpty))) {
- blocksToPut = blocksToPut - x
+ blocksToPut = moveToFront(blocksToPut, x)
addBlocks(xs)
} else
addBlocks(xs ::: List(x))
@@ -983,7 +988,7 @@ abstract class GenMSIL extends SubComponent {
// shorter try-catch-finally last (the ones contained in another)
affectedHandlers = affectedHandlers.sortWith(_.covered.size > _.covered.size)
affectedHandlers = affectedHandlers.filter(h => {h.covered.size == affectedHandlers(0).covered.size})
- untreatedHandlers = untreatedHandlers -- affectedHandlers
+ untreatedHandlers = untreatedHandlers filterNot (affectedHandlers contains)
// more than one catch produces more than one exh, but we only need one
var singleAffectedHandler: ExceptionHandler = affectedHandlers(0) // List[ExceptionHandler] = Nil
@@ -1128,7 +1133,7 @@ abstract class GenMSIL extends SubComponent {
"untreated exception handlers left: " + untreatedHandlers)
// remove catch blocks from empty handlers (finally-blocks remain)
untreatedHandlers.foreach((h) => {
- orderedBlocks = orderedBlocks -- h.blocks
+ orderedBlocks = orderedBlocks filterNot (h.blocks contains)
})
// take care of order in which exHInstructions are executed (BeginExceptionBlock as last)
@@ -1790,7 +1795,7 @@ abstract class GenMSIL extends SubComponent {
idx += 1 // sizeOf(l.kind)
}
- val locvars = m.locals -- params
+ val locvars = m.locals filterNot (params contains)
idx = 0
for (l <- locvars) {
diff --git a/src/compiler/scala/tools/nsc/interactive/RangePositions.scala b/src/compiler/scala/tools/nsc/interactive/RangePositions.scala
index 2e6041f4c4..78d3b55a3b 100644
--- a/src/compiler/scala/tools/nsc/interactive/RangePositions.scala
+++ b/src/compiler/scala/tools/nsc/interactive/RangePositions.scala
@@ -71,7 +71,7 @@ self: scala.tools.nsc.Global =>
Range(new RangePosition(null, lo, lo, hi), EmptyTree)
/** The maximal free range */
- private lazy val maxFree: Range = free(0, Math.MAX_INT)
+ private lazy val maxFree: Range = free(0, Int.MaxValue)
/** A singleton list of a non-empty range from `lo` to `hi`, or else the empty List */
private def maybeFree(lo: Int, hi: Int) =
diff --git a/src/compiler/scala/tools/nsc/io/VirtualFile.scala b/src/compiler/scala/tools/nsc/io/VirtualFile.scala
index 90769d7086..65e7e34d88 100644
--- a/src/compiler/scala/tools/nsc/io/VirtualFile.scala
+++ b/src/compiler/scala/tools/nsc/io/VirtualFile.scala
@@ -68,7 +68,7 @@ class VirtualFile(val name: String, _path: String) extends AbstractFile
def isDirectory: Boolean = false
/** Returns the time that this abstract file was last modified. */
- def lastModified: Long = Math.MIN_LONG
+ def lastModified: Long = Long.MinValue
/** Returns all abstract subfiles of this abstract directory. */
def iterator: Iterator[AbstractFile] = {
diff --git a/src/compiler/scala/tools/nsc/javac/JavaScanners.scala b/src/compiler/scala/tools/nsc/javac/JavaScanners.scala
index 2ffea32307..9d7889ccc2 100644
--- a/src/compiler/scala/tools/nsc/javac/JavaScanners.scala
+++ b/src/compiler/scala/tools/nsc/javac/JavaScanners.scala
@@ -836,7 +836,7 @@ trait JavaScanners {
var value: Long = 0
val divider = if (base == 10) 1 else 2
val limit: Long =
- if (token == LONGLIT) Math.MAX_LONG else Math.MAX_INT
+ if (token == LONGLIT) Long.MaxValue else Int.MaxValue
var i = 0
val len = name.length
while (i < len) {
@@ -864,7 +864,7 @@ trait JavaScanners {
*/
def floatVal(negated: Boolean): Double = {
val limit: Double =
- if (token == DOUBLELIT) Math.MAX_DOUBLE else Math.MAX_FLOAT
+ if (token == DOUBLELIT) Double.MaxValue else Float.MaxValue
try {
val value: Double = java.lang.Double.valueOf(name.toString()).doubleValue()
if (value > limit)
diff --git a/src/compiler/scala/tools/nsc/symtab/BaseTypeSeqs.scala b/src/compiler/scala/tools/nsc/symtab/BaseTypeSeqs.scala
index 6c29ab5cf3..9bd2a79449 100644
--- a/src/compiler/scala/tools/nsc/symtab/BaseTypeSeqs.scala
+++ b/src/compiler/scala/tools/nsc/symtab/BaseTypeSeqs.scala
@@ -8,7 +8,7 @@ package symtab
// todo implement in terms of BitSet
import scala.collection.mutable.ListBuffer
import scala.collection.immutable.Map
-import Math.max
+import math.max
/** A base type sequence (BaseTypeSeq) is an ordered sequence spanning all the base types
* of a type. It characterized by the following two laws:
@@ -137,7 +137,7 @@ trait BaseTypeSeqs {
protected def maxDepthOfElems = {
var d = 0
- for (i <- 0 until length) d = Math.max(d, maxDpth(elems(i)))
+ for (i <- 0 until length) d = max(d, maxDpth(elems(i)))
d
}
diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala
index 99877e31b3..1dad1f1272 100644
--- a/src/compiler/scala/tools/nsc/symtab/Types.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Types.scala
@@ -3626,7 +3626,7 @@ A type's typeSymbol should never be inspected directly.
*/
def lubDepth(ts: List[Type]) = {
var d = 0
- for (tp <- ts) d = Math.max(d, tp.baseTypeSeqDepth)
+ for (tp <- ts) d = math.max(d, tp.baseTypeSeqDepth)
d + LubGlbMargin
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala b/src/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala
index ba328b9f48..8d9cee7f03 100644
--- a/src/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala
@@ -154,7 +154,7 @@ abstract class ConstantFolder {
private def foldBinop(op: Name, x: Constant, y: Constant): Constant = {
val optag =
if (x.tag == y.tag) x.tag
- else if (isNumeric(x.tag) && isNumeric(y.tag)) Math.max(x.tag, y.tag)
+ else if (isNumeric(x.tag) && isNumeric(y.tag)) math.max(x.tag, y.tag)
else NoTag
try optag match {
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
index 916ed69b67..fbe01c7fac 100644
--- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
@@ -668,7 +668,7 @@ abstract class RefChecks extends InfoTransform {
class LevelInfo(val outer: LevelInfo) {
val scope: Scope = if (outer eq null) new Scope else new Scope(outer.scope)
- var maxindex: Int = Math.MIN_INT
+ var maxindex: Int = Int.MinValue
var refpos: Position = _
var refsym: Symbol = _
}
diff --git a/src/compiler/scala/tools/nsc/util/HashSet.scala b/src/compiler/scala/tools/nsc/util/HashSet.scala
index ebc517266b..32aef80d25 100644
--- a/src/compiler/scala/tools/nsc/util/HashSet.scala
+++ b/src/compiler/scala/tools/nsc/util/HashSet.scala
@@ -24,7 +24,7 @@ class HashSet[T >: Null <: AnyRef](val label: String, initialCapacity: Int) exte
table = new Array[AnyRef](capacity)
}
- private def index(x: Int): Int = Math.abs(x % capacity)
+ private def index(x: Int): Int = math.abs(x % capacity)
def findEntry(x: T): T = {
var h = index(x.hashCode())