Skip to content

Commit 2443ecb

Browse files
sjrdallanrenucci
authored andcommitted
Remove one sneaky left-over WhileDo-like label-def.
1 parent 0fcbfdb commit 2443ecb

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
@@ -316,16 +316,6 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
316316
Block(cdef :: Nil, New(cls.typeRef, Nil))
317317
}
318318

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

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

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

373-
val whileBody = List(ref(flagSymbol).becomes(getFlag.appliedTo(thiz, offset)), cases)
374-
val cycle = WhileDo(methodSymbol, whileCond, whileBody)
373+
val whileBody = Block(ref(flagSymbol).becomes(getFlag.appliedTo(thiz, offset)) :: Nil, cases)
374+
val cycle = WhileDo(whileCond, whileBody)
375375
val setNullables = nullOut(nullables)
376376
DefDef(methodSymbol, Block(resultDef :: retryDef :: flagDef :: cycle :: setNullables, ref(resultSymbol)))
377377
}

0 commit comments

Comments
 (0)