diff options
author | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-03-11 16:54:07 +0100 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-04-02 16:51:34 +0200 |
commit | 0f9132d6fa362e8ff5a8670afcd23f836f22dbd9 (patch) | |
tree | 4f502cae09c788b43ee8fb269282105a9122d14e /src/dotty/tools/backend | |
parent | 63d1f8661a13dc4b6ae087c87a6b30189fb61a8f (diff) | |
download | dotty-0f9132d6fa362e8ff5a8670afcd23f836f22dbd9.tar.gz dotty-0f9132d6fa362e8ff5a8670afcd23f836f22dbd9.tar.bz2 dotty-0f9132d6fa362e8ff5a8670afcd23f836f22dbd9.zip |
Emit inner classes table.
Diffstat (limited to 'src/dotty/tools/backend')
-rw-r--r-- | src/dotty/tools/backend/jvm/DottyBackendInterface.scala | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/dotty/tools/backend/jvm/DottyBackendInterface.scala b/src/dotty/tools/backend/jvm/DottyBackendInterface.scala index 357018857..9e923de09 100644 --- a/src/dotty/tools/backend/jvm/DottyBackendInterface.scala +++ b/src/dotty/tools/backend/jvm/DottyBackendInterface.scala @@ -28,6 +28,7 @@ import dotty.tools.dotc.util.{Positions, DotClass} import Decorators._ import tpd._ import StdNames.nme +import NameOps._ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{ trait NonExistentTree extends tpd.Tree @@ -382,7 +383,7 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{ def toTypeName: Name = n.toTypeName def isTypeName: Boolean = n.isTypeName def toTermName: Name = n.toTermName - def dropModule: Name = ??? + def dropModule: Name = n.stripModuleClassSuffix def len: Int = n.length def offset: Int = n.start @@ -409,7 +410,7 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{ // tests def isClass: Boolean = { - sym.isClass && (sym.isPackageObject || !(sym is Flags.Package)) + sym.isPackageObject || (sym.isClass) } def isType: Boolean = sym.isType def isAnonymousClass: Boolean = toDenot(sym).isAnonymousClass @@ -475,7 +476,9 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{ // navigation def owner: Symbol = toDenot(sym).owner - def rawowner: Symbol = owner + def rawowner: Symbol = { + originalOwner + } def originalOwner: Symbol = { try { if (sym.exists) { @@ -483,8 +486,7 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{ val validity = original.validFor val shiftedContext = ctx.withPhase(validity.phaseId) val r = toDenot(sym)(shiftedContext).maybeOwner - if(r is Flags.Package) NoSymbol - else r + r } else NoSymbol } catch { case e: NotDefinedHere => NoSymbol // todo: do we have a method to tests this? @@ -511,14 +513,20 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{ def companionModule: Symbol = toDenot(sym).companionModule def companionSymbol: Symbol = if (sym is Flags.Module) companionClass else companionModule def moduleClass: Symbol = toDenot(sym).moduleClass - def enclosingClassSym: Symbol = enclClass //todo is handled specially for JavaDefined symbols in scalac + def enclosingClassSym: Symbol = { + if(this.isClass) { + val ct = ctx.withPhase(ctx.flattenPhase.prev) + toDenot(sym)(ct).owner.enclosingClass(ct) + } + else sym.enclosingClass(ctx.withPhase(ctx.flattenPhase.prev)) + } //todo is handled specially for JavaDefined symbols in scalac // members def primaryConstructor: Symbol = toDenot(sym).primaryConstructor def nestedClasses: List[Symbol] = memberClasses //exitingPhase(currentRun.lambdaliftPhase)(sym.memberClasses) - def memberClasses: List[Symbol] = toDenot(sym).info.memberClasses.map(_.symbol).toList + def memberClasses: List[Symbol] = toDenot(sym).info.memberClasses(ctx.withPhase(ctx.flattenPhase.prev)).map(_.symbol).toList def annotations: List[Annotation] = Nil def companionModuleMembers: List[Symbol] = { // phase travel to exitingPickler: this makes sure that memberClassesOf only sees member classes, |