diff options
author | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2014-12-01 15:42:34 +0100 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2014-12-16 13:15:01 +0100 |
commit | 15bfcda6e63999cf644cd4e36e3000726e336025 (patch) | |
tree | bf25e2cc65acacb427b2860c95896fa1690f05f9 /src/dotty/tools/backend/jvm/DottyBackendInterface.scala | |
parent | f78ef2ca72a1b70db98fa9f6a44bf81d33f3ff28 (diff) | |
download | dotty-15bfcda6e63999cf644cd4e36e3000726e336025.tar.gz dotty-15bfcda6e63999cf644cd4e36e3000726e336025.tar.bz2 dotty-15bfcda6e63999cf644cd4e36e3000726e336025.zip |
Implemented handling of <label> DefDefs in backend.
Diffstat (limited to 'src/dotty/tools/backend/jvm/DottyBackendInterface.scala')
-rw-r--r-- | src/dotty/tools/backend/jvm/DottyBackendInterface.scala | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/dotty/tools/backend/jvm/DottyBackendInterface.scala b/src/dotty/tools/backend/jvm/DottyBackendInterface.scala index c469fb4bc..f37c48f3a 100644 --- a/src/dotty/tools/backend/jvm/DottyBackendInterface.scala +++ b/src/dotty/tools/backend/jvm/DottyBackendInterface.scala @@ -67,8 +67,7 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{ type ArrayValue = NonExistentTree type ApplyDynamic = NonExistentTree type ModuleDef = NonExistentTree - type LabelDef = NonExistentTree - + type LabelDef = tpd.DefDef val NoSymbol = Symbols.NoSymbol val NoPosition: Position = Positions.NoPosition @@ -216,6 +215,8 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{ def emitAsmp: Option[String] = None + def shouldEmitJumpAfterLabels = true + def dumpClasses: Option[String] = if(ctx.settings.Ydumpclasses.isDefault) None else Some(ctx.settings.Ydumpclasses.value) @@ -549,6 +550,9 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{ } case Types.ClassInfo(_, sym, _, _, _) => primitiveOrClassToBType(sym) // We get here, for example, for genLoadModule, which invokes toTypeKind(moduleClassSymbol.info) + case t: MethodType => // triggers for LabelDefs + t.resultType.toTypeKind(ct)(storage) + /* AnnotatedType should (probably) be eliminated by erasure. However we know it happens for * meta-annotated annotations (@(ann @getter) val x = 0), so we don't emit a warning. * The type in the AnnotationInfo is an AnnotatedTpe. Tested in jvm/annotations.scala. @@ -671,9 +675,15 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{ } object LabelDef extends LabelDeconstructor { - def _1: Name = ??? - def _2: List[Ident] = ??? - def _3: Tree = ??? + def _1: Name = field.name + def _2: List[Symbol] = field.vparamss.flatMap(_.map(_.symbol)) + def _3: Tree = field.rhs + + override def unapply(s: LabelDef): DottyBackendInterface.this.LabelDef.type = { + if(s.symbol is Flags.Label) this.field = s + else this.field = null + this + } } object Typed extends TypedDeconstrutor { |