aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Contexts.scala
diff options
context:
space:
mode:
authorFelix Mulder <felix.mulder@gmail.com>2016-06-28 18:04:31 +0200
committerFelix Mulder <felix.mulder@gmail.com>2016-08-19 15:37:28 +0200
commitc80af6a29b816d2ba7863b25b5c508efc4362b73 (patch)
treec489e58bed53f185703fdeb0c030383b2e4ebd00 /src/dotty/tools/dotc/core/Contexts.scala
parent81a86be75dd45f6e3eae4bb5fdd016058738c497 (diff)
downloaddotty-c80af6a29b816d2ba7863b25b5c508efc4362b73.tar.gz
dotty-c80af6a29b816d2ba7863b25b5c508efc4362b73.tar.bz2
dotty-c80af6a29b816d2ba7863b25b5c508efc4362b73.zip
Introduce DocMiniPhase concept, fused phases
Like dotty, dottydoc can now also enjoy the modularity of having fused mini-phases. By extending `DocMiniPhase` and overriding the appropriate methods, one can alter the DocAST easily. ping: @DarkDimius
Diffstat (limited to 'src/dotty/tools/dotc/core/Contexts.scala')
-rw-r--r--src/dotty/tools/dotc/core/Contexts.scala13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/core/Contexts.scala b/src/dotty/tools/dotc/core/Contexts.scala
index d3ebe32fe..7490a62cc 100644
--- a/src/dotty/tools/dotc/core/Contexts.scala
+++ b/src/dotty/tools/dotc/core/Contexts.scala
@@ -492,7 +492,7 @@ object Contexts {
/** A class defining the initial context with given context base
* and set of possible settings.
*/
- class InitialContext(val base: ContextBase, settings: SettingGroup) extends FreshContext {
+ private class InitialContext(val base: ContextBase, settings: SettingGroup) extends FreshContext {
outer = NoContext
period = InitialPeriod
mode = Mode.None
@@ -576,6 +576,17 @@ object Contexts {
def addDocstring(sym: Symbol, doc: Option[Comment]): Unit =
doc.map(d => _docstrings += (sym -> d))
+
+ private[this] val _packages: mutable.Map[String, AnyRef] = mutable.Map.empty
+ def packages[A]: mutable.Map[String, A] = _packages.asInstanceOf[mutable.Map[String, A]]
+
+ /** Should perhaps factorize this into caches that get flushed */
+ private var _defs: Map[Symbol, Set[Symbol]] = Map.empty
+ def defs(sym: Symbol): Set[Symbol] = _defs.get(sym).getOrElse(Set.empty)
+
+ def addDef(s: Symbol, d: Symbol): Unit = _defs = (_defs + {
+ s -> _defs.get(s).map(xs => xs + d).getOrElse(Set(d))
+ })
}
/** The essential mutable state of a context base, collected into a common class */