@@ -153,6 +153,14 @@ object Contexts {
153
153
protected def gadt_= (gadt : GADTMap ) = _gadt = gadt
154
154
def gadt : GADTMap = _gadt
155
155
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
+
156
164
/** A map in which more contextual properties can be stored */
157
165
private var _moreProperties : Map [String , Any ] = _
158
166
protected def moreProperties_= (moreProperties : Map [String , Any ]) = _moreProperties = moreProperties
@@ -423,6 +431,7 @@ object Contexts {
423
431
def setDiagnostics (diagnostics : Option [StringBuilder ]): this .type = { this .diagnostics = diagnostics; this }
424
432
def setTypeComparerFn (tcfn : Context => TypeComparer ): this .type = { this .typeComparer = tcfn(this ); this }
425
433
def setSearchHistory (searchHistory : SearchHistory ): this .type = { this .searchHistory = searchHistory; this }
434
+ def setFreshNames (freshNames : FreshNameCreator ): this .type = { this .freshNames = freshNames; this }
426
435
def setMoreProperties (moreProperties : Map [String , Any ]): this .type = { this .moreProperties = moreProperties; this }
427
436
428
437
def setProperty (prop : (String , Any )): this .type = setMoreProperties(moreProperties + prop)
@@ -468,6 +477,7 @@ object Contexts {
468
477
typeAssigner = TypeAssigner
469
478
runInfo = new RunInfo (this )
470
479
diagnostics = None
480
+ freshNames = new FreshNameCreator .Default
471
481
moreProperties = Map .empty
472
482
typeComparer = new TypeComparer (this )
473
483
searchHistory = new SearchHistory (0 , Map ())
@@ -498,12 +508,6 @@ object Contexts {
498
508
/** The platform */
499
509
val platform : Platform = new JavaPlatform
500
510
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
-
507
511
/** The loader that loads the members of _root_ */
508
512
def rootLoader (root : TermSymbol )(implicit ctx : Context ): SymbolLoader = platform.rootLoader(root)
509
513
0 commit comments