diff options
author | Guillaume Martres <smarter@ubuntu.com> | 2017-02-18 23:58:49 +0100 |
---|---|---|
committer | Guillaume Martres <smarter@ubuntu.com> | 2017-02-19 00:00:19 +0100 |
commit | 5b330f1fea7a4c7ad3a33c237e99cc31fabfba59 (patch) | |
tree | 73a88e3b385f850fa108e7a4099979336c78513d /compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala | |
parent | 42e112b92a526bb9352febb14d8af48138bcfb87 (diff) | |
download | dotty-5b330f1fea7a4c7ad3a33c237e99cc31fabfba59.tar.gz dotty-5b330f1fea7a4c7ad3a33c237e99cc31fabfba59.tar.bz2 dotty-5b330f1fea7a4c7ad3a33c237e99cc31fabfba59.zip |
ImportInfo: removed ctx parameter from constructor
ImportInfo#toString required the ctx parameter,so it was replaced by
ImportInfo#toText.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala')
-rw-r--r-- | compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala b/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala index ac25f7cfd..b6d595b9c 100644 --- a/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala +++ b/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala @@ -7,6 +7,7 @@ import Contexts.Context, Scopes.Scope, Denotations.Denotation, Annotations.Annot import StdNames.{nme, tpnme} import ast.Trees._, ast._ import typer.Implicits._ +import typer.ImportInfo import config.Config import java.lang.Integer.toOctalString import config.Config.summarizeDepth @@ -502,6 +503,17 @@ class PlainPrinter(_ctx: Context) extends Printer { "?Unknown Implicit Result?" } + def toText(importInfo: ImportInfo): Text = { + val siteStr = importInfo.site.show + val exprStr = if (siteStr endsWith ".type") siteStr dropRight 5 else siteStr + val selectorStr = importInfo.selectors match { + case Ident(name) :: Nil => name.show + case _ => "{...}" + } + s"import $exprStr.$selectorStr" + } + + private var maxSummarized = Int.MaxValue def summarized[T](depth: Int)(op: => T): T = { |