aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/SymDenotations.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-01-28 19:08:54 +0100
committerMartin Odersky <odersky@gmail.com>2013-01-28 19:08:54 +0100
commit9770566c50baff03a7e61344c203b29db8750e8f (patch)
tree098ff0cd5a12fddee585b64419e23e7f7f5535be /src/dotty/tools/dotc/core/SymDenotations.scala
parent0aac7396c3eda56375c15568b81f48262d47d35b (diff)
downloaddotty-9770566c50baff03a7e61344c203b29db8750e8f.tar.gz
dotty-9770566c50baff03a7e61344c203b29db8750e8f.tar.bz2
dotty-9770566c50baff03a7e61344c203b29db8750e8f.zip
Added operations and flags for package objects.
Diffstat (limited to 'src/dotty/tools/dotc/core/SymDenotations.scala')
-rw-r--r--src/dotty/tools/dotc/core/SymDenotations.scala12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala
index 7600ff0e4..0a1138e46 100644
--- a/src/dotty/tools/dotc/core/SymDenotations.scala
+++ b/src/dotty/tools/dotc/core/SymDenotations.scala
@@ -62,10 +62,10 @@ object SymDenotations {
* flags.
*/
final def isModule = _flags is Module
- final def isModuleObj = _flags is ModuleObj
+ final def isModuleVal = _flags is ModuleVal
final def isModuleClass = _flags is ModuleClass
final def isPackage = _flags is Package
- final def isPackageObj = _flags is PackageObj
+ final def isPackageVal = _flags is PackageVal
final def isPackageClass = _flags is PackageClass
/** is this denotation a method? */
@@ -108,7 +108,7 @@ object SymDenotations {
override protected def copy(s: Symbol, i: Type): SingleDenotation = new UniqueRefDenotation(s, i, validFor)
def moduleClass(implicit ctx: Context): Symbol =
- if (this.isModuleObj) info.typeSymbol else NoSymbol
+ if (this.isModuleVal) info.typeSymbol else NoSymbol
/** Desire to re-use the field in ClassSymbol which stores the source
* file to also store the classfile, but without changing the behavior
@@ -121,6 +121,8 @@ object SymDenotations {
private def binaryFileOnly(file: AbstractFile): AbstractFile =
if ((file eq null) || !(file.path endsWith ".class")) null else file
+ final def effectiveOwner(implicit ctx: Context) = owner.skipPackageObject
+
final def topLevelClass(implicit ctx: Context): Symbol =
if (!(owner.isPackageClass)) owner.topLevelClass
else if (isClass) symbol
@@ -165,8 +167,8 @@ object SymDenotations {
info.baseClasses.tail.iterator map overriddenSymbol filter (_.exists)
def isCoDefinedWith(that: Symbol)(implicit ctx: Context) =
- (this.owner == that.owner) &&
- ( !(this.owner.isPackageClass)
+ (this.effectiveOwner == that.effectiveOwner) &&
+ ( !(this.effectiveOwner.isPackageClass)
|| (this.sourceFile == null)
|| (that.sourceFile == null)
|| (this.sourceFile.path == that.sourceFile.path) // Cheap possibly wrong check, then expensive normalization