Skip to content

Commit c399d78

Browse files
committed
Compute enclosingClass and topLevelClass once in LambdaLift.liftLocals
1 parent 9021c5a commit c399d78

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/dotty/tools/dotc/transform/LambdaLift.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,13 +289,15 @@ class LambdaLift extends MiniPhase with IdentityDenotTransformer { thisTransform
289289
for ((local, lOwner) <- liftedOwner) {
290290
val (newOwner, maybeStatic) =
291291
if (lOwner is Package) {
292+
val encClass = local.enclosingClass
293+
val topClass = local.topLevelClass
292294
// member of a static object
293-
if (local.enclosingClass.isStatic && local.enclosingClass.isProperlyContainedIn(local.topLevelClass)) {
295+
if (encClass.isStatic && encClass.isProperlyContainedIn(topClass)) {
294296
// though the second condition seems wierd, it's not true for symbols which are defined in some
295297
// weird combinations of super calls.
296-
(local.enclosingClass, EmptyFlags)
298+
(encClass, EmptyFlags)
297299
} else
298-
(local.topLevelClass, JavaStatic)
300+
(topClass, JavaStatic)
299301
}
300302
else (lOwner, EmptyFlags)
301303
local.copySymDenotation(

0 commit comments

Comments
 (0)