summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/transform/Flatten.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-11-01 13:01:59 -0700
committerPaul Phillips <paulp@improving.org>2012-11-02 00:08:34 -0700
commit77a45858777554c6e1fb7b9583359a6a492ec066 (patch)
tree619dd3849b1d0b4d3e91ef1cb6bce819e9cf5767 /src/compiler/scala/tools/nsc/transform/Flatten.scala
parent14704da1b854e04d8e8de81eb7741757f33a2d13 (diff)
downloadscala-77a45858777554c6e1fb7b9583359a6a492ec066.tar.gz
scala-77a45858777554c6e1fb7b9583359a6a492ec066.tar.bz2
scala-77a45858777554c6e1fb7b9583359a6a492ec066.zip
The improvements made possible by the scope changes.
Diffstat (limited to 'src/compiler/scala/tools/nsc/transform/Flatten.scala')
-rw-r--r--src/compiler/scala/tools/nsc/transform/Flatten.scala14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/Flatten.scala b/src/compiler/scala/tools/nsc/transform/Flatten.scala
index e2913bea0d..672a11ec30 100644
--- a/src/compiler/scala/tools/nsc/transform/Flatten.scala
+++ b/src/compiler/scala/tools/nsc/transform/Flatten.scala
@@ -18,18 +18,14 @@ abstract class Flatten extends InfoTransform {
/** the following two members override abstract members in Transform */
val phaseName: String = "flatten"
- /** Updates the owning scope with the given symbol; returns the old symbol.
+ /** Updates the owning scope with the given symbol, unlinking any others.
*/
- private def replaceSymbolInCurrentScope(sym: Symbol): Symbol = exitingFlatten {
+ private def replaceSymbolInCurrentScope(sym: Symbol): Unit = exitingFlatten {
val scope = sym.owner.info.decls
- val old = scope lookup sym.name andAlso scope.unlink
+ val old = (scope lookupUnshadowedEntries sym.name).toList
+ old foreach (scope unlink _)
scope enter sym
-
- if (old eq NoSymbol)
- log(s"lifted ${sym.fullLocationString}")
- else
- log(s"lifted ${sym.fullLocationString} after unlinking existing $old from scope.")
-
+ log(s"lifted ${sym.fullLocationString}" + ( if (old.isEmpty) "" else " after unlinking $old from scope." ))
old
}