diff options
author | Martin Odersky <odersky@gmail.com> | 2014-03-26 12:28:12 +0100 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2014-03-29 09:16:41 +0100 |
commit | 0a1e969cb09e953d6b3f3b64b63a050588aa3360 (patch) | |
tree | fe5bdc5e6d23958a8fdf058dcd6d70798187ceff /src/dotty/tools/dotc/printing/Showable.scala | |
parent | 21c92528ca6598a918e096601d49f99cc61b4582 (diff) | |
download | dotty-0a1e969cb09e953d6b3f3b64b63a050588aa3360.tar.gz dotty-0a1e969cb09e953d6b3f3b64b63a050588aa3360.tar.bz2 dotty-0a1e969cb09e953d6b3f3b64b63a050588aa3360.zip |
Summary printing
Added general way to produce summaries when shwowing trees or types.
Summaries have limited, configrable recusion depth.
fix showSummary
Diffstat (limited to 'src/dotty/tools/dotc/printing/Showable.scala')
-rw-r--r-- | src/dotty/tools/dotc/printing/Showable.scala | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/printing/Showable.scala b/src/dotty/tools/dotc/printing/Showable.scala index cb65193e6..550d80060 100644 --- a/src/dotty/tools/dotc/printing/Showable.scala +++ b/src/dotty/tools/dotc/printing/Showable.scala @@ -4,6 +4,7 @@ package printing import core._ import Contexts._, Texts._, Decorators._ +import config.Config.summarizeDepth trait Showable extends Any { @@ -20,4 +21,13 @@ trait Showable extends Any { /** The string representation of this showable element. */ def show(implicit ctx: Context): String = toText(ctx.printer).show -}
\ No newline at end of file + + /** The summarized string representation of this showable element. + * Recursion depth is limited to some smallish value. Default is + * Config.summarizeDepth. + */ + def showSummary(depth: Int)(implicit ctx: Context): String = + ctx.printer.summarized(depth)(show) + + def showSummary(implicit ctx: Context): String = showSummary(summarizeDepth) +} |