@@ -115,7 +115,7 @@ object SymDenotations {
115
115
*/
116
116
class SymDenotation private [SymDenotations ] (
117
117
symbol : Symbol ,
118
- ownerIfExists : Symbol ,
118
+ final val maybeOwner : Symbol ,
119
119
final val name : Name ,
120
120
initFlags : FlagSet ,
121
121
initInfo : Type ,
@@ -140,10 +140,7 @@ object SymDenotations {
140
140
private [this ] var myAnnotations : List [Annotation ] = Nil
141
141
142
142
/** 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
147
144
148
145
/** The flag set */
149
146
final def flags (implicit ctx : Context ): FlagSet = { ensureCompleted(); myFlags }
@@ -178,9 +175,8 @@ object SymDenotations {
178
175
else AfterLoadFlags )
179
176
180
177
/** 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 ) =
182
179
(if (isCurrent(fs)) myFlags else flags) is fs
183
- }
184
180
185
181
/** Has this denotation one of the flags in `fs` set, whereas none of the flags
186
182
* in `butNot` are set?
@@ -202,9 +198,11 @@ object SymDenotations {
202
198
* The info is an instance of TypeType iff this is a type denotation
203
199
* Uncompleted denotations set myInfo to a LazyType.
204
200
*/
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
208
206
}
209
207
210
208
/** The type info, or, if symbol is not yet completed, the completer */
@@ -455,7 +453,7 @@ object SymDenotations {
455
453
456
454
/** Is this symbol the root class or its companion object? */
457
455
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 )
459
457
460
458
/** Is this symbol the empty package class or its companion object? */
461
459
final def isEmptyPackage (implicit ctx : Context ): Boolean =
@@ -560,11 +558,12 @@ object SymDenotations {
560
558
561
559
/** Is this denotation static (i.e. with no outer instance)? */
562
560
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 )
564
563
565
564
/** Is this a package class or module class that defines static symbols? */
566
565
final def isStaticOwner (implicit ctx : Context ): Boolean =
567
- ( this is PackageClass ) || ( this is ModuleClass ) && isStatic
566
+ myFlags.is( ModuleClass ) && (myFlags.is( PackageClass ) || isStatic)
568
567
569
568
/** Is this denotation defined in the same scope and compilation unit as that symbol? */
570
569
final def isCoDefinedWith (that : Symbol )(implicit ctx : Context ) =
0 commit comments