Skip to content

Commit 0a8a2a3

Browse files
committed
Null out closure in LazyBodyAnnotation
1 parent 2f6cb08 commit 0a8a2a3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,15 @@ object Annotations {
6161
def tree(implicit ctx: Context) = body
6262
}
6363

64-
case class LazyBodyAnnotation(bodyExpr: Context => Tree) extends BodyAnnotation {
64+
case class LazyBodyAnnotation(private var bodyExpr: Context => Tree) extends BodyAnnotation {
6565
private var evaluated = false
6666
private var myBody: Tree = _
6767
def tree(implicit ctx: Context) = {
6868
if (evaluated) assert(myBody != null)
6969
else {
7070
evaluated = true
7171
myBody = bodyExpr(ctx)
72+
bodyExpr = null
7273
}
7374
myBody
7475
}

0 commit comments

Comments
 (0)