diff options
author | Lukas Rytz <lukas.rytz@gmail.com> | 2014-05-16 15:17:15 +0200 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@gmail.com> | 2014-05-21 22:48:57 +0200 |
commit | 805843dcd8aa955ac765d1789f891c7910156911 (patch) | |
tree | c8a5c54e8b6f6613cae5db0137f53ad1b3c04642 /src/reflect | |
parent | 88d63f2d6b0864c86c7ebfcca78cb94cb9347639 (diff) | |
download | scala-805843dcd8aa955ac765d1789f891c7910156911.tar.gz scala-805843dcd8aa955ac765d1789f891c7910156911.tar.bz2 scala-805843dcd8aa955ac765d1789f891c7910156911.zip |
Minor cleanups and commenting around BType.
Use `length` instead of `size` on arrays in `reflect/internal/Names`.
Diffstat (limited to 'src/reflect')
-rw-r--r-- | src/reflect/scala/reflect/internal/Names.scala | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/reflect/scala/reflect/internal/Names.scala b/src/reflect/scala/reflect/internal/Names.scala index ae9f2da4e5..fce1fc2a0c 100644 --- a/src/reflect/scala/reflect/internal/Names.scala +++ b/src/reflect/scala/reflect/internal/Names.scala @@ -40,7 +40,10 @@ trait Names extends api.Names { /** Hashtable for finding type names quickly. */ private val typeHashtable = new Array[TypeName](HASH_SIZE) - /** The hashcode of a name. */ + /** + * The hashcode of a name depends on the first, the last and the middle character, + * and the length of the name. + */ private def hashValue(cs: Array[Char], offset: Int, len: Int): Int = if (len > 0) (len * (41 * 41 * 41) + @@ -158,9 +161,9 @@ trait Names extends api.Names { final def lookupTypeNameIfExisting(cs: Array[Char], failOnNotFound: Boolean): TypeName = { - val hterm = hashValue(cs, 0, cs.size) & HASH_MASK + val hterm = hashValue(cs, 0, cs.length) & HASH_MASK var nterm = termHashtable(hterm) - while ((nterm ne null) && (nterm.length != cs.size || !equals(nterm.start, cs, 0, cs.size))) { + while ((nterm ne null) && (nterm.length != cs.length || !equals(nterm.start, cs, 0, cs.length))) { nterm = nterm.next } if (nterm eq null) { |