aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/SymDenotations.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-04-06 12:18:55 +0200
committerMartin Odersky <odersky@gmail.com>2013-04-06 12:18:55 +0200
commit7ff269e8027d1aeddfec4eb0ada7a565fcd11c1f (patch)
tree5b55540e8360ab09b0977babfbae8359cbab4b6a /src/dotty/tools/dotc/core/SymDenotations.scala
parent7696a4aa949825c3f8bbe8e5aa7ef428657aac24 (diff)
downloaddotty-7ff269e8027d1aeddfec4eb0ada7a565fcd11c1f.tar.gz
dotty-7ff269e8027d1aeddfec4eb0ada7a565fcd11c1f.tar.bz2
dotty-7ff269e8027d1aeddfec4eb0ada7a565fcd11c1f.zip
Refactored lazy class completers and module class completers.
Aim: simplification, fewer classes.
Diffstat (limited to 'src/dotty/tools/dotc/core/SymDenotations.scala')
-rw-r--r--src/dotty/tools/dotc/core/SymDenotations.scala28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala
index ad2b8834c..c6d90737d 100644
--- a/src/dotty/tools/dotc/core/SymDenotations.scala
+++ b/src/dotty/tools/dotc/core/SymDenotations.scala
@@ -160,7 +160,7 @@ object SymDenotations {
* @pre: this is a class
*/
protected[core] final def preCompleteDecls: Scope = _info match {
- case cinfo: LazyClassInfo => cinfo.decls
+ 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}")
@@ -178,7 +178,7 @@ object SymDenotations {
* Drops package objects. Represents terms in the owner chain by a simple `separator`.
*/
def fullName(separator: Char)(implicit ctx: Context): Name =
- if (this == NoSymbol || owner == NoSymbol || owner.isEffectiveRoot) name
+ if (symbol == NoSymbol || owner == NoSymbol || owner.isEffectiveRoot) name
else {
var owner = this
var sep = ""
@@ -430,7 +430,7 @@ object SymDenotations {
final def sourceModule: Symbol = _info match {
case ClassInfo(_, _, _, _, selfType: TermRefBySym) if this is ModuleClass =>
selfType.fixedSym
- case info: LazyModuleClassInfo =>
+ case info: ClassCompleter =>
info.module
case _ =>
NoSymbol
@@ -979,19 +979,19 @@ object SymDenotations {
def apply(module: TermSymbol, modcls: ClassSymbol) = this
}
- /** A lazy type for classes that contains an initial pre-complete scope.
- * Typically this is for type parameters
- */
- trait LazyClassInfo extends LazyType {
- val decls: Scope
+ class ClassCompleter(val decls: Scope, underlying: LazyType = NoCompleter)
+ extends LazyType {
+ def complete(denot: SymDenotation): Unit = underlying.complete(denot)
+ def module: Symbol = NoSymbol
}
- /** A lazy type for module classes that points back to the source module.
- * Needed so that `sourceModule` works before completion.
- */
- trait LazyModuleClassInfo extends LazyClassInfo {
- def module: TermSymbol
- override def toString = s"LazyModuleClassInfo($module)"
+ class ModuleClassCompleter(modul: Symbol, underlying: LazyType = NoCompleter)
+ extends ClassCompleter(newScope, underlying) {
+ override def module = modul
+ }
+
+ object NoCompleter extends LazyType {
+ override def complete(denot: SymDenotation): Unit = unsupported("complete")
}
/** A lazy type for modules that points to the module class.