aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Contexts.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-02-03 15:42:16 +0100
committerMartin Odersky <odersky@gmail.com>2013-02-03 15:42:16 +0100
commit4608c427eb27315b9cc073677e7280ba3384f564 (patch)
tree30925fe8a5ff5a380d94bef0fe9bc90a04fd753b /src/dotty/tools/dotc/core/Contexts.scala
parent7209deef4f254dc1a2e8d7a0429771df9d58e308 (diff)
downloaddotty-4608c427eb27315b9cc073677e7280ba3384f564.tar.gz
dotty-4608c427eb27315b9cc073677e7280ba3384f564.tar.bz2
dotty-4608c427eb27315b9cc073677e7280ba3384f564.zip
Introduces caching for condensed contexts
Diffstat (limited to 'src/dotty/tools/dotc/core/Contexts.scala')
-rw-r--r--src/dotty/tools/dotc/core/Contexts.scala18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/dotty/tools/dotc/core/Contexts.scala b/src/dotty/tools/dotc/core/Contexts.scala
index 6a674dba8..1dc7ff2c1 100644
--- a/src/dotty/tools/dotc/core/Contexts.scala
+++ b/src/dotty/tools/dotc/core/Contexts.scala
@@ -69,16 +69,22 @@ object Contexts {
def inform(msg: String) = ???
def informTime(msg: String, start: Long): Unit = ???
+ private var _condensed: CondensedContext = null
+ def condensed: CondensedContext = {
+ if (_condensed == null)
+ _condensed = base.initialCtx.fresh
+ .withPeriod(period)
+ .withPrinter(printer)
+ .withSettings(sstate)
+ _condensed
+ }
+
def fresh: FreshContext = {
val newctx = super.clone.asInstanceOf[FreshContext]
newctx.underlying = this
+ newctx._condensed = null
newctx
}
-
- def condensed: CondensedContext = base.initialCtx.fresh
- .withPeriod(period)
- .withPrinter(printer)
- .withSettings(sstate)
}
abstract class CondensedContext extends Context
@@ -110,7 +116,7 @@ object Contexts {
val settings = new ScalaSettings
- val initialCtx: Context = new InitialContext(this).fresh
+ val initialCtx: Context = new InitialContext(this)
.withSettings(settings.defaultState)
val loaders = new SymbolLoaders