summaryrefslogtreecommitdiff
path: root/sources
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2004-09-24 13:00:36 +0000
committermichelou <michelou@epfl.ch>2004-09-24 13:00:36 +0000
commit4c98fce60278f602e00ccd14dd017d93aef875b5 (patch)
tree1cb5d728570da97de2fd37cedccbe875434d98a1 /sources
parent2dd10de725e3a17e702e94b2332247aea12752e1 (diff)
downloadscala-4c98fce60278f602e00ccd14dd017d93aef875b5.tar.gz
scala-4c98fce60278f602e00ccd14dd017d93aef875b5.tar.bz2
scala-4c98fce60278f602e00ccd14dd017d93aef875b5.zip
- added missing test in method 'nameToPackage'.
Diffstat (limited to 'sources')
-rw-r--r--sources/scala/tools/scalap/JavaWriter.scala7
1 files changed, 5 insertions, 2 deletions
diff --git a/sources/scala/tools/scalap/JavaWriter.scala b/sources/scala/tools/scalap/JavaWriter.scala
index 7fd75d2e2e..37ff3c9412 100644
--- a/sources/scala/tools/scalap/JavaWriter.scala
+++ b/sources/scala/tools/scalap/JavaWriter.scala
@@ -44,8 +44,11 @@ class JavaWriter(classfile: Classfile, writer: Writer) extends CodeWriter(writer
def nameToSimpleClass(str: String) =
Names.decode(str.substring(str.lastIndexOf('/') + 1));
- def nameToPackage(str: String) =
- Names.decode(str.substring(0, str.lastIndexOf('/')).replace('/', '.'));
+ def nameToPackage(str: String) = {
+ val inx = str.lastIndexOf('/');
+ val name = if (inx == -1) str else str.substring(0, inx).replace('/', '.');
+ Names.decode(name)
+ }
def sigToType(str: String): String =
sigToType(str, 0)._1;