diff --git a/compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala b/compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala index fb5fb35e49e9..8114a00f80a9 100644 --- a/compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala +++ b/compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala @@ -63,6 +63,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma type Throw = tpd.Apply type Labeled = tpd.Labeled type Return = tpd.Return + type WhileDo = tpd.WhileDo type Block = tpd.Block type Typed = tpd.Typed type Match = tpd.Match @@ -196,6 +197,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma implicit val ThrowTag: ClassTag[Throw] = ClassTag[Throw](classOf[Throw]) implicit val LabeledTag: ClassTag[Labeled] = ClassTag[Labeled](classOf[Labeled]) implicit val ReturnTag: ClassTag[Return] = ClassTag[Return](classOf[Return]) + implicit val WhileDoTag: ClassTag[WhileDo] = ClassTag[WhileDo](classOf[WhileDo]) implicit val LiteralTag: ClassTag[Literal] = ClassTag[Literal](classOf[Literal]) implicit val BlockTag: ClassTag[Block] = ClassTag[Block](classOf[Block]) implicit val TypedTag: ClassTag[Typed] = ClassTag[Typed](classOf[Typed]) @@ -1088,6 +1090,11 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma def _2: Symbol = if (field.from.symbol.isLabel) field.from.symbol else NoSymbol } + object WhileDo extends WhileDoDeconstructor { + def _1: Tree = field.cond + def _2: Tree = field.body + } + object Ident extends IdentDeconstructor { def get = field.name } diff --git a/compiler/src/dotty/tools/dotc/ast/Desugar.scala b/compiler/src/dotty/tools/dotc/ast/Desugar.scala index 1104ecb9230e..b22e31492156 100644 --- a/compiler/src/dotty/tools/dotc/ast/Desugar.scala +++ b/compiler/src/dotty/tools/dotc/ast/Desugar.scala @@ -927,13 +927,6 @@ object desugar { /** Main desugaring method */ def apply(tree: Tree)(implicit ctx: Context): Tree = { - /** { label def lname(): Unit = rhs; call } - */ - def labelDefAndCall(lname: TermName, rhs: Tree, call: Tree) = { - val ldef = DefDef(lname, Nil, ListOfNil, TypeTree(defn.UnitType), rhs).withFlags(Label | Synthetic) - Block(ldef, call) - } - /** Create tree for for-comprehension `` or * `` where mapName and flatMapName are chosen * corresponding to whether this is a for-do or a for-yield. @@ -1158,16 +1151,10 @@ object desugar { case PrefixOp(op, t) => val nspace = if (ctx.mode.is(Mode.Type)) tpnme else nme Select(t, nspace.UNARY_PREFIX ++ op.name) - case WhileDo(cond, body) => - // {