aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-01-31 14:45:25 +0100
committerMartin Odersky <odersky@gmail.com>2013-01-31 14:45:25 +0100
commit398a7a97a34b640d8e6922092db1d73836d0512c (patch)
treefffcc22f670ca50fb3127ef7740d26340d01701e /src/dotty/tools/dotc/core
parentd6b7daeb806c0bca661ac8904f85c4cb6cc6185d (diff)
downloaddotty-398a7a97a34b640d8e6922092db1d73836d0512c.tar.gz
dotty-398a7a97a34b640d8e6922092db1d73836d0512c.tar.bz2
dotty-398a7a97a34b640d8e6922092db1d73836d0512c.zip
Various smallish fixes.
Diffstat (limited to 'src/dotty/tools/dotc/core')
-rw-r--r--src/dotty/tools/dotc/core/Definitions.scala2
-rw-r--r--src/dotty/tools/dotc/core/StdNames.scala4
-rw-r--r--src/dotty/tools/dotc/core/SymDenotations.scala4
-rw-r--r--src/dotty/tools/dotc/core/Symbols.scala39
4 files changed, 27 insertions, 22 deletions
diff --git a/src/dotty/tools/dotc/core/Definitions.scala b/src/dotty/tools/dotc/core/Definitions.scala
index 43256b736..2e13aed47 100644
--- a/src/dotty/tools/dotc/core/Definitions.scala
+++ b/src/dotty/tools/dotc/core/Definitions.scala
@@ -30,7 +30,7 @@ class Definitions(implicit ctx: Context) {
lazy val ObjectClass = requiredClass("java.lang.Object")
lazy val AnyRefAlias: TypeSymbol = ctx.newAliasTypeSymbol(
- ScalaPackageClass, nme.AnyRef, ObjectClass.typeConstructor).entered
+ ScalaPackageClass, tpnme.AnyRef, ObjectClass.typeConstructor).entered
lazy val AnyClass: ClassSymbol = ctx.newCompleteClassSymbol(
ScalaPackageClass, tpnme.Any, Abstract, Nil).entered
lazy val AnyValClass: ClassSymbol = requiredClass("scala.AnyVal")
diff --git a/src/dotty/tools/dotc/core/StdNames.scala b/src/dotty/tools/dotc/core/StdNames.scala
index 327374691..a89b970fe 100644
--- a/src/dotty/tools/dotc/core/StdNames.scala
+++ b/src/dotty/tools/dotc/core/StdNames.scala
@@ -81,8 +81,8 @@ object StdNames {
final val HASHkw: N = kw("#")
final val ATkw: N = kw("@")
- val ANON_CLASS_NAME: N = "$anon"
- val ANON_FUN_NAME: N = "$anonfun"
+ val ANON_CLASS: N = "$anon"
+ val ANON_FUN: N = "$anonfun"
val BITMAP_PREFIX: N = "bitmap$"
val BITMAP_NORMAL: N = BITMAP_PREFIX // initialization bitmap for public/protected lazy vals
val BITMAP_TRANSIENT: N = BITMAP_PREFIX + "trans$" // initialization bitmap for transient lazy vals
diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala
index 47b54c66d..06c0d9593 100644
--- a/src/dotty/tools/dotc/core/SymDenotations.scala
+++ b/src/dotty/tools/dotc/core/SymDenotations.scala
@@ -295,13 +295,13 @@ object SymDenotations {
else if (this is Contravariant) -1
else 0
- def isRoot: Boolean = name.toTermName == nme.ROOT && !owner.exists
+ def isRoot: Boolean = name.toTermName == nme.ROOT
def isEmptyPackage(implicit ctx: Context): Boolean = name.toTermName == nme.EMPTY_PACKAGE && owner.isRoot
def isEffectiveRoot(implicit ctx: Context) = isRoot || isEmptyPackage
- def isAnonymousClass(implicit ctx: Context): Boolean = ??? // initial.asSymDenotation.name startsWith tpnme.AnonClass
+ def isAnonymousClass(implicit ctx: Context): Boolean = initial.asSymDenotation.name startsWith tpnme.ANON_CLASS
def copy(
sym: Symbol,
diff --git a/src/dotty/tools/dotc/core/Symbols.scala b/src/dotty/tools/dotc/core/Symbols.scala
index de9b0687f..58f7ed4f8 100644
--- a/src/dotty/tools/dotc/core/Symbols.scala
+++ b/src/dotty/tools/dotc/core/Symbols.scala
@@ -11,7 +11,7 @@ import Symbols._
import Contexts._
import SymDenotations._
import Types._, Annotations._
-import Denotations.{Denotation, SingleDenotation, MultiDenotation}
+import Denotations.{ Denotation, SingleDenotation, MultiDenotation }
import collection.mutable
import reflect.io.AbstractFile
@@ -28,19 +28,25 @@ trait Symbols { this: Context =>
optSelfType: Type = NoType,
decls: Scope = newScope,
assocFile: AbstractFile = null) =
- new ClassSymbol(new CompleteClassDenotation(
- _, owner, name, flags, parents, optSelfType, decls, assocFile))
+ new ClassSymbol(new CompleteClassDenotation(
+ _, owner, name, flags, parents, optSelfType, decls, assocFile))
def newCompleteTypeSymbol(
owner: Symbol,
- name: Name,
+ name: TypeName,
flags: FlagSet,
info: Type) =
new TypeSymbol(new CompleteSymDenotation(_, owner, name, flags, info))
- def newAliasTypeSymbol(owner: Symbol, name: Name, alias: Type, flags: FlagSet = EmptyFlags) =
+ def newAliasTypeSymbol(owner: Symbol, name: TypeName, alias: Type, flags: FlagSet = EmptyFlags) =
newCompleteTypeSymbol(owner, name, flags, TypeBounds(alias, alias))
+ def newCompleteTermSymbol(
+ owner: Symbol,
+ name: TermName,
+ flags: FlagSet,
+ info: Type) =
+ new TermSymbol(new CompleteSymDenotation(_, owner, name, flags, info))
}
object Symbols {
@@ -51,7 +57,7 @@ object Symbols {
type ThisName <: Name
- /** Is symbol different from NoSymbol? */
+ /** Is symbol different from NoSymbol? */
def exists = true
/** This symbol, if it exists, otherwise the result of evaluating `that` */
@@ -95,7 +101,7 @@ object Symbols {
/** Is symbol a phantom class for which no runtime representation exists? */
def isPhantomClass(implicit ctx: Context) = defn.PhantomClasses contains this
-// --------- Forwarders for sym methods --------------------------
+ // --------- Forwarders for sym methods --------------------------
/** Special case tests for flags that are known a-priori and do not need loading
* flags.
@@ -141,7 +147,7 @@ object Symbols {
*/
def skipPackageObject(implicit ctx: Context): Symbol = if (this is PackageObject) owner else this
- /** The class containing this symbol */
+ /** The class containing this symbol */
def enclosingClass(implicit ctx: Context): Symbol = denot.enclosingClass
/** The top-level class containing this symbol, except for a toplevel module
@@ -192,8 +198,8 @@ object Symbols {
/** Is this symbol a subclass of the given class? */
final def isSubClass(cls: Symbol)(implicit ctx: Context): Boolean = denot.isSubClass(cls)
- /** Is this class symbol a subclass of `cls`,
- * and is this class symbol also different from Null or Nothing?
+ /** Is this class symbol a subclass of `cls`,
+ * and is this class symbol also different from Null or Nothing?
*/
final def isNonBottomSubClass(cls: Symbol)(implicit ctx: Context): Boolean = denot.isNonBottomSubClass(cls)
@@ -287,17 +293,16 @@ object Symbols {
/** Does this symbol denote a class that defines static symbols? */
final def isStaticOwner(implicit ctx: Context): Boolean = denot.isStaticOwner
-// def isOverridable: Boolean = !!! need to enforce that classes cannot be redefined
+ // def isOverridable: Boolean = !!! need to enforce that classes cannot be redefined
-// def isSkolem: Boolean = ???
+ // def isSkolem: Boolean = ???
-// def isAbstractType: Boolean = ???
-// def newAbstractType(name: TypeName, info: TypeBounds): TypeSymbol = ???
-// def newAbstractTerm(name: TermName, tpe: Type): TypeSymbol = ???
+ // def isAbstractType: Boolean = ???
+ // def newAbstractType(name: TypeName, info: TypeBounds): TypeSymbol = ???
+ // def newAbstractTerm(name: TermName, tpe: Type): TypeSymbol = ???
//def isMethod(implicit ctx: Context): Boolean = denot.isMethod
-
}
class TermSymbol(denotf: Symbol => SymDenotation) extends Symbol(denotf) {
@@ -338,7 +343,7 @@ object Symbols {
*/
def baseClasses(implicit ctx: Context): List[ClassSymbol] = classDenot.baseClasses
-// override def typeTemplate(implicit ctx: Context): Type = classDenot.typeTemplate
+ // override def typeTemplate(implicit ctx: Context): Type = classDenot.typeTemplate
def superId(implicit ctx: Context): Int = {
val hint = superIdHint