aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/printing/PlainPrinter.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-06-18 13:27:43 +0200
committerMartin Odersky <odersky@gmail.com>2015-06-22 11:40:20 +0200
commit131ab5c1261608715cf2fde3aa44a04777cbda64 (patch)
tree3f878ca320f25d064e39d8c1846e0885303da589 /src/dotty/tools/dotc/printing/PlainPrinter.scala
parent6f4b38cf9d1711ec525219d9b0b8049c95047f38 (diff)
downloaddotty-131ab5c1261608715cf2fde3aa44a04777cbda64.tar.gz
dotty-131ab5c1261608715cf2fde3aa44a04777cbda64.tar.bz2
dotty-131ab5c1261608715cf2fde3aa44a04777cbda64.zip
Avoid double context creation when modes change on a fresh context.
Move addMode and friends to two decorators, one for Context, the other for FreshContext. Implement behavior accordingly. This avoids creating two contexts in situations like: c.fresh.setxploreTyperState.addMode(...) Mow we can write c.fresh.addMode(...).setExploreTyperState Because addMode returns a fresh context when applied to a fresh context. Note that we specifically do not want virtual dispatch of addMode, that's why it was moved to a decorator. Also: removed mention of ".fresh: when just forllowed by an addMode, because that one is redundant.
Diffstat (limited to 'src/dotty/tools/dotc/printing/PlainPrinter.scala')
-rw-r--r--src/dotty/tools/dotc/printing/PlainPrinter.scala2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/printing/PlainPrinter.scala b/src/dotty/tools/dotc/printing/PlainPrinter.scala
index 86dd3878c..5d2309e95 100644
--- a/src/dotty/tools/dotc/printing/PlainPrinter.scala
+++ b/src/dotty/tools/dotc/printing/PlainPrinter.scala
@@ -12,7 +12,7 @@ import typer.Mode
import scala.annotation.switch
class PlainPrinter(_ctx: Context) extends Printer {
- protected[this] implicit def ctx: Context = _ctx.fresh.addMode(Mode.Printing)
+ protected[this] implicit def ctx: Context = _ctx.addMode(Mode.Printing)
protected def maxToTextRecursions = 100