From 39ab8822039706b88373954a7e39919938d79f6f Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Sat, 22 Dec 2012 18:13:35 +0100 Subject: Refactored ClassInfoType content back to Denotation. Created separate ClassInfo type, which combines a prefix with a ClassInfo denotation. That leads to better regularity elsewhere, because now taking the info of a TypeRef will not lose information: If the info is a TypeBounds, the prefix is already taken account in it, and for ClassInfo we now record it explicitly. --- src/dotty/tools/dotc/core/Symbols.scala | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'src/dotty/tools/dotc/core/Symbols.scala') diff --git a/src/dotty/tools/dotc/core/Symbols.scala b/src/dotty/tools/dotc/core/Symbols.scala index 3c8180e15..c76fc2cb9 100644 --- a/src/dotty/tools/dotc/core/Symbols.scala +++ b/src/dotty/tools/dotc/core/Symbols.scala @@ -152,13 +152,8 @@ object Symbols { val initDenot = lastDenot.initial val newSym: Symbol = ctx.atPhase(FirstPhaseId) { implicit ctx => - def relink(ref: Reference): Symbol = ref match { - case ref: SymRef => - if (ref.signature == thisRef.signature) ref.symbol else NoSymbol - case ref @ OverloadedRef(ref1, ref2) => - relink(ref1) orElse relink(ref2) - } - relink(initDenot.owner.info.decl(initDenot.name)) + initDenot.owner.info.decl(initDenot.name) + .atSignature(thisRef.signature).symbol } if (newSym eq this) { // no change, change validity var d = initDenot @@ -180,7 +175,6 @@ object Symbols { def name(implicit ctx: Context): Name = deref.name def flags(implicit ctx: Context): FlagSet = deref.flags def info(implicit ctx: Context): Type = deref.info - def tpe(implicit ctx: Context): Type = info def prefix(implicit ctx: Context) = owner.thisType def allOverriddenSymbols: Iterator[Symbol] = ??? @@ -223,6 +217,10 @@ object Symbols { def isMethod(implicit ctx: Context): Boolean = deref.isMethod def hasFlag(required: FlagSet)(implicit ctx: Context): Boolean = (flags & required) != Flags.Empty def hasAllFlags(required: FlagSet)(implicit ctx: Context): Boolean = (flags & required) == flags + + def containsNull(implicit ctx: Context): Boolean = + isClass && !(isSubClass(defn.AnyValClass)) + } abstract class TermSymbol extends Symbol { @@ -241,14 +239,25 @@ object Symbols { abstract class TypeSymbol extends Symbol { def name: TypeName def isType = false + + def variance: Int = ??? + + def typeConstructor(implicit ctx: Context): Type = ??? + def typeTemplate(implicit ctx: Context): Type = ??? } abstract class ClassSymbol extends TypeSymbol { override def isClass = true private var superIdHint: Int = -1 + override def deref(implicit ctx: Context): ClassDenotation = + super.deref.asInstanceOf[ClassDenotation] + def typeOfThis(implicit ctx: Context): Type = ??? + override def typeConstructor(implicit ctx: Context): Type = deref.typeConstructor + override def typeTemplate(implicit ctx: Context): Type = deref.typeTemplate + /** The unique, densely packed identifier of this class symbol. Should be called * only if class is a super class of some other class. */ @@ -277,4 +286,6 @@ object Symbols { override def exists = false def isType = false } + + implicit def defn(implicit ctx: Context): Definitions = ctx.root.definitions } \ No newline at end of file -- cgit v1.2.3