Skip to content

Commit ef5c15c

Browse files
author
Tobias Bordenca
committed
Use color settings from Tasty instance
Reverted change in signature of Show and its methods
1 parent 3d281ff commit ef5c15c

File tree

6 files changed

+114
-116
lines changed

6 files changed

+114
-116
lines changed

compiler/src/dotty/tools/dotc/decompiler/DecompilationPrinter.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,11 @@ class DecompilationPrinter extends Phase {
3636

3737
private def printToOutput(out: PrintStream)(implicit ctx: Context): Unit = {
3838
val unit = ctx.compilationUnit
39-
val useColors = ctx.settings.color.value == "always"
4039
if (ctx.settings.printTasty.value) {
4140
new TastyPrinter(unit.pickled.head._2).printContents()
4241
} else {
4342
out.println(s"/** Decompiled from $unit */")
44-
out.println(new TastyImpl(ctx).showSourceCode.showTree(unit.tpdTree, useColors)(ctx))
43+
out.println(new TastyImpl(ctx).showSourceCode.showTree(unit.tpdTree)(ctx))
4544
}
4645
}
4746
}

library/src/scala/tasty/util/Show.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ import scala.tasty.Tasty
44

55
abstract class Show[T <: Tasty with Singleton](val tasty: T) {
66

7-
def showTree(tree: tasty.Tree, withColors: Boolean = false)(implicit ctx: tasty.Context): String
7+
def showTree(tree: tasty.Tree)(implicit ctx: tasty.Context): String
88

9-
def showCaseDef(caseDef: tasty.CaseDef, withColors: Boolean = false)(implicit ctx: tasty.Context): String
9+
def showCaseDef(caseDef: tasty.CaseDef)(implicit ctx: tasty.Context): String
1010

11-
def showPattern(pattern: tasty.Pattern, withColors: Boolean = false)(implicit ctx: tasty.Context): String
11+
def showPattern(pattern: tasty.Pattern)(implicit ctx: tasty.Context): String
1212

13-
def showTypeOrBoundsTree(tpt: tasty.TypeOrBoundsTree, withColors: Boolean = false)(implicit ctx: tasty.Context): String
13+
def showTypeOrBoundsTree(tpt: tasty.TypeOrBoundsTree)(implicit ctx: tasty.Context): String
1414

15-
def showTypeOrBounds(tpe: tasty.TypeOrBounds, withColors: Boolean = false)(implicit ctx: tasty.Context): String
15+
def showTypeOrBounds(tpe: tasty.TypeOrBounds)(implicit ctx: tasty.Context): String
1616

17-
def showConstant(const: tasty.Constant, withColors: Boolean = false)(implicit ctx: tasty.Context): String
17+
def showConstant(const: tasty.Constant)(implicit ctx: tasty.Context): String
1818

1919
def showSymbol(symbol: tasty.Symbol)(implicit ctx: tasty.Context): String
2020

library/src/scala/tasty/util/ShowExtractors.scala

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,21 @@ import scala.tasty.Tasty
55
class ShowExtractors[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty0) {
66
import tasty.{rootContext => _, _}
77

8-
def showTree(tree: Tree, withColors: Boolean = false)(implicit ctx: Context): String =
8+
def showTree(tree: Tree)(implicit ctx: Context): String =
99
new Buffer().visitTree(tree).result()
10-
11-
def showCaseDef(caseDef: CaseDef, withColors: Boolean = false)(implicit ctx: Context): String =
10+
def showCaseDef(caseDef: CaseDef)(implicit ctx: Context): String =
1211
new Buffer().visitCaseDef(caseDef).result()
1312

14-
def showPattern(pattern: tasty.Pattern, withColors: Boolean = false)(implicit ctx: tasty.Context): String =
13+
def showPattern(pattern: tasty.Pattern)(implicit ctx: tasty.Context): String =
1514
new Buffer().visitPattern(pattern).result()
1615

17-
def showTypeOrBoundsTree(tpt: TypeOrBoundsTree, withColors: Boolean = false)(implicit ctx: Context): String =
16+
def showTypeOrBoundsTree(tpt: TypeOrBoundsTree)(implicit ctx: Context): String =
1817
new Buffer().visitTypeTree(tpt).result()
1918

20-
def showTypeOrBounds(tpe: TypeOrBounds, withColors: Boolean = false)(implicit ctx: Context): String =
19+
def showTypeOrBounds(tpe: TypeOrBounds)(implicit ctx: Context): String =
2120
new Buffer().visitType(tpe).result()
2221

23-
def showConstant(const: Constant, withColors: Boolean = false)(implicit ctx: Context): String =
22+
def showConstant(const: Constant)(implicit ctx: Context): String =
2423
new Buffer().visitConstant(const).result()
2524

2625
def showSymbol(symbol: Symbol)(implicit ctx: Context): String =

0 commit comments

Comments
 (0)