diff options
author | VladimirNik <vladimir.nikolaev9@gmail.com> | 2014-02-07 02:41:54 +0400 |
---|---|---|
committer | VladimirNik <vladimir.nikolaev9@gmail.com> | 2014-02-20 01:23:25 +0400 |
commit | 931edcc94ebd73b420b2359d989442bf700588eb (patch) | |
tree | 40d1c09c1d6b32ad54d704550028eaea8873c477 /src/reflect/scala/reflect/api | |
parent | 3973f29cec9f06724941b68577908f546341c45e (diff) | |
download | scala-931edcc94ebd73b420b2359d989442bf700588eb.tar.gz scala-931edcc94ebd73b420b2359d989442bf700588eb.tar.bz2 scala-931edcc94ebd73b420b2359d989442bf700588eb.zip |
Attributed val/var processing for syntactics (SI-8180)
TypedTreesPrinter added
changes based on pull request comments:
print root packages flag; tests for syntactics; SyntacticEmptyTypeTree added to Printers
Diffstat (limited to 'src/reflect/scala/reflect/api')
-rw-r--r-- | src/reflect/scala/reflect/api/Printers.scala | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/reflect/scala/reflect/api/Printers.scala b/src/reflect/scala/reflect/api/Printers.scala index b262fdce68..3591712708 100644 --- a/src/reflect/scala/reflect/api/Printers.scala +++ b/src/reflect/scala/reflect/api/Printers.scala @@ -209,21 +209,23 @@ trait Printers { self: Universe => * Renders the code of the passed tree, so that: * 1) it can be later compiled by scalac retaining the same meaning, * 2) it looks pretty. - * At the moment we have handled #1 for unattributed trees and - * later on plan to account for typical idiosyncrasies of the typechecker. + * #1 is available for unattributed trees and attributed trees * #2 is more or less okay indentation-wise, but at the moment there's a lot of desugaring - * left in place, and that's what we also plan to improve in the future. + * left in place, and that's what we plan to improve in the future. + * printTypes, printIds, printPositions options have the same meaning as for TreePrinter + * printRootPkg option is available only for attributed trees. * * @group Printers */ - def showCode(tree: Tree) = render(tree, newCodePrinter) + def showCode(tree: Tree, printTypes: BooleanFlag = None, printIds: BooleanFlag = None, printPositions: BooleanFlag = None, printRootPkg: Boolean = false) = + render(tree, newCodePrinter(_, tree, printRootPkg), printTypes, printIds, None, None, printPositions) /** * Hook to define what `showCode(...)` means. * @group Printers */ - protected def newCodePrinter(out: PrintWriter): TreePrinter - + protected def newCodePrinter(out: PrintWriter, tree: Tree, printRootPkg: Boolean): TreePrinter + /** Renders internal structure of a reflection artifact as the * visualization of a Scala syntax tree. * |