@@ -115,7 +115,7 @@ object SymDenotations {
115115 */
116116 class SymDenotation private [SymDenotations ] (
117117 symbol : Symbol ,
118- ownerIfExists : Symbol ,
118+ final val maybeOwner : Symbol ,
119119 final val name : Name ,
120120 initFlags : FlagSet ,
121121 initInfo : Type ,
@@ -140,10 +140,7 @@ object SymDenotations {
140140 private [this ] var myAnnotations : List [Annotation ] = Nil
141141
142142 /** The owner of the symbol; overridden in NoDenotation */
143- def owner : Symbol = ownerIfExists
144-
145- /** Same as owner, except returns NoSymbol for NoSymbol */
146- def maybeOwner : Symbol = if (exists) owner else NoSymbol
143+ def owner : Symbol = maybeOwner
147144
148145 /** The flag set */
149146 final def flags (implicit ctx : Context ): FlagSet = { ensureCompleted(); myFlags }
@@ -178,9 +175,8 @@ object SymDenotations {
178175 else AfterLoadFlags )
179176
180177 /** Has this denotation one of the flags in `fs` set? */
181- final def is (fs : FlagSet )(implicit ctx : Context ) = {
178+ final def is (fs : FlagSet )(implicit ctx : Context ) =
182179 (if (isCurrent(fs)) myFlags else flags) is fs
183- }
184180
185181 /** Has this denotation one of the flags in `fs` set, whereas none of the flags
186182 * in `butNot` are set?
@@ -202,9 +198,11 @@ object SymDenotations {
202198 * The info is an instance of TypeType iff this is a type denotation
203199 * Uncompleted denotations set myInfo to a LazyType.
204200 */
205- final def info (implicit ctx : Context ): Type = myInfo match {
206- case myInfo : LazyType => completeFrom(myInfo); info
207- case _ => myInfo
201+ final def info (implicit ctx : Context ): Type = {
202+ def completeInfo = {
203+ completeFrom(myInfo.asInstanceOf [LazyType ]); info
204+ }
205+ if (myInfo.isInstanceOf [LazyType ]) completeInfo else myInfo
208206 }
209207
210208 /** The type info, or, if symbol is not yet completed, the completer */
@@ -455,7 +453,7 @@ object SymDenotations {
455453
456454 /** Is this symbol the root class or its companion object? */
457455 final def isRoot : Boolean =
458- (name.toTermName == nme.ROOT || name == nme.ROOTPKG ) && (owner eq NoSymbol )
456+ (maybeOwner eq NoSymbol ) && ( name.toTermName == nme.ROOT || name == nme.ROOTPKG )
459457
460458 /** Is this symbol the empty package class or its companion object? */
461459 final def isEmptyPackage (implicit ctx : Context ): Boolean =
@@ -560,11 +558,12 @@ object SymDenotations {
560558
561559 /** Is this denotation static (i.e. with no outer instance)? */
562560 final def isStatic (implicit ctx : Context ) =
563- (this is JavaStatic ) || this .exists && owner.isStaticOwner || this .isRoot
561+ (if (maybeOwner eq NoSymbol ) isRoot else maybeOwner.isStaticOwner) ||
562+ myFlags.is(JavaStatic )
564563
565564 /** Is this a package class or module class that defines static symbols? */
566565 final def isStaticOwner (implicit ctx : Context ): Boolean =
567- ( this is PackageClass ) || ( this is ModuleClass ) && isStatic
566+ myFlags.is( ModuleClass ) && (myFlags.is( PackageClass ) || isStatic)
568567
569568 /** Is this denotation defined in the same scope and compilation unit as that symbol? */
570569 final def isCoDefinedWith (that : Symbol )(implicit ctx : Context ) =
0 commit comments