diff options
author | Paul Phillips <paulp@improving.org> | 2010-10-13 04:48:20 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-10-13 04:48:20 +0000 |
commit | d64cbe436646bccb42def34641c399e8367b1e44 (patch) | |
tree | 45f8210f412b733dce3540329ad7d29a7f343081 /src/library/scala/reflect/generic/Symbols.scala | |
parent | 08c460450aaa1c3e3e6eb6b2b12309f1476bf6df (diff) | |
download | scala-d64cbe436646bccb42def34641c399e8367b1e44.tar.gz scala-d64cbe436646bccb42def34641c399e8367b1e44.tar.bz2 scala-d64cbe436646bccb42def34641c399e8367b1e44.zip |
The second piece of the flags patch.
into Modifiers and Symbol, but touches as little as possible beyond
that. It also includes some lengthy commentary (see HasFlags.scala) on
the state of the flags and some of the remaining issues. One more patch
which unfortunately but unavoidably touches almost every file in the
compiler lies ahead.
The floor is still open! But no review.
Diffstat (limited to 'src/library/scala/reflect/generic/Symbols.scala')
-rwxr-xr-x | src/library/scala/reflect/generic/Symbols.scala | 35 |
1 files changed, 11 insertions, 24 deletions
diff --git a/src/library/scala/reflect/generic/Symbols.scala b/src/library/scala/reflect/generic/Symbols.scala index a1c9a0c18d..75e1c05d49 100755 --- a/src/library/scala/reflect/generic/Symbols.scala +++ b/src/library/scala/reflect/generic/Symbols.scala @@ -7,7 +7,12 @@ trait Symbols { self: Universe => type Symbol >: Null <: AbsSymbol - abstract class AbsSymbol { this: Symbol => + abstract class AbsSymbol extends HasFlags { + this: Symbol => + + type FlagsType = Long + type AccessBoundaryType = Symbol + type AnnotationType = AnnotationInfo /** The owner of this symbol. */ @@ -56,6 +61,8 @@ trait Symbols { self: Universe => */ def privateWithin: Symbol + final def hasAccessBoundary = (privateWithin != null) && (privateWithin != NoSymbol) + /** The raw info of the type */ def rawInfo: Type @@ -122,47 +129,27 @@ trait Symbols { self: Universe => private[scala] def isSkolem = false // to be overridden def isTrait: Boolean = isClass && hasFlag(TRAIT) // refined later for virtual classes. - final def hasDefault = isParameter && hasFlag(DEFAULTPARAM) final def isAbstractClass = isClass && hasFlag(ABSTRACT) - // XXX This is unlikely to be correct: it's not looking for the ABSOVERRIDE flag? - final def isAbstractOverride = isTerm && hasFlag(ABSTRACT) && hasFlag(OVERRIDE) + final def isAbstractOverride = isTerm && hasFlag(ABSOVERRIDE) final def isBridge = hasFlag(BRIDGE) - final def isCase = hasFlag(CASE) - final def isCaseAccessor = hasFlag(CASEACCESSOR) final def isContravariant = isType && hasFlag(CONTRAVARIANT) final def isCovariant = isType && hasFlag(COVARIANT) - final def isDeferred = hasFlag(DEFERRED) && !isClass final def isEarlyInitialized: Boolean = isTerm && hasFlag(PRESUPER) final def isExistentiallyBound = isType && hasFlag(EXISTENTIAL) - final def isFinal = hasFlag(FINAL) final def isGetterOrSetter = hasFlag(ACCESSOR) final def isImplClass = isClass && hasFlag(IMPLCLASS) // Is this symbol an implementation class for a mixin? - final def isImplicit = hasFlag(IMPLICIT) final def isInterface = hasFlag(INTERFACE) final def isJavaDefined = hasFlag(JAVA) - final def isLazy = hasFlag(LAZY) + final def isLazyAccessor = isLazy && lazyAccessor != NoSymbol final def isMethod = isTerm && hasFlag(METHOD) final def isModule = isTerm && hasFlag(MODULE) final def isModuleClass = isClass && hasFlag(MODULE) - final def isMutable = hasFlag(MUTABLE) final def isOverloaded = hasFlag(OVERLOADED) - final def isOverride = hasFlag(OVERRIDE) - final def isParamAccessor = hasFlag(PARAMACCESSOR) - final def isParameter = hasFlag(PARAM) final def isRefinementClass = isClass && name == mkTypeName(nme.REFINE_CLASS_NAME) - final def isSealed = isClass && (hasFlag(SEALED) || definitions.isValueClass(this)) - final def isSourceMethod = isTerm && (flags & (METHOD | STABLE)) == METHOD // exclude all accessors!!! + final def isSourceMethod = isMethod && !hasFlag(STABLE) // exclude all accessors!!! final def isSuperAccessor = hasFlag(SUPERACCESSOR) - final def isSynthetic = hasFlag(SYNTHETIC) final def isTypeParameter = isType && isParameter && !isSkolem - /** Access tests */ - final def isPrivate = hasFlag(PRIVATE) - final def isPrivateLocal = hasFlag(PRIVATE) && hasFlag(LOCAL) - final def isProtected = hasFlag(PROTECTED) - final def isProtectedLocal = hasFlag(PROTECTED) && hasFlag(LOCAL) - final def isPublic = !hasFlag(PRIVATE | PROTECTED) && privateWithin == NoSymbol - /** Package tests */ final def isEmptyPackage = isPackage && name == nme.EMPTY_PACKAGE_NAME final def isEmptyPackageClass = isPackageClass && name == mkTypeName(nme.EMPTY_PACKAGE_NAME) |