summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpaltherr <paltherr@epfl.ch>2004-09-16 15:58:02 +0000
committerpaltherr <paltherr@epfl.ch>2004-09-16 15:58:02 +0000
commitf614ac93d2d3d6e01f3b7ccd7c2c84ee2b734d62 (patch)
tree5d6985394ca8c726de04d7dfb0cb8a36498a8934
parent218f76a292baffa3748d4c62f38a6864a793206e (diff)
downloadscala-f614ac93d2d3d6e01f3b7ccd7c2c84ee2b734d62.tar.gz
scala-f614ac93d2d3d6e01f3b7ccd7c2c84ee2b734d62.tar.bz2
scala-f614ac93d2d3d6e01f3b7ccd7c2c84ee2b734d62.zip
- 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
-rw-r--r--sources/scalac/transformer/LambdaLift.java10
1 files changed, 10 insertions, 0 deletions
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) {