Permalink
Browse files

Removing more unneeded code.

  • Loading branch information...
paulp committed May 15, 2012
1 parent f865e3b commit 3e038d801cd3177ed1230eb7729e11f8743db23a
Showing with 128 additions and 1,432 deletions.
  1. +32 −63 src/compiler/scala/reflect/internal/HasFlags.scala
  2. +0 −112 src/compiler/scala/reflect/internal/SymbolCreations.scala
  3. +0 −77 src/compiler/scala/reflect/internal/SymbolFlags.scala
  4. +0 −2 src/compiler/scala/reflect/internal/SymbolTable.scala
  5. +75 −9 src/compiler/scala/reflect/internal/Symbols.scala
  6. +0 −27 src/compiler/scala/reflect/internal/TypeDebugging.scala
  7. +0 −12 src/compiler/scala/tools/nsc/Interpreter.scala
  8. +0 −12 src/compiler/scala/tools/nsc/InterpreterLoop.scala
  9. +0 −13 src/compiler/scala/tools/nsc/MainInterpreter.scala
  10. +3 −24 src/compiler/scala/tools/nsc/interpreter/AbstractFileClassLoader.scala
  11. +0 −23 src/compiler/scala/tools/nsc/interpreter/CodeHandlers.scala
  12. +0 −4 src/compiler/scala/tools/nsc/interpreter/Completion.scala
  13. +1 −58 src/compiler/scala/tools/nsc/interpreter/CompletionAware.scala
  14. +0 −33 src/compiler/scala/tools/nsc/interpreter/Eval.scala
  15. +0 −2 src/compiler/scala/tools/nsc/interpreter/ExprTyper.scala
  16. +0 −56 src/compiler/scala/tools/nsc/interpreter/FileCompletion.scala
  17. +6 −123 src/compiler/scala/tools/nsc/interpreter/ILoop.scala
  18. +0 −3 src/compiler/scala/tools/nsc/interpreter/IMain.scala
  19. +0 −1 src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala
  20. +1 −25 src/compiler/scala/tools/nsc/interpreter/JLineCompletion.scala
  21. +0 −3 src/compiler/scala/tools/nsc/interpreter/JLineReader.scala
  22. +0 −39 src/compiler/scala/tools/nsc/interpreter/KeyBinding.scala
  23. +0 −44 src/compiler/scala/tools/nsc/interpreter/ProductCompletion.scala
  24. +0 −9 src/compiler/scala/tools/nsc/interpreter/ReplStrings.scala
  25. +0 −11 src/compiler/scala/tools/nsc/interpreter/Runner.scala
  26. +0 −1 src/compiler/scala/tools/nsc/interpreter/SimpleReader.scala
  27. +0 −44 src/compiler/scala/tools/nsc/interpreter/XMLCompletion.scala
  28. +0 −44 src/compiler/scala/tools/nsc/io/ClassAndJarInfo.scala
  29. +0 −5 src/compiler/scala/tools/nsc/package.scala
  30. +3 −3 src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
  31. +1 −82 src/compiler/scala/tools/nsc/util/ClassPath.scala
  32. +1 −22 src/compiler/scala/tools/nsc/util/ScalaClassLoader.scala
  33. +0 −38 src/library/scala/collection/interfaces/IterableMethods.scala
  34. +0 −45 src/library/scala/collection/interfaces/MapMethods.scala
  35. +0 −70 src/library/scala/collection/interfaces/SeqMethods.scala
  36. +0 −51 src/library/scala/collection/interfaces/SetMethods.scala
  37. +0 −63 src/library/scala/collection/interfaces/TraversableMethods.scala
  38. +0 −77 src/library/scala/collection/interfaces/TraversableOnceMethods.scala
  39. +1 −1 test/files/jvm/interpreter.scala
  40. +1 −1 test/files/run/repl-backticks.scala
  41. +0 −65 test/files/run/repl-suppressed-warnings.check
  42. +0 −32 test/files/run/repl-suppressed-warnings.scala
  43. +2 −2 test/files/run/t1500.scala
  44. +1 −1 test/files/run/t1501.scala
