aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Symbols.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2012-12-22 18:13:35 +0100
committerMartin Odersky <odersky@gmail.com>2012-12-22 18:13:35 +0100
commit39ab8822039706b88373954a7e39919938d79f6f (patch)
tree2d23e004ccae345357135474303290c7a56c66c8 /src/dotty/tools/dotc/core/Symbols.scala
parent78f0d5a0e0ea477087385277d217d9300c018aa0 (diff)
downloaddotty-39ab8822039706b88373954a7e39919938d79f6f.tar.gz
dotty-39ab8822039706b88373954a7e39919938d79f6f.tar.bz2
dotty-39ab8822039706b88373954a7e39919938d79f6f.zip
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.
Diffstat (limited to 'src/dotty/tools/dotc/core/Symbols.scala')
-rw-r--r--src/dotty/tools/dotc/core/Symbols.scala27
1 files changed, 19 insertions, 8 deletions
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