diff options
author | Martin Odersky <odersky@gmail.com> | 2015-10-30 23:19:59 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-10-30 23:19:59 +0100 |
commit | 64247c1935f13645a12f21238c73727ebb607134 (patch) | |
tree | 7e28c088ef4523de4130a6c178b84267e2a6dc6a /src/dotty/tools/dotc/core/Contexts.scala | |
parent | f6e454ba8ba2f1183177e1f69788bf9610512c3f (diff) | |
download | dotty-64247c1935f13645a12f21238c73727ebb607134.tar.gz dotty-64247c1935f13645a12f21238c73727ebb607134.tar.bz2 dotty-64247c1935f13645a12f21238c73727ebb607134.zip |
Make a new fresh name creator for each unit
Needed to make builds deterministic.
Diffstat (limited to 'src/dotty/tools/dotc/core/Contexts.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Contexts.scala | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/dotty/tools/dotc/core/Contexts.scala b/src/dotty/tools/dotc/core/Contexts.scala index f9d64b2cc..dcdfedca5 100644 --- a/src/dotty/tools/dotc/core/Contexts.scala +++ b/src/dotty/tools/dotc/core/Contexts.scala @@ -153,6 +153,14 @@ object Contexts { protected def gadt_=(gadt: GADTMap) = _gadt = gadt def gadt: GADTMap = _gadt + /**The current fresh name creator */ + private[this] var _freshNames: FreshNameCreator = _ + protected def freshNames_=(freshNames: FreshNameCreator) = _freshNames = freshNames + def freshNames: FreshNameCreator = _freshNames + + def freshName(prefix: String = ""): String = freshNames.newName(prefix) + def freshName(prefix: Name): String = freshName(prefix.toString) + /** A map in which more contextual properties can be stored */ private var _moreProperties: Map[String, Any] = _ protected def moreProperties_=(moreProperties: Map[String, Any]) = _moreProperties = moreProperties @@ -423,6 +431,7 @@ object Contexts { def setDiagnostics(diagnostics: Option[StringBuilder]): this.type = { this.diagnostics = diagnostics; this } def setTypeComparerFn(tcfn: Context => TypeComparer): this.type = { this.typeComparer = tcfn(this); this } def setSearchHistory(searchHistory: SearchHistory): this.type = { this.searchHistory = searchHistory; this } + def setFreshNames(freshNames: FreshNameCreator): this.type = { this.freshNames = freshNames; this } def setMoreProperties(moreProperties: Map[String, Any]): this.type = { this.moreProperties = moreProperties; this } def setProperty(prop: (String, Any)): this.type = setMoreProperties(moreProperties + prop) @@ -468,6 +477,7 @@ object Contexts { typeAssigner = TypeAssigner runInfo = new RunInfo(this) diagnostics = None + freshNames = new FreshNameCreator.Default moreProperties = Map.empty typeComparer = new TypeComparer(this) searchHistory = new SearchHistory(0, Map()) @@ -498,12 +508,6 @@ object Contexts { /** The platform */ val platform: Platform = new JavaPlatform - /** The standard fresh name creator */ - val freshNames = new FreshNameCreator.Default - - def freshName(prefix: String = ""): String = freshNames.newName(prefix) - def freshName(prefix: Name): String = freshName(prefix.toString) - /** The loader that loads the members of _root_ */ def rootLoader(root: TermSymbol)(implicit ctx: Context): SymbolLoader = platform.rootLoader(root) |