Navigation Menu

Skip to content

Commit

Permalink
Array[Byte] => Array[Char] => String => Array[C...
Browse files Browse the repository at this point in the history
Array[Byte] => Array[Char] => String => Array[Char] => Name. That's not
how Professor Optimize said to do it! No review.
  • Loading branch information
paulp committed May 21, 2011
1 parent e22d7f9 commit 9cc4c5f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/compiler/scala/reflect/internal/Names.scala
Expand Up @@ -96,8 +96,10 @@ trait Names /*extends reflect.generic.Names*/ {

/** Create a term name from the UTF8 encoded bytes in bs[offset..offset+len-1].
*/
def newTermName(bs: Array[Byte], offset: Int, len: Int): TermName =
newTermName(Codec fromUTF8 bs.slice(offset, offset + len) mkString)
def newTermName(bs: Array[Byte], offset: Int, len: Int): TermName = {
val chars = Codec fromUTF8 bs.slice(offset, offset + len)
newTermName(chars, 0, chars.length)
}

/** Create a type name from the characters in cs[offset..offset+len-1].
*/
Expand Down

0 comments on commit 9cc4c5f

Please sign in to comment.