@@ -153,6 +153,14 @@ object Contexts {
153153 protected def gadt_= (gadt : GADTMap ) = _gadt = gadt
154154 def gadt : GADTMap = _gadt
155155
156+ /** The current fresh name creator */
157+ private [this ] var _freshNames : FreshNameCreator = _
158+ protected def freshNames_= (freshNames : FreshNameCreator ) = _freshNames = freshNames
159+ def freshNames : FreshNameCreator = _freshNames
160+
161+ def freshName (prefix : String = " " ): String = freshNames.newName(prefix)
162+ def freshName (prefix : Name ): String = freshName(prefix.toString)
163+
156164 /** A map in which more contextual properties can be stored */
157165 private var _moreProperties : Map [String , Any ] = _
158166 protected def moreProperties_= (moreProperties : Map [String , Any ]) = _moreProperties = moreProperties
@@ -423,6 +431,7 @@ object Contexts {
423431 def setDiagnostics (diagnostics : Option [StringBuilder ]): this .type = { this .diagnostics = diagnostics; this }
424432 def setTypeComparerFn (tcfn : Context => TypeComparer ): this .type = { this .typeComparer = tcfn(this ); this }
425433 def setSearchHistory (searchHistory : SearchHistory ): this .type = { this .searchHistory = searchHistory; this }
434+ def setFreshNames (freshNames : FreshNameCreator ): this .type = { this .freshNames = freshNames; this }
426435 def setMoreProperties (moreProperties : Map [String , Any ]): this .type = { this .moreProperties = moreProperties; this }
427436
428437 def setProperty (prop : (String , Any )): this .type = setMoreProperties(moreProperties + prop)
@@ -468,6 +477,7 @@ object Contexts {
468477 typeAssigner = TypeAssigner
469478 runInfo = new RunInfo (this )
470479 diagnostics = None
480+ freshNames = new FreshNameCreator .Default
471481 moreProperties = Map .empty
472482 typeComparer = new TypeComparer (this )
473483 searchHistory = new SearchHistory (0 , Map ())
@@ -498,12 +508,6 @@ object Contexts {
498508 /** The platform */
499509 val platform : Platform = new JavaPlatform
500510
501- /** The standard fresh name creator */
502- val freshNames = new FreshNameCreator .Default
503-
504- def freshName (prefix : String = " " ): String = freshNames.newName(prefix)
505- def freshName (prefix : Name ): String = freshName(prefix.toString)
506-
507511 /** The loader that loads the members of _root_ */
508512 def rootLoader (root : TermSymbol )(implicit ctx : Context ): SymbolLoader = platform.rootLoader(root)
509513
0 commit comments