diff options
author | Martin Odersky <odersky@gmail.com> | 2013-04-07 23:01:07 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-04-07 23:01:07 +0200 |
commit | 19143c67d77a71bd5ef18769e222beed291fa92b (patch) | |
tree | ec309ed9e830dfe4875a0c6a2e7776fa3a8a046f /src/dotty/tools/dotc/core/SymDenotations.scala | |
parent | 34cdca9f2eb60facef679cca9c1d7cb4b2ae10dc (diff) | |
download | dotty-19143c67d77a71bd5ef18769e222beed291fa92b.tar.gz dotty-19143c67d77a71bd5ef18769e222beed291fa92b.tar.bz2 dotty-19143c67d77a71bd5ef18769e222beed291fa92b.zip |
Changes to pre complete decls
Dropped preCompleteDecls for a general refactoring that makes decls available after a class is loaded and before it is completed.
Also some other fixes to classloading problems.
Diffstat (limited to 'src/dotty/tools/dotc/core/SymDenotations.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/SymDenotations.scala | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala index c019d94e0..2a66c9b7e 100644 --- a/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/src/dotty/tools/dotc/core/SymDenotations.scala @@ -156,14 +156,12 @@ object SymDenotations { case Nil => Nil } - /** The symbols defined in this class when the class is not yet completed. - * @pre: this is a class + /** The symbols defined in this class. */ - protected[core] final def preCompleteDecls: Scope = _info match { + final def decls(implicit ctx: Context): Scope = _info match { case cinfo: ClassCompleter => cinfo.decls - case cinfo: ClassInfo => cinfo.decls - case cinfo: LazyType => completeFrom(cinfo); preCompleteDecls - case cinfo => throw new AssertionError(s"unexpected class completer for $debugString: ${cinfo.getClass}") + case cinfo: LazyType => completeFrom(cinfo); decls // complete-once + case _ => info.decls } // ------ Names ---------------------------------------------- @@ -651,7 +649,7 @@ object SymDenotations { } private def computeTypeParams(implicit ctx: Context): List[TypeSymbol] = - preCompleteDecls.toList.filter(sym => + decls.filter(sym => (sym is TypeParam) && sym.owner == symbol).asInstanceOf[List[TypeSymbol]] // ------ class-specific operations ----------------------------------- @@ -824,7 +822,7 @@ object SymDenotations { private def computeMembersNamed(name: Name)(implicit ctx: Context): PreDenotation = if (!classSymbol.hasChildren || (memberFingerPrint contains name)) { - val ownDenots = info.decls.denotsNamed(name) + val ownDenots = decls.denotsNamed(name) if (debugTrace) // DEBUG println(s"$this.member($name), ownDenots = $ownDenots") def collect(denots: PreDenotation, parents: List[TypeRef]): PreDenotation = parents match { @@ -851,6 +849,9 @@ object SymDenotations { collect(ownDenots, classInfo.classParents) } else NoDenotation + override final def findMember(name: Name, pre: Type, excluded: FlagSet)(implicit ctx: Context): Denotation = + membersNamed(name).filterExcluded(excluded).asSeenFrom(pre).toDenot + private[this] var baseTypeCache: java.util.HashMap[CachedType, Type] = null private[this] var baseTypeValid: RunId = NoRunId @@ -946,7 +947,7 @@ object SymDenotations { override def primaryConstructor(implicit ctx: Context): Symbol = { val cname = if (this is Trait | ImplClass) nme.TRAIT_CONSTRUCTOR else nme.CONSTRUCTOR - info.decls.denotsNamed(cname).first.symbol + decls.denotsNamed(cname).first.symbol } } @@ -985,8 +986,8 @@ object SymDenotations { def sourceModule: Symbol = NoSymbol } - class ModuleClassCompleter(module: Symbol, underlying: LazyType = NoCompleter) - extends ClassCompleter(newScope, underlying) { + class ModuleClassCompleter(module: Symbol, decls: Scope = newScope, underlying: LazyType = NoCompleter) + extends ClassCompleter(decls, underlying) { override def sourceModule = module } |