diff options
author | Den Shabalin <den.shabalin@gmail.com> | 2013-10-02 13:25:07 +0200 |
---|---|---|
committer | Den Shabalin <den.shabalin@gmail.com> | 2013-10-18 17:24:51 +0200 |
commit | 3692acaa40c8edcf4a5e7f4fcfa29ef090385df2 (patch) | |
tree | 7d0c1ec4a0ff78799183cf51152b85464c80b03c /src/compiler/scala/tools/nsc/util | |
parent | ed86ab0a83f08e742545cf6ef40818f520c7844f (diff) | |
download | scala-3692acaa40c8edcf4a5e7f4fcfa29ef090385df2.tar.gz scala-3692acaa40c8edcf4a5e7f4fcfa29ef090385df2.tar.bz2 scala-3692acaa40c8edcf4a5e7f4fcfa29ef090385df2.zip |
move fresh name creator into scala.reflect.internal.util
Diffstat (limited to 'src/compiler/scala/tools/nsc/util')
-rw-r--r-- | src/compiler/scala/tools/nsc/util/FreshNameCreator.scala | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/src/compiler/scala/tools/nsc/util/FreshNameCreator.scala b/src/compiler/scala/tools/nsc/util/FreshNameCreator.scala deleted file mode 100644 index e877c990f0..0000000000 --- a/src/compiler/scala/tools/nsc/util/FreshNameCreator.scala +++ /dev/null @@ -1,40 +0,0 @@ -/* NSC -- new Scala compiler - * Copyright 2005-2013 LAMP/EPFL - * @author Martin Odersky - */ - -package scala.tools.nsc -package util - -import scala.collection.mutable - -trait FreshNameCreator { - /** Do not call before after type checking ends. - * PP: I think that directive needs to lose a word somewhere. - */ - def newName(): String - def newName(prefix: String): String -} - -object FreshNameCreator { - class Default extends FreshNameCreator { - protected var counter = 0 - protected val counters = mutable.HashMap[String, Int]() withDefaultValue 0 - - /** - * Create a fresh name with the given prefix. It is guaranteed - * 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 = { - val safePrefix = prefix.replaceAll("""[<>]""", """\$""") - counters(safePrefix) += 1 - - safePrefix + counters(safePrefix) - } - def newName(): String = { - counter += 1 - "$" + counter + "$" - } - } -} |