Skip to content

Commit 2cc525a

Browse files
authored
Merge pull request #5115 from dotty-staging/tailrec-use-labeled-blocks
Use `Labeled` blocks in `TailRec`, instead of label-defs.
2 parents f2b0b8a + 3084b1a commit 2cc525a

File tree

7 files changed

+217
-123
lines changed

7 files changed

+217
-123
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
130130
def Return(expr: Tree, from: Tree)(implicit ctx: Context): Return =
131131
ta.assignType(untpd.Return(expr, from))
132132

133+
def Return(expr: Tree, from: Symbol)(implicit ctx: Context): Return =
134+
Return(expr, Ident(from.termRef))
135+
133136
def WhileDo(cond: Tree, body: Tree)(implicit ctx: Context): WhileDo =
134137
ta.assignType(untpd.WhileDo(cond, body))
135138

compiler/src/dotty/tools/dotc/core/NameKinds.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,8 @@ object NameKinds {
286286
val NonLocalReturnKeyName: UniqueNameKind = new UniqueNameKind("nonLocalReturnKey")
287287
val WildcardParamName: UniqueNameKind = new UniqueNameKind("_$")
288288
val TailLabelName: UniqueNameKind = new UniqueNameKind("tailLabel")
289+
val TailLocalName: UniqueNameKind = new UniqueNameKind("$tailLocal")
290+
val TailTempName: UniqueNameKind = new UniqueNameKind("$tmp")
289291
val ExceptionBinderName: UniqueNameKind = new UniqueNameKind("ex")
290292
val SkolemName: UniqueNameKind = new UniqueNameKind("?")
291293
val LiftedTreeName: UniqueNameKind = new UniqueNameKind("liftedTree")

0 commit comments

Comments
 (0)