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. git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@23173 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
parent
dd62f9e895
commit
2cbc9d3f30
|
@ -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 **
|
||||
\*============================================================================*/
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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(" {");
|
||||
|
|
|
@ -36,9 +36,7 @@ trait InteractiveReader {
|
|||
|
||||
|
||||
object InteractiveReader {
|
||||
val msgEINTR = "Interrupted system call"
|
||||
private val exes = List(classOf[Exception], classOf[NoClassDefFoundError])
|
||||
|
||||
val msgEINTR = "Interrupted system call"
|
||||
def createDefault(): InteractiveReader = createDefault(null)
|
||||
|
||||
/** Create an interactive reader. Uses <code>JLineReader</code> if the
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -1426,25 +1426,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 =
|
||||
|
|
|
@ -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 ...
|
||||
|
|
|
@ -14,12 +14,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 = {
|
||||
|
@ -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
|
||||
|
|
|
@ -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]]
|
||||
|
|
|
@ -19,11 +19,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.
|
||||
*/
|
||||
|
@ -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.
|
||||
|
|
|
@ -396,20 +396,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)
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue