summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/interpreter/Naming.scala
diff options
context:
space:
mode:
authorSom Snytt <som.snytt@gmail.com>2012-12-04 01:39:46 -0800
committerSom Snytt <som.snytt@gmail.com>2012-12-06 15:09:32 -0800
commit1fa4ad083d7dc55ce498389d935b38c5b974b793 (patch)
treeab5f3501dd1081f88d0cec8634139b96e14b1bd1 /src/compiler/scala/tools/nsc/interpreter/Naming.scala
parent81e68f9abdbb77b8188375aad6568d4eac51d248 (diff)
downloadscala-1fa4ad083d7dc55ce498389d935b38c5b974b793.tar.gz
scala-1fa4ad083d7dc55ce498389d935b38c5b974b793.tar.bz2
scala-1fa4ad083d7dc55ce498389d935b38c5b974b793.zip
Restore unmangling but add -raw; massage options to support
tool args like -raw and combined -pv, and not pass through arbitrary options. If class arg fails, try it as a live term and use its enclosing class, to support "def m = 7; javap m". That might be more fun with filtering (to see only m). This saves having to know the line and iw's. There are no doubt more fun features for another rainy day. And it will rain again someday.
Diffstat (limited to 'src/compiler/scala/tools/nsc/interpreter/Naming.scala')
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/Naming.scala12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/interpreter/Naming.scala b/src/compiler/scala/tools/nsc/interpreter/Naming.scala
index 41ddf23de4..57f3675ada 100644
--- a/src/compiler/scala/tools/nsc/interpreter/Naming.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/Naming.scala
@@ -6,6 +6,8 @@
package scala.tools.nsc
package interpreter
+import scala.util.Properties.lineSeparator
+
/** This is for name logic which is independent of the compiler (notice there's no Global.)
* That includes at least generating, metaquoting, mangling, and unmangling.
*/
@@ -18,8 +20,14 @@ trait Naming {
// <ESC> for ansi codes.
val binaryChars = cleaned count (ch => ch < 32 && !ch.isWhitespace && ch != ESC)
// Lots of binary chars - translate all supposed whitespace into spaces
- if (binaryChars > 5)
- cleaned map (ch => if (ch.isWhitespace) ' ' else if (ch < 32) '?' else ch)
+ // except supposed line endings, otherwise scrubbed lines run together
+ if (binaryChars > 5) // more than one can count while holding a hamburger
+ cleaned map {
+ case c if lineSeparator contains c => c
+ case c if c.isWhitespace => ' '
+ case c if c < 32 => '?'
+ case c => c
+ }
// Not lots - preserve whitespace and ESC
else
cleaned map (ch => if (ch.isWhitespace || ch == ESC) ch else if (ch < 32) '?' else ch)