diff options
author | Paul Phillips <paulp@improving.org> | 2012-04-24 07:51:19 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-04-25 09:09:29 -0700 |
commit | c22ec635c75170d1ac1cb0074e532b4186eed845 (patch) | |
tree | 44713230e43a29b34bb87a41cc1719334fe32391 /src/compiler/scala/reflect/internal/SymbolTable.scala | |
parent | 5cf9499731255078de62c8f3704fa596b564bf0e (diff) | |
download | scala-c22ec635c75170d1ac1cb0074e532b4186eed845.tar.gz scala-c22ec635c75170d1ac1cb0074e532b4186eed845.tar.bz2 scala-c22ec635c75170d1ac1cb0074e532b4186eed845.zip |
Some long overdue conveniences.
Not just conveniences though. One of the clearest statements made
by profiling is that collections methods of the form of the enclosed
flatCollect are materially faster than the alternatives.
Diffstat (limited to 'src/compiler/scala/reflect/internal/SymbolTable.scala')
-rw-r--r-- | src/compiler/scala/reflect/internal/SymbolTable.scala | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/compiler/scala/reflect/internal/SymbolTable.scala b/src/compiler/scala/reflect/internal/SymbolTable.scala index 7d9dd282cf..9158c2a4d4 100644 --- a/src/compiler/scala/reflect/internal/SymbolTable.scala +++ b/src/compiler/scala/reflect/internal/SymbolTable.scala @@ -76,6 +76,19 @@ abstract class SymbolTable extends api.Universe result } + // For too long have we suffered in order to sort NAMES. + // I'm pretty sure there's a reasonable default for that. + // Notice challenge created by Ordering's invariance. + implicit def lowPriorityNameOrdering[T <: Names#Name]: Ordering[T] = + SimpleNameOrdering.asInstanceOf[Ordering[T]] + + private object SimpleNameOrdering extends Ordering[Names#Name] { + def compare(n1: Names#Name, n2: Names#Name) = ( + if (n1 eq n2) 0 + else n1.toString compareTo n2.toString + ) + } + /** Dump each symbol to stdout after shutdown. */ final val traceSymbolActivity = sys.props contains "scalac.debug.syms" |