diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/LazyVals.scala | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/LazyVals.scala b/src/compiler/scala/tools/nsc/transform/LazyVals.scala index b53fa2fcf4..f3d74e3ed4 100644 --- a/src/compiler/scala/tools/nsc/transform/LazyVals.scala +++ b/src/compiler/scala/tools/nsc/transform/LazyVals.scala @@ -52,7 +52,8 @@ abstract class LazyVals extends Transform { tree match { case DefDef(mods, name, tparams, vparams, tpt, rhs) => val res = if (!sym.owner.isClass && sym.hasFlag(LAZY)) { - val enclosingDummyOrMethod = if (sym.owner.isLocalDummy) sym.owner else sym.enclMethod + val enclosingDummyOrMethod = + if (sym.enclMethod == NoSymbol) sym.owner else sym.enclMethod val idx = lazyVals(enclosingDummyOrMethod) val rhs1 = mkLazyDef(enclosingDummyOrMethod, super.transform(rhs), idx) lazyVals(sym.owner) = idx + 1 @@ -71,6 +72,8 @@ abstract class LazyVals extends Transform { case Block(_, _) if !added => added = true typed(addBitmapDefs(sym, stat)) + case ValDef(mods, name, tpt, b @ Block(_, _)) => + typed(copy.ValDef(stat, mods, name, tpt, addBitmapDefs(stat.symbol, b))) case _ => stat } |