diff options
author | Martin Odersky <odersky@gmail.com> | 2015-06-27 15:43:42 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-06-27 15:44:06 +0200 |
commit | a5eae5a79212f76c8a8ad3e4ea39ce0bb3302b9e (patch) | |
tree | 4c0d3a5240919568bd366972b453e225c1898e69 /src/dotty/tools/dotc/core | |
parent | 78f5e1cb9c0b186e4835d0a69e551ed5e988829b (diff) | |
download | dotty-a5eae5a79212f76c8a8ad3e4ea39ce0bb3302b9e.tar.gz dotty-a5eae5a79212f76c8a8ad3e4ea39ce0bb3302b9e.tar.bz2 dotty-a5eae5a79212f76c8a8ad3e4ea39ce0bb3302b9e.zip |
Drop TraitConstructors phase
It did not do enough to carry its own weight, in particular because DenotationTransformers do have
a price - every encountered denotation in the whole program is passed through them. The name change
from <init> to $init$ was all it did, that is now rolled into Mixin.
Also renamed IMPLCLASS_CONSTRUCTOR to TRAIT_CONSTRUCTOR.
Diffstat (limited to 'src/dotty/tools/dotc/core')
-rw-r--r-- | src/dotty/tools/dotc/core/Flags.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/NameOps.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/StdNames.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/SymDenotations.scala | 9 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala | 2 |
5 files changed, 10 insertions, 7 deletions
diff --git a/src/dotty/tools/dotc/core/Flags.scala b/src/dotty/tools/dotc/core/Flags.scala index 759dff0d4..f39f2bac6 100644 --- a/src/dotty/tools/dotc/core/Flags.scala +++ b/src/dotty/tools/dotc/core/Flags.scala @@ -388,7 +388,7 @@ object Flags { /** Symbol is a self name */ final val SelfName = termFlag(54, "<selfname>") - /** Symbol is an implementation class */ + /** Symbol is an implementation class of a Scala2 trait */ final val ImplClass = typeFlag(54, "<implclass>") final val SelfNameOrImplClass = SelfName.toCommonFlags diff --git a/src/dotty/tools/dotc/core/NameOps.scala b/src/dotty/tools/dotc/core/NameOps.scala index dc94f6db1..4d6cca61d 100644 --- a/src/dotty/tools/dotc/core/NameOps.scala +++ b/src/dotty/tools/dotc/core/NameOps.scala @@ -62,7 +62,7 @@ object NameOps { def likeTyped(n: Name): N = (if (name.isTermName) n.toTermName else n.toTypeName).asInstanceOf[N] - def isConstructorName = name == CONSTRUCTOR || name == IMPLCLASS_CONSTRUCTOR + def isConstructorName = name == CONSTRUCTOR || name == TRAIT_CONSTRUCTOR def isExceptionResultName = name startsWith EXCEPTION_RESULT_PREFIX def isImplClassName = name endsWith IMPL_CLASS_SUFFIX def isLocalDummyName = name startsWith LOCALDUMMY_PREFIX diff --git a/src/dotty/tools/dotc/core/StdNames.scala b/src/dotty/tools/dotc/core/StdNames.scala index eaf4ce1e2..eb1a73625 100644 --- a/src/dotty/tools/dotc/core/StdNames.scala +++ b/src/dotty/tools/dotc/core/StdNames.scala @@ -232,7 +232,6 @@ object StdNames { val EVT2U: N = "evt2u$" val EQEQ_LOCAL_VAR: N = "eqEqTemp$" val FAKE_LOCAL_THIS: N = "this$" - val IMPLCLASS_CONSTRUCTOR: N = "$init$" val LAZY_LOCAL: N = "$lzy" val LAZY_LOCAL_INIT: N = "$lzyINIT" val LAZY_FIELD_OFFSET: N = "OFFSET$" @@ -261,6 +260,7 @@ object StdNames { val SKOLEM: N = "<skolem>" val SPECIALIZED_INSTANCE: N = "specInstance$" val THIS: N = "_$this" + val TRAIT_CONSTRUCTOR: N = "$init$" val U2EVT: N = "u2evt$" final val Nil: N = "Nil" diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala index d8dddb082..78b187970 100644 --- a/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/src/dotty/tools/dotc/core/SymDenotations.scala @@ -530,7 +530,7 @@ object SymDenotations { final def isClassConstructor = name == nme.CONSTRUCTOR /** Is this the constructor of a trait? */ - final def isImplClassConstructor = name == nme.IMPLCLASS_CONSTRUCTOR + final def isImplClassConstructor = name == nme.TRAIT_CONSTRUCTOR /** Is this the constructor of a trait or a class */ final def isConstructor = name.isConstructorName @@ -1630,8 +1630,11 @@ object SymDenotations { override def fullName(implicit ctx: Context): Name = super.fullName override def primaryConstructor(implicit ctx: Context): Symbol = { - val cname = if (this is ImplClass) nme.IMPLCLASS_CONSTRUCTOR else nme.CONSTRUCTOR - info.decls.denotsNamed(cname).last.symbol // denotsNamed returns Symbols in reverse order of occurrence + def constrNamed(cname: TermName) = info.decls.denotsNamed(cname).last.symbol + // denotsNamed returns Symbols in reverse order of occurrence + if (this.is(ImplClass)) constrNamed(nme.TRAIT_CONSTRUCTOR) + else + constrNamed(nme.CONSTRUCTOR).orElse(constrNamed(nme.TRAIT_CONSTRUCTOR)) } /** The parameter accessors of this class. Term and type accessors, diff --git a/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala b/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala index 9498cf43c..53e8478fa 100644 --- a/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala +++ b/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala @@ -438,7 +438,7 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas } val name1 = name0.adjustIfModuleClass(flags) - val name = if (name1 == nme.IMPLCLASS_CONSTRUCTOR) nme.CONSTRUCTOR else name1 + val name = if (name1 == nme.TRAIT_CONSTRUCTOR) nme.CONSTRUCTOR else name1 def isClassRoot = (name == classRoot.name) && (owner == classRoot.owner) && !(flags is ModuleClass) def isModuleClassRoot = (name == moduleClassRoot.name) && (owner == moduleClassRoot.owner) && (flags is Module) |