aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Definitions.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-02-24 18:42:17 +0100
committerMartin Odersky <odersky@gmail.com>2013-02-24 18:42:17 +0100
commit36b9128d2214a927d642e87da3322b4ed4e76c58 (patch)
tree8a9c85a5b7568bb5b1eb4113d0ab122ae1af1bc1 /src/dotty/tools/dotc/core/Definitions.scala
parent7cde8b6d78022aadb00d3f82fb9019da39a62b49 (diff)
downloaddotty-36b9128d2214a927d642e87da3322b4ed4e76c58.tar.gz
dotty-36b9128d2214a927d642e87da3322b4ed4e76c58.tar.bz2
dotty-36b9128d2214a927d642e87da3322b4ed4e76c58.zip
Refactoring and cleanup of several symbol creation related aspects.
1. Went back to old completer model where completers are types. 2. Made class denotations a simple optimzation of symbol denotatons (with more caches) by moving all class-specific attributes into ClassInfo. 3. Now all symbol and symbol denotation creations are routed through one of 3 methods: newNakedSymbol, newNakedClassSymbol, newSymDenotation.
Diffstat (limited to 'src/dotty/tools/dotc/core/Definitions.scala')
-rw-r--r--src/dotty/tools/dotc/core/Definitions.scala22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/dotty/tools/dotc/core/Definitions.scala b/src/dotty/tools/dotc/core/Definitions.scala
index ef9f3d70d..8b512be8a 100644
--- a/src/dotty/tools/dotc/core/Definitions.scala
+++ b/src/dotty/tools/dotc/core/Definitions.scala
@@ -30,8 +30,8 @@ class Definitions(implicit ctx: Context) {
scope.enter(tparam)
}
- private def specialPolyClass(name: TypeName, flags: FlagSet, parentConstrs: Type*): ClassSymbol = {
- def classDenot(cls: ClassSymbol) = {
+ private def specialPolyClass(name: TypeName, flags: FlagSet, parentConstrs: Type*): ClassSymbol =
+ ctx.newClassSymbolDenoting { cls =>
val paramDecls = newScope
val typeParam = newSyntheticTypeParam(cls, paramDecls)
def instantiate(tpe: Type) =
@@ -39,10 +39,10 @@ class Definitions(implicit ctx: Context) {
else tpe
val parents = parentConstrs.toList map instantiate
val parentRefs: List[TypeRef] = ctx.normalizeToRefs(parents, cls, paramDecls)
- CompleteClassDenotation(cls, ScalaPackageClass, name, flags, parentRefs, decls = paramDecls)(ctx)
+ ctx.SymDenotation(
+ cls, ScalaPackageClass, name, flags,
+ ClassInfo(ScalaPackageClass.thisType, cls, parentRefs, paramDecls))
}
- new ClassSymbol(NoCoord, classDenot, null)
- }
private def mkArityArray(name: String, arity: Int, countFrom: Int): Array[ClassSymbol] = {
val arr = new Array[ClassSymbol](arity)
@@ -50,12 +50,12 @@ class Definitions(implicit ctx: Context) {
arr
}
- lazy val RootClass: ClassSymbol = ctx.newLazyPackageSymbols(
- NoSymbol, nme.ROOT, ctx.rootLoader)._2
+ lazy val RootClass: ClassSymbol = ctx.newPackageSymbol(
+ NoSymbol, nme.ROOT, ctx.rootLoader).moduleClass.asClass
lazy val RootPackage: TermSymbol = ctx.newSymbol(
NoSymbol, nme.ROOTPKG, PackageCreationFlags, TypeRef(NoPrefix, RootClass))
- lazy val EmptyPackageClass = ctx.newPackageSymbols(RootClass, nme.EMPTY_PACKAGE)._2
+ lazy val EmptyPackageClass = ctx.newCompletePackageSymbol(RootClass, nme.EMPTY_PACKAGE).moduleClass.asClass
lazy val EmptyPackageVal = EmptyPackageClass.sourceModule
lazy val ScalaPackageVal = requiredPackage("scala")
@@ -66,15 +66,15 @@ class Definitions(implicit ctx: Context) {
lazy val ObjectClass = requiredClass("java.lang.Object")
lazy val AnyRefAlias: TypeSymbol = ctx.newSymbol(
ScalaPackageClass, tpnme.AnyRef, EmptyFlags, TypeAlias(ObjectClass.typeConstructor)).entered
- lazy val AnyClass: ClassSymbol = ctx.newClassSymbol(
+ lazy val AnyClass: ClassSymbol = ctx.newCompleteClassSymbol(
ScalaPackageClass, tpnme.Any, Abstract, Nil).entered
lazy val AnyValClass: ClassSymbol = requiredClass("scala.AnyVal")
lazy val NotNullClass = requiredClass("scala.NotNull")
- lazy val NothingClass: ClassSymbol = ctx.newClassSymbol(
+ lazy val NothingClass: ClassSymbol = ctx.newCompleteClassSymbol(
ScalaPackageClass, tpnme.Nothing, UninstantiatableFlags, List(AnyClass.typeConstructor)).entered
- lazy val NullClass: ClassSymbol = ctx.newClassSymbol(
+ lazy val NullClass: ClassSymbol = ctx.newCompleteClassSymbol(
ScalaPackageClass, tpnme.Null, UninstantiatableFlags, List(AnyRefAlias.typeConstructor)).entered
lazy val PredefModule = requiredModule("scala.Predef")