Skip to content

Commit 0493c53

Browse files
committed
Refactor Printer to simplify use
Remove the need to handle path dependent tasty.Reflection -ref
1 parent 7e7fd5f commit 0493c53

File tree

8 files changed

+1611
-1608
lines changed

8 files changed

+1611
-1608
lines changed

compiler/src/dotty/tools/dotc/tastyreflect/PrintersImpl.scala

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
package dotty.tools.dotc.tastyreflect
22

3-
import scala.tasty.util.{Printer, ExtractorsPrinter, SourceCodePrinter}
4-
53
trait PrintersImpl extends scala.tasty.reflect.Printers with scala.tasty.reflect.ReflectionCore { reflect: ReflectionImpl =>
64

7-
def showExtractors: Printer[reflect.type] = new ExtractorsPrinter[reflect.type](this)
5+
def showExtractors: reflect.Printer = new reflect.ExtractorsPrinter
86

9-
def showSourceCode: Printer[reflect.type] = new SourceCodePrinter[reflect.type](this)
7+
def showSourceCode: reflect.Printer = new reflect.SourceCodePrinter
108

119
/** Adds `show` as an extension method of a `Tree` */
1210
def TreeShowDeco(tree: Tree): ShowAPI = new ShowAPI {
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package dotty.tools.dotc.tastyreflect
22

3-
trait SettingsOpsImpl extends scala.tasty.reflect.SettingsOps with ReflectionCoreImpl {
3+
trait SettingsOpsImpl extends scala.tasty.reflect.SettingsOps with scala.tasty.reflect.ContextOps with ReflectionCoreImpl {
44

5-
def settings(implicit ctx: Context): Settings = ctx.settings
5+
def settings: Settings = rootContext.settings
66

77
def SettingsDeco(settings: Settings): SettingsAPI = new SettingsAPI {
8-
def color(implicit ctx: Context): Boolean = settings.color.value == "always"
8+
def color: Boolean = settings.color.value == "always"
99
}
1010

1111
}

library/src/scala/tasty/reflect/Printers.scala

Lines changed: 1591 additions & 1 deletion
Large diffs are not rendered by default.

library/src/scala/tasty/reflect/SettingsOps.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ package scala.tasty.reflect
33
trait SettingsOps extends ReflectionCore {
44

55
/** Compiler settings */
6-
def settings(implicit ctx: Context): Settings
6+
def settings: Settings
77

88
trait SettingsAPI {
9-
def color(implicit ctx: Context): Boolean
9+
def color: Boolean
1010
}
1111
implicit def SettingsDeco(settings: Settings): SettingsAPI
1212

library/src/scala/tasty/util/ExtractorsPrinter.scala

Lines changed: 0 additions & 326 deletions
This file was deleted.

library/src/scala/tasty/util/Printer.scala

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)