diff options
author | Lukas Rytz <lukas.rytz@gmail.com> | 2015-01-21 19:57:45 +0100 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@gmail.com> | 2015-02-07 07:45:47 +0100 |
commit | 0bcc871e3f4c4331fb53ec0e7087669589a607d6 (patch) | |
tree | 86af55ac347552c35a8d5b9bf1a6085e9177b3fb /src/compiler/scala/tools/nsc/CompilationUnits.scala | |
parent | d7b11520222c9e995d27de46fecc19c5a1fa5b74 (diff) | |
download | scala-0bcc871e3f4c4331fb53ec0e7087669589a607d6.tar.gz scala-0bcc871e3f4c4331fb53ec0e7087669589a607d6.tar.bz2 scala-0bcc871e3f4c4331fb53ec0e7087669589a607d6.zip |
SI-9105 Fix EnclosingMethod for classes defined in lambdas
This change fixes both GenASM and GenBCode, except for the change
to renaming in LamdaLift mentioned below.
The reason for an inconsistent EnclosingMethod attribute was the
symbol owner chain. Initially, closure class symbols don't exist, they
are only created in UnCurry (delambdafy:inline). So walking the
originalOwner of a definition does not yield closure classes.
The commit also fixes uses of isAnonymousClass, isAnonymousFunction
and isDelambdafyFunction in two ways:
1. by phase-travelling to an early phase. after flatten, the name
includes the name of outer classes, so the properties may become
accidentally true (they check for a substring in the name)
2. by ensuring that the (destructive) renames during LambdaLift
don't make the above properties accidentally true. This was in
fact the cause for SI-8900.
Diffstat (limited to 'src/compiler/scala/tools/nsc/CompilationUnits.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/CompilationUnits.scala | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/CompilationUnits.scala b/src/compiler/scala/tools/nsc/CompilationUnits.scala index 1a6843a249..6be1fda1b5 100644 --- a/src/compiler/scala/tools/nsc/CompilationUnits.scala +++ b/src/compiler/scala/tools/nsc/CompilationUnits.scala @@ -25,9 +25,9 @@ trait CompilationUnits { global: Global => class CompilationUnit(val source: SourceFile) extends CompilationUnitContextApi { self => /** the fresh name creator */ - implicit val fresh: FreshNameCreator = new FreshNameCreator - def freshTermName(prefix: String = "x$") = global.freshTermName(prefix) - def freshTypeName(prefix: String) = global.freshTypeName(prefix) + implicit val fresh: FreshNameCreator = new FreshNameCreator + def freshTermName(prefix: String = nme.FRESH_TERM_NAME_PREFIX) = global.freshTermName(prefix) + def freshTypeName(prefix: String) = global.freshTypeName(prefix) /** the content of the compilation unit in tree form */ var body: Tree = EmptyTree |