summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-10-03 04:11:32 +0000
committerPaul Phillips <paulp@improving.org>2010-10-03 04:11:32 +0000
commit2c59afc2c15ddcd124fd175eb30c0cdf9d98463b (patch)
tree591c9315baea0f711da69c6cd7693b4952286705
parent2fefb37220f82300e2aa44442f1a42261d65e359 (diff)
downloadscala-2c59afc2c15ddcd124fd175eb30c0cdf9d98463b.tar.gz
scala-2c59afc2c15ddcd124fd175eb30c0cdf9d98463b.tar.bz2
scala-2c59afc2c15ddcd124fd175eb30c0cdf9d98463b.zip
Removes a bunch of private functions which are ...
Removes a bunch of private functions which are never called. While based on the nature of "private" one can generally feel pretty good that such a thing is safe, there is always a chance the author had some future use in mind. On that note I draw your attention in particular to: (martin) Typers#stabilizedType: it "sounds" important, but most of it has been commented out since 2007 and the little stub part is a never called private. (iulian) SpecializeTypes#makeTypeArguments: similarly sounds like a cornerstone of a transformation until one notices it isn't used. Unused methods are "attractive nuisances" for anyone (like myself) who has to figure out how the compiler works by studying the compiler, for reasons which are no doubt obvious. No review except as noted.
-rw-r--r--src/compiler/scala/tools/ant/Same.scala5
-rw-r--r--src/compiler/scala/tools/nsc/CompileServer.scala2
-rw-r--r--src/compiler/scala/tools/nsc/Interpreter.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala5
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/Checkers.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/Printers.scala2
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala2
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/ReflectionCompletion.scala1
-rw-r--r--src/compiler/scala/tools/nsc/javac/JavaScanners.scala6
-rw-r--r--src/compiler/scala/tools/nsc/matching/ParallelMatching.scala9
-rw-r--r--src/compiler/scala/tools/nsc/transform/OverridingPairs.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala19
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala15
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Variances.scala11
-rw-r--r--src/compiler/scala/tools/nsc/util/ScalaClassLoader.scala3
-rw-r--r--src/compiler/scala/tools/util/PathResolver.scala9
-rw-r--r--src/library/scala/util/parsing/combinator/Parsers.scala14
-rw-r--r--src/library/scala/util/parsing/combinator/lexical/StdLexical.scala3
18 files changed, 1 insertions, 111 deletions
diff --git a/src/compiler/scala/tools/ant/Same.scala b/src/compiler/scala/tools/ant/Same.scala
index 4f7173e68b..2ed0395cfa 100644
--- a/src/compiler/scala/tools/ant/Same.scala
+++ b/src/compiler/scala/tools/ant/Same.scala
@@ -13,7 +13,6 @@ import java.io.{File, FileInputStream}
import org.apache.tools.ant.{BuildException, Project}
import org.apache.tools.ant.taskdefs.MatchingTask
-import org.apache.tools.ant.util.FileUtils
import org.apache.tools.ant.util.{FileNameMapper, IdentityMapper}
import org.apache.tools.ant.types.Mapper
@@ -34,10 +33,6 @@ import org.apache.tools.ant.types.Mapper
* @author Gilles Dubochet
* @version 1.0 */
class Same extends MatchingTask {
-
- /** The unique Ant file utilities instance to use in this task. */
- private val fileUtils = FileUtils.getFileUtils()
-
/*============================================================================*\
** Ant user-properties **
\*============================================================================*/
diff --git a/src/compiler/scala/tools/nsc/CompileServer.scala b/src/compiler/scala/tools/nsc/CompileServer.scala
index 832f1e5aef..04e9b3421e 100644
--- a/src/compiler/scala/tools/nsc/CompileServer.scala
+++ b/src/compiler/scala/tools/nsc/CompileServer.scala
@@ -34,8 +34,6 @@ class StandardCompileServer extends SocketServer
private var compiler: Global = null
- private def settingsAreCompatible(s1: Settings, s2: Settings) = s1 == s2
-
private def exit(code: Int): Nothing = {
System.err.close()
System.out.close()
diff --git a/src/compiler/scala/tools/nsc/Interpreter.scala b/src/compiler/scala/tools/nsc/Interpreter.scala
index 3be1b44a4c..1ab46b1a25 100644
--- a/src/compiler/scala/tools/nsc/Interpreter.scala
+++ b/src/compiler/scala/tools/nsc/Interpreter.scala
@@ -775,8 +775,6 @@ class Interpreter(val settings: Settings, out: PrintWriter) {
}
private def selectorWild = selectors filter (_.name == USCOREkw) // wildcard imports, e.g. import foo._
- private def selectorMasked = selectors filter (_.rename == USCOREkw) // masking imports, e.g. import foo.{ bar => _ }
- private def selectorNames = selectors map (_.name)
private def selectorRenames = selectors map (_.rename) filterNot (_ == null)
/** Whether this import includes a wildcard import */
diff --git a/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala b/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala
index bdcee1cba7..c09851fa86 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala
@@ -88,8 +88,6 @@ trait BasicBlocks {
*/
private var instructionList: List[Instruction] = Nil
- private var _lastInstruction: Instruction = null
-
private var instrs: Array[Instruction] = _
override def toList: List[Instruction] =
@@ -266,8 +264,7 @@ trait BasicBlocks {
}
else {
instr.setPos(pos)
- instructionList = instr :: instructionList
- _lastInstruction = instr
+ instructionList ::= instr
}
}
diff --git a/src/compiler/scala/tools/nsc/backend/icode/Checkers.scala b/src/compiler/scala/tools/nsc/backend/icode/Checkers.scala
index bb09030c17..61f2d8dd25 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/Checkers.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/Checkers.scala
@@ -219,7 +219,6 @@ abstract class Checkers {
}
}
- private var typeStack: TypeStack = null
private var instruction: Instruction = null
private var basicBlock: BasicBlock = null
@@ -278,7 +277,6 @@ abstract class Checkers {
}
}
- this.typeStack = stack
this.basicBlock = b
def typeError(k1: TypeKind, k2: TypeKind) {
diff --git a/src/compiler/scala/tools/nsc/backend/icode/Printers.scala b/src/compiler/scala/tools/nsc/backend/icode/Printers.scala
index a9ec70d390..7b76183c58 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/Printers.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/Printers.scala
@@ -58,9 +58,7 @@ trait Printers { self: ICodes =>
case x :: xs => pr(x); print(sep); printList(pr)(xs, sep)
}
- private var clazz: IClass = _
def printClass(cls: IClass) {
- this.clazz = cls;
print(cls.symbol.toString()); print(" extends ");
printList(cls.symbol.info.parents, ", ");
indent; println(" {");
diff --git a/src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala b/src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala
index 92df6a8736..74b3c6ee48 100644
--- a/src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala
@@ -37,8 +37,6 @@ trait InteractiveReader {
object InteractiveReader {
val msgEINTR = "Interrupted system call"
- private val exes = List(classOf[Exception], classOf[NoClassDefFoundError])
-
def createDefault(): InteractiveReader = createDefault(null)
/** Create an interactive reader. Uses <code>JLineReader</code> if the
diff --git a/src/compiler/scala/tools/nsc/interpreter/ReflectionCompletion.scala b/src/compiler/scala/tools/nsc/interpreter/ReflectionCompletion.scala
index f9ff894d59..fd090db89e 100644
--- a/src/compiler/scala/tools/nsc/interpreter/ReflectionCompletion.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/ReflectionCompletion.scala
@@ -72,7 +72,6 @@ class StaticCompletion(val clazz: Class[_]) extends ReflectionCompletion {
lazy val completions = memberCompletions
def completions(verbosity: Int) = completions
- private def aliasForPath(path: String) = ByteCode aliasForType path flatMap (x => classForName(x + "$"))
def className = clazz.getName
def isJava = !isScalaClazz(clazz)
diff --git a/src/compiler/scala/tools/nsc/javac/JavaScanners.scala b/src/compiler/scala/tools/nsc/javac/JavaScanners.scala
index 948cbfd9f9..fccb1746fe 100644
--- a/src/compiler/scala/tools/nsc/javac/JavaScanners.scala
+++ b/src/compiler/scala/tools/nsc/javac/JavaScanners.scala
@@ -332,12 +332,6 @@ trait JavaScanners {
t
}
- private def afterLineEnd() = (
- lastPos < in.lineStartPos &&
- (in.lineStartPos <= pos ||
- lastPos < in.lastLineStartPos && in.lastLineStartPos <= pos)
- )
-
/** read next token
*/
private def fetchToken() {
diff --git a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala
index d6ad521310..3606bda6e0 100644
--- a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala
+++ b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala
@@ -735,13 +735,6 @@ trait ParallelMatching extends ast.TreeDSL
// arguments to pass to this body%xx
def labelParamTypes = label.tpe.paramTypes
- private def consistencyFailure(idents: List[Tree], vdefs: List[Tree]) = {
- val LabelDef(name, params, rhs) = label
-
- val msg = "Consistency failure in generated block %s(%s):\n idents = %s\n vdefs = %s\n"
- abort(msg.format(name, pp(labelParamTypes), pp(idents), pp(vdefs)))
- }
-
def createLabelBody(index: Int, pvgroup: PatternVarGroup) = {
val args = pvgroup.syms
val vdefs = pvgroup.valDefs
@@ -766,8 +759,6 @@ trait ParallelMatching extends ast.TreeDSL
val idents = pvgroup map (_.rhs)
val vdefs = pvgroup.valDefs
referenceCount += 1
- // if (idents.size != labelParamTypes.size)
- // consistencyFailure(idents, vdefs)
ifLabellable(vdefs, ID(labelSym) APPLY (idents))
}
diff --git a/src/compiler/scala/tools/nsc/transform/OverridingPairs.scala b/src/compiler/scala/tools/nsc/transform/OverridingPairs.scala
index 1500759b30..6721280801 100644
--- a/src/compiler/scala/tools/nsc/transform/OverridingPairs.scala
+++ b/src/compiler/scala/tools/nsc/transform/OverridingPairs.scala
@@ -54,8 +54,6 @@ abstract class OverridingPairs {
*/
private type BitSet = Array[Int]
- private def newBitSet(size: Int): BitSet = new Array((size + 31) >> 5)
-
private def include(bs: BitSet, n: Int) {
val nshifted = n >> 5
val nmask = 1 << (n & 31)
diff --git a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
index 420ec6b3ba..89c44654da 100644
--- a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
+++ b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
@@ -1427,25 +1427,6 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers {
/** Concrete methods that use a specialized type, or override such methods. */
private val concreteSpecMethods: mutable.Set[Symbol] = new mutable.HashSet
- /** Instantiate polymorphic function `target' with type parameters from `from'.
- * For each type parameter `tp' in `target', its argument is:
- * - a corresponding type parameter of `from', if tp is not bound in
- * typeEnv(from)
- * - the upper bound of tp, if the binding conflicts with tp's bounds
- * - typeEnv(from)(tp), if the binding is not conflicting in its bounds
- */
- private def makeTypeArguments(from: Symbol, target: Symbol): List[Type] = {
- val owner = from.owner
- val env = typeEnv(from)
- for (tp <- owner.info.memberType(target).typeParams)
- yield
- if (!env.isDefinedAt(tp))
- typeRef(NoPrefix, from.info.typeParams.find(_.name == tp.name).get, Nil)
- else if ((env(tp) <:< tp.info.bounds.hi) && (tp.info.bounds.lo <:< env(tp)))
- env(tp)
- else tp.info.bounds.hi
- }
-
private def makeArguments(fun: Symbol, vparams: List[Symbol]): List[Tree] = {
def needsCast(tp1: Type, tp2: Type): Boolean =
!(tp1 <:< tp2)
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 619aad94dc..6a67fecd80 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -661,21 +661,6 @@ trait Typers { self: Analyzer =>
case _ => !phase.erasedTypes
}
- private def stabilizedType(tree: Tree): Type = tree.tpe
-/*{
- val sym = tree.symbol
- val res = tree match {
- case Ident(_) if (sym.isStable) =>
- val pre = if (sym.owner.isClass) sym.owner.thisType else NoPrefix
- singleType(pre, sym)
- case Select(qual, _) if (qual.tpe.isStable && sym.isStable) =>
- singleType(qual.tpe, sym)
- case _ =>
- tree.tpe
- }
- res
- }
-*/
/**
* @param tree ...
* @param mode ...
diff --git a/src/compiler/scala/tools/nsc/typechecker/Variances.scala b/src/compiler/scala/tools/nsc/typechecker/Variances.scala
index 7d0500d598..7e1f6efa3c 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Variances.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Variances.scala
@@ -15,12 +15,6 @@ trait Variances {
val global: Global
import global._
- /** Convert variance to string */
- private def varianceString(variance: Int): String =
- if (variance == COVARIANT) "covariant"
- else if (variance == CONTRAVARIANT) "contravariant"
- else "invariant"
-
/** Flip between covariant and contravariant */
private def flip(v: Int): Int = {
if (v == COVARIANT) CONTRAVARIANT
@@ -28,11 +22,6 @@ trait Variances {
else v
}
- private def compose(v1: Int, v2: Int) =
- if (v1 == 0) 0
- else if (v1 == CONTRAVARIANT) flip(v2)
- else v2;
-
/** Map everything below VARIANCES to 0 */
private def cut(v: Int): Int =
if (v == VARIANCES) v else 0
diff --git a/src/compiler/scala/tools/nsc/util/ScalaClassLoader.scala b/src/compiler/scala/tools/nsc/util/ScalaClassLoader.scala
index 5b1471c90d..a739caa8a4 100644
--- a/src/compiler/scala/tools/nsc/util/ScalaClassLoader.scala
+++ b/src/compiler/scala/tools/nsc/util/ScalaClassLoader.scala
@@ -32,9 +32,6 @@ trait ScalaClassLoader extends JavaClassLoader {
/** Load, link and initialize a class with this classloader */
def tryToInitializeClass[T <: AnyRef](path: String): Option[Class[T]] = tryClass(path, true)
- private def tryBody[T <: AnyRef](body: => Any): Option[T] =
- catching(classOf[ClassNotFoundException], classOf[SecurityException]) opt body.asInstanceOf[T]
-
private def tryClass[T <: AnyRef](path: String, initialize: Boolean): Option[Class[T]] =
catching(classOf[ClassNotFoundException], classOf[SecurityException]) opt
Class.forName(path, initialize, this).asInstanceOf[Class[T]]
diff --git a/src/compiler/scala/tools/util/PathResolver.scala b/src/compiler/scala/tools/util/PathResolver.scala
index d2cb5e74c0..b2b47fe625 100644
--- a/src/compiler/scala/tools/util/PathResolver.scala
+++ b/src/compiler/scala/tools/util/PathResolver.scala
@@ -20,11 +20,6 @@ import PartialFunction.condOpt
object PathResolver {
def firstNonEmpty(xs: String*) = xs find (_ != "") getOrElse ""
- private def fileOpt(f: Path): Option[String] = f ifFile (_.path)
- private def dirOpt(d: Path): Option[String] = d ifDirectory (_.path)
- private def expandToPath(p: Path) = join(ClassPath.expandPath(p.path, true): _*)
- private def expandToContents(p: Path) = join(ClassPath.expandDir(p.path): _*)
-
/** Map all classpath elements to absolute paths and reconstruct the classpath.
*/
def makeAbsolute(cp: String) = ClassPath.map(cp, x => Path(x).toAbsolute.path)
@@ -43,10 +38,6 @@ object PathResolver {
import scala.collection.JavaConversions._
System.getProperties find (_._1 endsWith ".boot.class.path") map (_._2) getOrElse ""
}
- private def searchForScalaHome = {
- for (url <- ScalaClassLoader originOfClass classOf[ScalaObject] ; if url.getProtocol == "file") yield
- File(url.getFile).parent.path
- } getOrElse ""
/** Environment variables which java pays attention to so it
* seems we do as well.
diff --git a/src/library/scala/util/parsing/combinator/Parsers.scala b/src/library/scala/util/parsing/combinator/Parsers.scala
index 0df8871f82..3de283107e 100644
--- a/src/library/scala/util/parsing/combinator/Parsers.scala
+++ b/src/library/scala/util/parsing/combinator/Parsers.scala
@@ -397,20 +397,6 @@ trait Parsers {
def ? = opt(this)
}
- // TODO: can this implemented in ParseResult, like map?
- /** A helper method for sequential composition of (unit-)parsers
- */
- private def seq[T, U, V](p: => Input => ParseResult[T], q: => Input => ParseResult[U])
- (compose: (T, U) => V)
- (in: Input): ParseResult[V]
- = p(in) match {
- case Success(x, next1) => q(next1) match {
- case Success(y, next2) => Success(compose(x, y), next2)
- case ns: NoSuccess => ns
- }
- case ns: NoSuccess => ns
- }
-
/** Wrap a parser so that its failures become errors (the | combinator will give up as soon as
* it encounters an error, on failure it simply tries the next alternative)
*/
diff --git a/src/library/scala/util/parsing/combinator/lexical/StdLexical.scala b/src/library/scala/util/parsing/combinator/lexical/StdLexical.scala
index 8d286d9aef..f9bb2841fb 100644
--- a/src/library/scala/util/parsing/combinator/lexical/StdLexical.scala
+++ b/src/library/scala/util/parsing/combinator/lexical/StdLexical.scala
@@ -84,7 +84,4 @@ class StdLexical extends Lexical with StdTokens {
(d.toList map parseDelim).foldRight(failure("no matching delimiter"): Parser[Token])((x, y) => y | x)
}
protected def delim: Parser[Token] = _delim
-
- private def lift[T](f: String => T)(xs: List[Char]): T = f(xs.mkString("", "", ""))
- private def lift2[T](f: String => T)(p: ~[Char, List[Char]]): T = lift(f)(p._1 :: p._2)
}