@@ -75,70 +75,41 @@ trait HasFlags {
* flag carrying entity.
*/
def resolveOverloadedFlag(flag: Long): String = Flags.flagToString(flag)
-
- def privateWithinString = if (hasAccessBoundary) privateWithin.toString else ""
-
- protected def isSetting(f: Long, mask: Long) = !hasFlag(f) && ((mask & f) != 0L)
- protected def isClearing(f: Long, mask: Long) = hasFlag(f) && ((mask & f) != 0L)
// Tests which come through cleanly: both Symbol and Modifiers use these
// identically, testing for a single flag.
- def isCase = hasFlag(CASE )
- def isFinal = hasFlag(FINAL )
- def isImplicit = hasFlag(IMPLICIT )
- def isLazy = hasFlag(LAZY )
- def isMutable = hasFlag(MUTABLE ) // in Modifiers, formerly isVariable
- def isOverride = hasFlag(OVERRIDE )
- def isPrivate = hasFlag(PRIVATE )
- def isProtected = hasFlag(PROTECTED)
- def isSynthetic = hasFlag(SYNTHETIC)
- def isInterface = hasFlag(INTERFACE)
-
- // Newly introduced based on having a reasonably obvious clean translation.
- def isPrivateLocal = hasAllFlags(PrivateLocal)
- def isProtectedLocal = hasAllFlags(ProtectedLocal)
- def isParamAccessor = hasFlag(PARAMACCESSOR)
- def isCaseAccessor = hasFlag(CASEACCESSOR)
- def isSuperAccessor = hasFlag(SUPERACCESSOR)
- def isLifted = hasFlag(LIFTED)
-
- // Formerly the Modifiers impl did not include the access boundary check,
- // which must have been a bug.
- def isPublic = hasNoFlags(PRIVATE | PROTECTED) && !hasAccessBoundary
-
- // Removed isClass qualification since the flag isn't overloaded and
- // sym.isClass is enforced in Namers#validate.
- def isSealed = hasFlag(SEALED)
-
- // Removed !isClass qualification since the flag isn't overloaded.
- def isDeferred = hasFlag(DEFERRED)
-
- // Dropped isTerm condition because flag isn't overloaded.
+ def hasAbstractFlag = hasFlag(ABSTRACT)
+ def hasAccessorFlag = hasFlag(ACCESSOR)
+ def hasDefault = hasAllFlags(DEFAULTPARAM | PARAM)
+ def hasLocalFlag = hasFlag(LOCAL)
+ def hasModuleFlag = hasFlag(MODULE)
+ def hasPackageFlag = hasFlag(PACKAGE)
+ def hasStableFlag = hasFlag(STABLE)
+ def hasStaticFlag = hasFlag(STATIC)
def isAbstractOverride = hasFlag(ABSOVERRIDE)
- def isAnyOverride = hasFlag(OVERRIDE | ABSOVERRIDE)
-
- // Disambiguating: DEFAULTPARAM, TRAIT
- def hasDefault = hasAllFlags(DEFAULTPARAM | PARAM)
- def isTrait = hasFlag(TRAIT) && !hasFlag(PARAM)
-
- // Straightforwardly named accessors already being used differently.
- // These names are most likely temporary.
- def hasAbstractFlag = hasFlag(ABSTRACT)
- def hasAccessorFlag = hasFlag(ACCESSOR)
- def hasLocalFlag = hasFlag(LOCAL)
- def hasModuleFlag = hasFlag(MODULE)
- def hasPackageFlag = hasFlag(PACKAGE)
- def hasStableFlag = hasFlag(STABLE)
- def hasStaticFlag = hasFlag(STATIC)
-
- // Disambiguating: LABEL, CONTRAVARIANT, INCONSTRUCTOR
- def isLabel = hasAllFlags(LABEL | METHOD) && !hasAccessorFlag
- // Cannot effectively disambiguate the others at this level.
- def hasContravariantFlag = hasFlag(CONTRAVARIANT)
- def hasInConstructorFlag = hasFlag(INCONSTRUCTOR)
-
- // Name
- def isJavaDefined = hasFlag(JAVA)
+ def isAnyOverride = hasFlag(OVERRIDE | ABSOVERRIDE)
+ def isCase = hasFlag(CASE)
+ def isCaseAccessor = hasFlag(CASEACCESSOR)
+ def isDeferred = hasFlag(DEFERRED)
+ def isFinal = hasFlag(FINAL)
+ def isImplicit = hasFlag(IMPLICIT)
+ def isInterface = hasFlag(INTERFACE)
+ def isJavaDefined = hasFlag(JAVA)
+ def isLabel = hasAllFlags(LABEL | METHOD) && !hasAccessorFlag
+ def isLazy = hasFlag(LAZY)
+ def isLifted = hasFlag(LIFTED)
+ def isMutable = hasFlag(MUTABLE)
+ def isOverride = hasFlag(OVERRIDE)
+ def isParamAccessor = hasFlag(PARAMACCESSOR)
+ def isPrivate = hasFlag(PRIVATE)
+ def isPrivateLocal = hasAllFlags(PrivateLocal)
+ def isProtected = hasFlag(PROTECTED)
+ def isProtectedLocal = hasAllFlags(ProtectedLocal)
+ def isPublic = hasNoFlags(PRIVATE | PROTECTED) && !hasAccessBoundary
+ def isSealed = hasFlag(SEALED)
+ def isSuperAccessor = hasFlag(SUPERACCESSOR)
+ def isSynthetic = hasFlag(SYNTHETIC)
+ def isTrait = hasFlag(TRAIT) && !hasFlag(PARAM)
def flagBitsToString(bits: Long): String = {
// Fast path for common case
@@ -162,7 +133,7 @@ trait HasFlags {
}
def accessString: String = {
- val pw = privateWithinString
+ val pw = if (hasAccessBoundary) privateWithin.toString else ""
if (pw == "") {
if (hasAllFlags(PrivateLocal)) "private[this]"
@@ -188,8 +159,6 @@ trait HasFlags {
def hasTraitFlag = hasFlag(TRAIT)
@deprecated("Use hasDefault", "2.10.0")
def hasDefaultFlag = hasFlag(DEFAULTPARAM)
- @deprecated("", "2.9.0")
- def isAbstract = hasFlag(ABSTRACT)
@deprecated("Use isValueParameter or isTypeParameter", "2.10.0")
def isParameter = hasFlag(PARAM)
@deprecated("Use flagString", "2.10.0")
@@ -1,112 +0,0 @@
- /* NSC -- new Scala compiler
- * Copyright 2005-2011 LAMP/EPFL
- * @author Paul Phillips
- */
-
-package scala.reflect
-package internal
-
-import scala.collection.{ mutable, immutable }
-import scala.collection.mutable.ListBuffer
-import util.Statistics._
-import Flags._
-import api.Modifier
-
-trait SymbolCreations {
- self: SymbolTable =>
-
- import definitions._
-
- /** Symbol creation interface, possibly better moved somewhere else.
- * It'd be nice if we had virtual classes, but since we
- * don't: these methods insulate the direct instantiation of the symbols
- * (which may be overridden, e.g. in SynchronizedSymbols) from the
- * enforcement of preconditions and choice of symbol constructor based
- * on flags, which are (or should be) final so they can be reasoned about
- * without lots of surprises.
- */
- trait SymbolCreatorInterface {
- // Fallbacks; more precise creators should normally be called.
- protected def createTermSymbol(name: TermName, pos: Position, newFlags: Long): TermSymbol
- // This in fact does not exist anymore in the interests of better typed TypeSymbols.
- // protected def createTypeSymbol(name: TypeName, pos: Position, newFlags: Long): TypeSymbol
-
- // I believe all but rogue TypeSymbols are one of: ClassSymbol, AbstractTypeSymbol, AliasTypeSymbol, or TypeSkolem.
- protected def createAbstractTypeSymbol(name: TypeName, pos: Position, newFlags: Long): AbstractTypeSymbol
- protected def createAliasTypeSymbol(name: TypeName, pos: Position, newFlags: Long): AliasTypeSymbol
- protected def createTypeSkolemSymbol(name: TypeName, origin: AnyRef, pos: Position, newFlags: Long): TypeSkolem
- protected def createClassSymbol(name: TypeName, pos: Position, newFlags: Long): ClassSymbol
-
- // More specific ClassSymbols.
- // TODO - AnonymousClassSymbol.
- // TODO maybe - PackageObjects, but that one cost me a lot of time when I tried it before
- // because it broke reification some way I couldn't see.
- protected def createModuleClassSymbol(name: TypeName, pos: Position, newFlags: Long): ModuleClassSymbol
- protected def createPackageClassSymbol(name: TypeName, pos: Position, newFlags: Long): PackageClassSymbol
- protected def createRefinementClassSymbol(pos: Position, newFlags: Long): RefinementClassSymbol
- protected def createImplClassSymbol(name: TypeName, pos: Position, newFlags: Long): ClassSymbol
- protected def createPackageObjectClassSymbol(pos: Position, newFlags: Long): PackageObjectClassSymbol
-
- // Distinguished term categories include methods, modules, packages, package objects,
- // value parameters, and values (including vals, vars, and lazy vals.)
- protected def createMethodSymbol(name: TermName, pos: Position, newFlags: Long): MethodSymbol
- protected def createModuleSymbol(name: TermName, pos: Position, newFlags: Long): ModuleSymbol
- protected def createPackageSymbol(name: TermName, pos: Position, newFlags: Long): PackageSymbol
-
- // TODO
- // protected def createValueParameterSymbol(name: TermName, pos: Position, newFlags: Long): TermSymbol
- // protected def createValueMemberSymbol(name: TermName, pos: Position, newFlags: Long): TermSymbol
- }
-
- trait SymbolCreator extends SymbolCreatorInterface {
- self: Symbol =>
-
- /*** Predictable symbol creation.
- *
- * newTermSymbol, newClassSymbol, and newNonClassSymbol all create symbols based
- * only on the flags (for reconstruction after reification.) It would be nice to
- * combine the last two into newTypeSymbol, but this requires some flag which allows us
- * to distinguish classes and type aliases, which as yet does not exist.
- *
- * The fundamental flags used to determine which Symbol subclass to instantiate are:
- * METHOD, PACKAGE, MODULE, PARAM, DEFERRED.
- */
- final def newTermSymbol(name: TermName, pos: Position = NoPosition, newFlags: Long = 0L): TermSymbol = {
- if ((newFlags & METHOD) != 0)
- createMethodSymbol(name, pos, newFlags)
- else if ((newFlags & PACKAGE) != 0)
- createPackageSymbol(name, pos, newFlags | PackageFlags)
- else if ((newFlags & MODULE) != 0)
- createModuleSymbol(name, pos, newFlags)
- else if ((newFlags & PARAM) != 0)
- createValueParameterSymbol(name, pos, newFlags)
- else
- createValueMemberSymbol(name, pos, newFlags)
- }
-
- final def newClassSymbol(name: TypeName, pos: Position = NoPosition, newFlags: Long = 0L): ClassSymbol = {
- if (name == tpnme.REFINE_CLASS_NAME)
- createRefinementClassSymbol(pos, newFlags)
- else if ((newFlags & PACKAGE) != 0)
- createPackageClassSymbol(name, pos, newFlags | PackageFlags)
- else if (name == tpnme.PACKAGE)
- createPackageObjectClassSymbol(pos, newFlags)
- else if ((newFlags & MODULE) != 0)
- createModuleClassSymbol(name, pos, newFlags)
- else if ((newFlags & IMPLCLASS) != 0)
- createImplClassSymbol(name, pos, newFlags)
- else
- createClassSymbol(name, pos, newFlags)
- }
-
- final def newNonClassSymbol(name: TypeName, pos: Position = NoPosition, newFlags: Long = 0L): TypeSymbol = {
- if ((newFlags & DEFERRED) != 0)
- createAbstractTypeSymbol(name, pos, newFlags)
- else
- createAliasTypeSymbol(name, pos, newFlags)
- }
-
- def newTypeSymbol(name: TypeName, pos: Position = NoPosition, newFlags: Long = 0L): TypeSymbol =
- newNonClassSymbol(name, pos, newFlags)
- }
-}
@@ -1,77 +0,0 @@
- /* NSC -- new Scala compiler
- * Copyright 2005-2011 LAMP/EPFL
- * @author Paul Phillips
- */
-
-package scala.reflect
-package internal
-
-import scala.collection.{ mutable, immutable }
-import scala.collection.mutable.ListBuffer
-import util.Statistics._
-import Flags._
-import api.Modifier
-
-trait SymbolFlags {
- self: SymbolTable =>
-
- import definitions._
-
- trait SymbolFlagLogic {
- this: Symbol =>
-
- // Forced for performance reasons to define all the flag manipulation
- // methods alongside the field being manipulated.
- def getFlag(mask: Long): Long
- def hasFlag(mask: Long): Boolean
- def hasAllFlags(mask: Long): Boolean
- def setFlag(mask: Long): this.type
- def resetFlag(mask: Long): this.type
- def initFlags(mask: Long): this.type
- def resetFlags(): Unit
-
- protected def resolveOverloadedFlag(flag: Long): String
- protected def calculateFlagString(basis: Long): String
-
- def rawFlagString(mask: Long): String = calculateFlagString(rawflags & mask)
- def rawFlagString: String = rawFlagString(flagMask)
- def debugFlagString: String = flagString(AllFlags)
-
- /** String representation of symbol's variance */
- def varianceString: String =
- if (variance == 1) "+"
- else if (variance == -1) "-"
- else ""
-
- override def flagMask =
- if (settings.debug.value && !isAbstractType) AllFlags
- else if (owner.isRefinementClass) ExplicitFlags & ~OVERRIDE
- else ExplicitFlags
-
- // make the error message more googlable
- def flagsExplanationString =
- if (isGADTSkolem) " (this is a GADT skolem)"
- else ""
-
- /** If the given flag is set on this symbol, also set the corresponding
- * notFLAG. For instance if flag is PRIVATE, the notPRIVATE flag will
- * be set if PRIVATE is currently set.
- */
- final def setNotFlag(flag: Int) = if (hasFlag(flag)) setFlag((flag: @annotation.switch) match {
- case PRIVATE => notPRIVATE
- case PROTECTED => notPROTECTED
- case OVERRIDE => notOVERRIDE
- case _ => abort("setNotFlag on invalid flag: " + flag)
- })
-
- def shortSymbolClass = getClass.getName.split('.').last.stripPrefix("Symbols$")
- def symbolCreationString: String = (
- "%s%25s | %-40s | %s".format(
- if (settings.uniqid.value) "%06d | ".format(id) else "",
- shortSymbolClass,
- name.decode + " in " + owner,
- rawFlagString
- )
- )
- }
-}
@@ -13,9 +13,7 @@ import scala.tools.nsc.util.WeakHashSet
abstract class SymbolTable extends api.Universe
with Collections
with Names
- with SymbolCreations
with Symbols
- with SymbolFlags
with FreeVars
with Types
with Kinds
Oops, something went wrong.

0 comments on commit 3e038d8

Please sign in to comment.