@@ -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?
@@ -457,7 +453,7 @@ object SymDenotations {
457
453
458
454
/** Is this symbol the root class or its companion object? */
459
455
final def isRoot : Boolean =
460
- (name.toTermName == nme.ROOT || name == nme.ROOTPKG ) && (owner eq NoSymbol )
456
+ (maybeOwner eq NoSymbol ) && ( name.toTermName == nme.ROOT || name == nme.ROOTPKG )
461
457
462
458
/** Is this symbol the empty package class or its companion object? */
463
459
final def isEmptyPackage (implicit ctx : Context ): Boolean =
@@ -562,11 +558,12 @@ object SymDenotations {
562
558
563
559
/** Is this denotation static (i.e. with no outer instance)? */
564
560
final def isStatic (implicit ctx : Context ) =
565
- (this is JavaStatic ) || this .exists && owner.isStaticOwner || this .isRoot
561
+ (if (maybeOwner eq NoSymbol ) isRoot else maybeOwner.isStaticOwner) ||
562
+ myFlags.is(JavaStatic )
566
563
567
564
/** Is this a package class or module class that defines static symbols? */
568
565
final def isStaticOwner (implicit ctx : Context ): Boolean =
569
- ( this is PackageClass ) || ( this is ModuleClass ) && isStatic
566
+ myFlags.is( ModuleClass ) && (myFlags.is( PackageClass ) || isStatic)
570
567
571
568
/** Is this denotation defined in the same scope and compilation unit as that symbol? */
572
569
final def isCoDefinedWith (that : Symbol )(implicit ctx : Context ) =
0 commit comments