From f614ac93d2d3d6e01f3b7ccd7c2c84ee2b734d62 Mon Sep 17 00:00:00 2001 From: paltherr Date: Thu, 16 Sep 2004 15:58:02 +0000 Subject: - Readded a fixed version of the code to handle... - Readded a fixed version of the code to handle local variables owned by other local variables --- sources/scalac/transformer/LambdaLift.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sources/scalac/transformer/LambdaLift.java b/sources/scalac/transformer/LambdaLift.java index f8d5218659..5cb2d52117 100644 --- a/sources/scalac/transformer/LambdaLift.java +++ b/sources/scalac/transformer/LambdaLift.java @@ -581,10 +581,20 @@ public class LambdaLift extends OwnerTransformer case LabelDef(_, _, _): Symbol sym = tree.symbol(); assert sym.isLocal() : sym; + // This is to fix the owner of y from x to f in this example: + // class C { def f = { val x = { val y = ...; y } } } + if (!isClassMember(sym.owner())) { + assert isClassMember(sym.owner().owner()): Debug.show(tree, sym); + sym.setOwner(sym.owner().owner()); + } break; } } + // where + private boolean isClassMember(Symbol sym) { + return sym.isConstructor() || sym.owner().isClass(); + } void liftSymbol(Symbol sym, Symbol[] oldtparams, Symbol[] newtparams, Symbol[] newparams) { -- cgit v1.2.3