Skip to content

Commit a66efc2

Browse files
committed
Remove one sneaky left-over WhileDo-like label-def.
1 parent a64ba26 commit a66efc2

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

compiler/src/dotty/tools/dotc/ast/tpd.scala

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -313,16 +313,6 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
313313
Block(cdef :: Nil, New(cls.typeRef, Nil))
314314
}
315315

316-
// { <label> def while$(): Unit = if (cond) { body; while$() } ; while$() }
317-
def WhileDo(owner: Symbol, cond: Tree, body: List[Tree])(implicit ctx: Context): Tree = {
318-
val sym = ctx.newSymbol(owner, nme.WHILE_PREFIX, Flags.Label | Flags.Synthetic,
319-
MethodType(Nil, defn.UnitType), coord = cond.pos)
320-
321-
val call = Apply(ref(sym), Nil)
322-
val rhs = If(cond, Block(body, call), unitLiteral)
323-
Block(List(DefDef(sym, rhs)), call)
324-
}
325-
326316
def Import(expr: Tree, selectors: List[untpd.Tree])(implicit ctx: Context): Import =
327317
ta.assignType(untpd.Import(expr, selectors), ctx.newImportSymbol(ctx.owner, expr))
328318

compiler/src/dotty/tools/dotc/transform/LazyVals.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,8 @@ class LazyVals extends MiniPhase with IdentityDenotTransformer {
376376
val cases = Match(stateMask.appliedTo(ref(flagSymbol), Literal(Constant(ord))),
377377
List(compute, waitFirst, waitSecond, computed, default)) //todo: annotate with @switch
378378

379-
val whileBody = List(ref(flagSymbol).becomes(getFlag.appliedTo(thiz, offset)), cases)
380-
val cycle = WhileDo(methodSymbol, whileCond, whileBody)
379+
val whileBody = Block(ref(flagSymbol).becomes(getFlag.appliedTo(thiz, offset)) :: Nil, cases)
380+
val cycle = WhileDo(whileCond, whileBody)
381381
val setNullables = nullOut(nullables)
382382
DefDef(methodSymbol, Block(resultDef :: retryDef :: flagDef :: cycle :: setNullables, ref(resultSymbol)))
383383
}

0 commit comments

Comments
 (0)