aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-04-21 12:00:45 +0200
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2014-05-08 21:48:08 +0200
commit60527d656dfed2e5432d7c839c2ed4591709672b (patch)
tree43388f1e36973c3bb2cb4ec2017fa3a372392315 /src
parent8298eb20b072d405aad71ae6c390a4939c8f090f (diff)
downloaddotty-60527d656dfed2e5432d7c839c2ed4591709672b.tar.gz
dotty-60527d656dfed2e5432d7c839c2ed4591709672b.tar.bz2
dotty-60527d656dfed2e5432d7c839c2ed4591709672b.zip
Making reporters configurable
Add method to install a new reporter in a subcontext's typer state.
Diffstat (limited to 'src')
-rw-r--r--src/dotty/tools/dotc/core/TyperState.scala6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/core/TyperState.scala b/src/dotty/tools/dotc/core/TyperState.scala
index 6e17767d2..a4b365b17 100644
--- a/src/dotty/tools/dotc/core/TyperState.scala
+++ b/src/dotty/tools/dotc/core/TyperState.scala
@@ -35,6 +35,9 @@ class TyperState(val reporter: Reporter) extends DotClass with Showable {
*/
def fresh(isCommittable: Boolean): TyperState = this
+ /** A fresh type state with the same constraint as this one and the given reporter */
+ def withReporter(reporter: Reporter) = new TyperState(reporter)
+
/** Commit state so that it gets propagated to enclosing context */
def commit()(implicit ctx: Context): Unit = unsupported("commit")
@@ -64,6 +67,9 @@ extends TyperState(reporter) {
override def fresh(isCommittable: Boolean): TyperState =
new MutableTyperState(this, new StoreReporter, isCommittable)
+ override def withReporter(reporter: Reporter) =
+ new MutableTyperState(this, reporter, isCommittable)
+
override val isGlobalCommittable =
isCommittable &&
(!previous.isInstanceOf[MutableTyperState] || previous.isGlobalCommittable)