diff options
author | Martin Odersky <odersky@gmail.com> | 2013-05-28 14:56:22 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-05-28 14:56:22 +0200 |
commit | c53ac49cbe7c98c05a99fea3c8e1dcad75275a82 (patch) | |
tree | 0eef0f9b2cf63f025f70183846bb90ef7b83dabb /src/dotty/tools/dotc/util | |
parent | 41c54e9b3df245defd774cf06132880479128cb5 (diff) | |
download | dotty-c53ac49cbe7c98c05a99fea3c8e1dcad75275a82.tar.gz dotty-c53ac49cbe7c98c05a99fea3c8e1dcad75275a82.tar.bz2 dotty-c53ac49cbe7c98c05a99fea3c8e1dcad75275a82.zip |
wip namer.
Diffstat (limited to 'src/dotty/tools/dotc/util')
-rw-r--r-- | src/dotty/tools/dotc/util/FreshNameCreator.scala | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/dotty/tools/dotc/util/FreshNameCreator.scala b/src/dotty/tools/dotc/util/FreshNameCreator.scala index d0c007d94..cc39008ed 100644 --- a/src/dotty/tools/dotc/util/FreshNameCreator.scala +++ b/src/dotty/tools/dotc/util/FreshNameCreator.scala @@ -24,15 +24,11 @@ object FreshNameCreator { * that the returned name has never been returned by a previous * call to this function (provided the prefix does not end in a digit). */ - def newName(prefix: String): String = { + def newName(prefix: String = ""): String = { val safePrefix = prefix.replaceAll("""[<>]""", """\$""") counters(safePrefix) += 1 - - safePrefix + counters(safePrefix) - } - def newName(): String = { - counter += 1 - "$" + counter + "$" + val counter = counters(safePrefix) + if (prefix.isEmpty) "$" + counter + "$" else safePrefix + counter } } } |